CommandManager.h 492 B

12345678910111213141516171819202122232425
  1. #ifndef COMMANDMANAGER_H
  2. #define COMMANDMANAGER_H
  3. #include <unordered_map>
  4. #include <vector>
  5. #include "ServerCommands.h"
  6. class CommandManager
  7. {
  8. public:
  9. typedef void (*Command) (ServerCommands&, const std::vector<std::string>&);
  10. CommandManager();
  11. void execute(ServerCommands& sc, const std::string& rawCommand) const;
  12. private:
  13. std::unordered_map<std::string, Command> commands;
  14. void registerCommand(const std::string& name, Command command);
  15. };
  16. #endif