- Timestamp:
- Aug 25, 2010, 7:07:08 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/consolecommands3/src/libraries/core/command/CommandExecutor.cc
r7203 r7216 54 54 } 55 55 56 ConsoleCommand& CommandExecutor::addConsoleCommandShortcut(ConsoleCommand* command, bool bDeleteAtExit)57 {58 std::map<std::string, ConsoleCommand*>::const_iterator it = CommandExecutor::getInstance().consoleCommandShortcuts_.find(command->getName());59 if (it != CommandExecutor::getInstance().consoleCommandShortcuts_.end())60 {61 COUT(2) << "Warning: Overwriting console-command shortcut with name " << command->getName() << '.' << std::endl;62 }63 64 // Make sure we can also delete the external ConsoleCommands that don't belong to an Identifier65 if (command && bDeleteAtExit)66 {67 CommandExecutor::getInstance().consoleCommandExternals_.insert(command);68 }69 70 CommandExecutor::getInstance().consoleCommandShortcuts_[command->getName()] = command;71 CommandExecutor::getInstance().consoleCommandShortcuts_LC_[getLowercase(command->getName())] = command;72 return (*command);73 }74 75 /**76 @brief Returns the executor of a console command shortcut with given name.77 @brief name The name of the requested console command shortcut78 @return The executor of the requested console command shortcut79 */80 ConsoleCommand* CommandExecutor::getConsoleCommandShortcut(const std::string& name)81 {82 std::map<std::string, ConsoleCommand*>::const_iterator it = CommandExecutor::getInstance().consoleCommandShortcuts_.find(name);83 if (it != CommandExecutor::getInstance().consoleCommandShortcuts_.end())84 return it->second;85 else86 return 0;87 }88 89 /**90 @brief Returns the executor of a console command shortcut with given name in lowercase.91 @brief name The name of the requested console command shortcut in lowercase92 @return The executor of the requested console command shortcut93 */94 ConsoleCommand* CommandExecutor::getLowercaseConsoleCommandShortcut(const std::string& name)95 {96 std::map<std::string, ConsoleCommand*>::const_iterator it = CommandExecutor::getInstance().consoleCommandShortcuts_LC_.find(name);97 if (it != CommandExecutor::getInstance().consoleCommandShortcuts_LC_.end())98 return it->second;99 else100 return 0;101 }102 103 56 bool CommandExecutor::execute(const std::string& command, bool useTcl) 104 57 {
Note: See TracChangeset
for help on using the changeset viewer.