summaryrefslogtreecommitdiff
path: root/commands.h
blob: bc4092fb34b53ecedc1854c3b14f95eeb6fe30cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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