- Timestamp:
- May 25, 2015, 10:56:26 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/libraries/core/command/ConsoleCommandManager.h
r10354 r10484 40 40 { 41 41 /** 42 * A s tatic classthat stores all existing ConsoleCommands.42 * A singleton that stores all existing ConsoleCommands. 43 43 */ 44 44 class _CoreExport ConsoleCommandManager 45 45 { 46 46 public: 47 static void registerCommand(ConsoleCommand* command); 48 static void registerCommand(const std::string& group, const std::string& name, ConsoleCommand* command); 49 static void unregisterCommand(ConsoleCommand* command); 47 static ConsoleCommandManager& getInstance(); 48 49 void registerCommand(ConsoleCommand* command); 50 void registerCommand(const std::string& group, const std::string& name, ConsoleCommand* command); 51 void unregisterCommand(ConsoleCommand* command); 50 52 51 53 /// Returns the map with all groups and commands. 52 staticinline const std::map<std::string, std::map<std::string, ConsoleCommand*> >& getCommands()53 { return ConsoleCommandManager::getCommandMap(); }54 inline const std::map<std::string, std::map<std::string, ConsoleCommand*> >& getCommands() 55 { return this->commandMap_; } 54 56 /// Returns the map with all groups and commands in lowercase. 55 staticinline const std::map<std::string, std::map<std::string, ConsoleCommand*> >& getCommandsLC()56 { return ConsoleCommandManager::getCommandMapLC(); }57 inline const std::map<std::string, std::map<std::string, ConsoleCommand*> >& getCommandsLC() 58 { return this->commandMapLC_; } 57 59 58 60 /// Returns a command (shortcut) with given name. @param name The name of the command shortcut @param bPrintError If true, an error is printed if the command doesn't exist 59 staticinline ConsoleCommand* getCommand(const std::string& name, bool bPrintError = false)60 { return ConsoleCommandManager::getCommand("", name, bPrintError); }61 inline ConsoleCommand* getCommand(const std::string& name, bool bPrintError = false) 62 { return this->getCommand("", name, bPrintError); } 61 63 /// Returns a command (shortcut) with given name in lowercase. @param name The lowercase name of the command shortcut @param bPrintError If true, an error is printed if the command doesn't exist 62 staticinline ConsoleCommand* getCommandLC(const std::string& name, bool bPrintError = false)63 { return ConsoleCommandManager::getCommandLC("", name, bPrintError); }64 inline ConsoleCommand* getCommandLC(const std::string& name, bool bPrintError = false) 65 { return this->getCommandLC("", name, bPrintError); } 64 66 65 staticConsoleCommand* getCommand(const std::string& group, const std::string& name, bool bPrintError = false);66 staticConsoleCommand* getCommandLC(const std::string& group, const std::string& name, bool bPrintError = false);67 ConsoleCommand* getCommand(const std::string& group, const std::string& name, bool bPrintError = false); 68 ConsoleCommand* getCommandLC(const std::string& group, const std::string& name, bool bPrintError = false); 67 69 68 staticvoid destroyAll();70 void destroyAll(); 69 71 70 72 private: 71 st atic std::map<std::string, std::map<std::string, ConsoleCommand*> >& getCommandMap();72 st atic std::map<std::string, std::map<std::string, ConsoleCommand*> >& getCommandMapLC();73 std::map<std::string, std::map<std::string, ConsoleCommand*> > commandMap_; 74 std::map<std::string, std::map<std::string, ConsoleCommand*> > commandMapLC_; 73 75 }; 74 76 }
Note: See TracChangeset
for help on using the changeset viewer.