aboutsummaryrefslogtreecommitdiffstats
path: root/include/Handler.hpp
diff options
context:
space:
mode:
authorNiklas Halle <niklas@niklashalle.net>2020-08-24 19:04:13 +0200
committerNiklas Halle <niklas@niklashalle.net>2020-08-24 19:04:13 +0200
commit38e20390ddf38edd74447ef7db2af660b8e0ff32 (patch)
tree19139ea991ae5d99b28d5c1f9f509ff0ebf4b151 /include/Handler.hpp
parent61464b6d069513eda07e4fc2638c8889cbce98f5 (diff)
downloadn_core-38e20390ddf38edd74447ef7db2af660b8e0ff32.tar.gz
n_core-38e20390ddf38edd74447ef7db2af660b8e0ff32.zip
add all available commands (in this branch? @Max where are the others?)
Diffstat (limited to 'include/Handler.hpp')
-rw-r--r--include/Handler.hpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/Handler.hpp b/include/Handler.hpp
new file mode 100644
index 0000000..3d4b830
--- /dev/null
+++ b/include/Handler.hpp
@@ -0,0 +1,21 @@
+#pragma once
+
+#include "crow.h"
+
+namespace Handler {
+ typedef crow::json::wvalue json;
+ typedef std::function<json(std::string const &arguments, std::string const &session,
+ void *payload)> handler_function;
+
+ struct CommandHandler {
+ [[nodiscard]] json exec(std::string const &arguments, std::string const &session) const {
+ return func(arguments, session, payload);
+ }
+
+ handler_function func{nullptr};
+ std::string description;
+ void *payload{nullptr};
+ };
+
+ std::vector<std::string> tokenizeArguments(std::string const &arguments, std::string const &delimiter = " ");
+} \ No newline at end of file