]> git.localhorst.tv Git - blank.git/blob - src/shared/CLI.hpp
impersonate command
[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 CLIContext;
11 class TokenStreamReader;
12 class World;
13
14 class CLI {
15
16 public:
17         struct Command {
18                 virtual ~Command();
19                 virtual void Execute(CLI &, CLIContext &, 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(CLIContext &, const std::string &);
29
30         World &GetWorld() noexcept { return world; }
31
32 private:
33         World &world;
34         std::map<std::string, Command *> commands;
35
36 };
37
38 }
39
40 #endif