diff options
Diffstat (limited to 'include/Handler.hpp')
-rw-r--r-- | include/Handler.hpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/include/Handler.hpp b/include/Handler.hpp index 3d4b830..3aed302 100644 --- a/include/Handler.hpp +++ b/include/Handler.hpp @@ -1,5 +1,9 @@ #pragma once +#include <queue> +#include <string> +#include <functional> + #include "crow.h" namespace Handler { @@ -8,12 +12,17 @@ namespace Handler { void *payload)> handler_function; struct CommandHandler { + ~CommandHandler() { + delete description; + } + [[nodiscard]] json exec(std::string const &arguments, std::string const &session) const { return func(arguments, session, payload); } handler_function func{nullptr}; - std::string description; + // handler takes ownership of the description, using it after passing is unsafe + std::queue<json> *description{nullptr}; void *payload{nullptr}; }; |