summaryrefslogtreecommitdiff
path: root/commands.h
diff options
context:
space:
mode:
Diffstat (limited to 'commands.h')
-rw-r--r--commands.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/commands.h b/commands.h
new file mode 100644
index 0000000..bc4092f
--- /dev/null
+++ b/commands.h
@@ -0,0 +1,24 @@
+#ifndef COMMANDS_H
+#define COMMANDS_H
+
+#include <boost/function.hpp>
+
+#include <string>
+#include <vector>
+#include <map>
+#include <stdexcept>
+
+namespace commands {
+ typedef boost::function<std::vector<std::string> (const std::vector<std::string>&)> Handler;
+ extern std::map<std::string, commands::Handler> handlers;
+
+ class CommandException : public std::runtime_error {
+ public:
+ CommandException(const char *s) : std::runtime_error(s) {};
+ };
+
+ void init();
+ std::vector<std::string> execute(const std::vector<std::string>& args);
+};
+
+#endif