]> git.localhorst.tv Git - blank.git/blob - src/shared/CLIContext.hpp
5308bb2434146aa5d91e14263c3f5830491a0d03
[blank.git] / src / shared / CLIContext.hpp
1 #ifndef BLANK_SHARED_CLICONTEXT_HPP_
2 #define BLANK_SHARED_CLICONTEXT_HPP_
3
4 #include <string>
5
6
7 namespace blank {
8
9 class Player;
10
11 class CLIContext {
12
13 public:
14         explicit CLIContext(Player *p = nullptr)
15         : player(p) { }
16
17         /// check if this context associates a player
18         bool HasPlayer() { return player; }
19         /// get the player responsible for all this
20         /// only valid if HasPlayer() returns true
21         Player &GetPlayer() { return *player; }
22
23         /// an error has happened and the player should be notified
24         virtual void Error(const std::string &) = 0;
25
26         /// return to sender
27         /// use this for output concerning the originator of a command
28         virtual void Message(const std::string &) = 0;
29
30         /// send a status message to all players
31         /// use this to announce stuff which may be interesting to anyone
32         virtual void Broadcast(const std::string &) = 0;
33
34 private:
35         Player *player;
36
37 };
38
39 }
40
41 #endif