From 38e20390ddf38edd74447ef7db2af660b8e0ff32 Mon Sep 17 00:00:00 2001 From: Niklas Halle Date: Mon, 24 Aug 2020 19:04:13 +0200 Subject: add all available commands (in this branch? @Max where are the others?) --- include/Handler.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 include/Handler.hpp (limited to 'include/Handler.hpp') 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 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 tokenizeArguments(std::string const &arguments, std::string const &delimiter = " "); +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf