aboutsummaryrefslogtreecommitdiffstats
path: root/include/Handler.hpp
diff options
context:
space:
mode:
authorNiklas Halle <niklas@niklashalle.net>2020-08-26 11:20:44 +0200
committerNiklas Halle <niklas@niklashalle.net>2020-08-26 11:20:44 +0200
commit2f8ff5fc79e394b95bafdb5931f2cdddb8a7ae1c (patch)
treebb40e187f4362333503c5cf0622575db3a46c0d4 /include/Handler.hpp
parent38e20390ddf38edd74447ef7db2af660b8e0ff32 (diff)
downloadn_core-2f8ff5fc79e394b95bafdb5931f2cdddb8a7ae1c.tar.gz
n_core-2f8ff5fc79e394b95bafdb5931f2cdddb8a7ae1c.zip
Extended extra field of annotations to be an list of text-annotation pairs as well
Fixed CMake Boost findings
Diffstat (limited to 'include/Handler.hpp')
-rw-r--r--include/Handler.hpp11
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};
};