#pragma once #include #include #include #include #include "crow.h" namespace Handler { typedef crow::json::wvalue json; typedef std::function handler_function; struct CommandHandler { CommandHandler(std::string command, handler_function func, std::vector *description, void *payload = nullptr); CommandHandler(CommandHandler &&o) noexcept; [[nodiscard]] json exec(std::string const &arguments, std::string const &session) const; std::string command; handler_function func{nullptr}; // handler does NOT take ownership of the description, you have to delete it - after this object is destroyed std::vector *description{nullptr}; void *payload{nullptr}; }; std::vector tokenizeArguments(std::string const &arguments, std::string const &delimiter = " "); }