aboutsummaryrefslogtreecommitdiffstats
path: root/include/Handler.hpp
diff options
context:
space:
mode:
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