]> git.localhorst.tv Git - blank.git/blob - src/shared/CLI.hpp
added simple command line
[blank.git] / src / shared / CLI.hpp
1 #ifndef BLANK_SHARED_CLI_HPP_
2 #define BLANK_SHARED_CLI_HPP_
3
4 #include <map>
5 #include <string>
6
7
8 namespace blank {
9
10 class Player;
11 class TokenStreamReader;
12 class World;
13
14 class CLI {
15
16 public:
17         struct Command {
18                 virtual ~Command();
19                 virtual void Execute(CLI &, Player &, TokenStreamReader &) = 0;
20         };
21
22 public:
23         explicit CLI(World &);
24         ~CLI();
25
26         void AddCommand(const std::string &name, Command *);
27
28         void Execute(Player &, const std::string &);
29
30         void Message(const std::string &msg);
31         void Error(const std::string &msg);
32
33 private:
34         World &world;
35         std::map<std::string, Command *> commands;
36
37 };
38
39 }
40
41 #endif