Changeset 7234 for code/branches/consolecommands3/src
- Timestamp:
- Aug 28, 2010, 12:37:38 AM (14 years ago)
- Location:
- code/branches/consolecommands3/src/libraries/core/command
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/consolecommands3/src/libraries/core/command/ArgumentCompletionFunctions.cc
r7233 r7234 123 123 } 124 124 125 ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(hiddengroupsandcommands)()126 {127 return detail::_groupsandcommands(true);128 }129 130 ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(hiddensubcommands)(const std::string& fragment, const std::string& group)131 {132 return detail::_subcommands(fragment, group, true);133 }134 135 125 ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION_MULTI(command)(const std::string& fragment) 136 126 { … … 148 138 return list; 149 139 } 140 } 141 142 ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION_MULTI(hiddencommand)(const std::string& fragment) 143 { 144 SubString tokens(fragment, " ", SubString::WhiteSpaces, false, '\\', true, '"', true, '(', ')', true, '\0'); 145 146 if (tokens.size() == 0) 147 return detail::_groupsandcommands(true); 148 149 if (_ConsoleCommand::getCommandLC(getLowercase(tokens[0]))) 150 return ARGUMENT_COMPLETION_FUNCTION_CALL(command)(fragment); 151 152 if (tokens.size() == 1) 153 { 154 std::map<std::string, std::map<std::string, _ConsoleCommand*> >::const_iterator it_group = _ConsoleCommand::getCommands().find(tokens[0]); 155 if (it_group != _ConsoleCommand::getCommands().end()) 156 return detail::_subcommands(fragment, tokens[0], true); 157 else 158 return detail::_groupsandcommands(true); 159 } 160 161 if (_ConsoleCommand::getCommandLC(getLowercase(tokens[0]), getLowercase(tokens[1]))) 162 return ARGUMENT_COMPLETION_FUNCTION_CALL(command)(fragment); 163 164 return ArgumentCompletionList(); 150 165 } 151 166 -
code/branches/consolecommands3/src/libraries/core/command/ArgumentCompletionFunctions.h
r7233 r7234 52 52 ArgumentCompletionList acf_##functionname 53 53 54 #define ARGUMENT_COMPLETION_FUNCTION_CALL(functionname) acf_##functionname 55 54 56 55 57 namespace orxonox … … 60 62 ARGUMENT_COMPLETION_FUNCTION_DECLARATION(groupsandcommands)(); 61 63 ARGUMENT_COMPLETION_FUNCTION_DECLARATION(subcommands)(const std::string& fragment, const std::string& group); 62 ARGUMENT_COMPLETION_FUNCTION_DECLARATION(hiddengroupsandcommands)();63 ARGUMENT_COMPLETION_FUNCTION_DECLARATION(hiddensubcommands)(const std::string& fragment, const std::string& group);64 64 ARGUMENT_COMPLETION_FUNCTION_DECLARATION(command)(const std::string& fragment); 65 ARGUMENT_COMPLETION_FUNCTION_DECLARATION(hiddencommand)(const std::string& fragment); 65 66 ARGUMENT_COMPLETION_FUNCTION_DECLARATION(files)(const std::string& fragment); 66 67 ARGUMENT_COMPLETION_FUNCTION_DECLARATION(settingssections)(); -
code/branches/consolecommands3/src/libraries/core/command/CommandExecutor.cc
r7233 r7234 44 44 45 45 _SetConsoleCommand("unhide", &CommandExecutor::unhide) 46 .argumentCompleter(0, autocompletion::hiddengroupsandcommands()) 47 .argumentCompleter(1, autocompletion::hiddensubcommands()) 48 .defaultValue(1, "") 49 .defaultValue(2, ""); 46 .argumentCompleter(0, autocompletion::hiddencommand()); 50 47 51 48 /* static */ CommandExecutor& CommandExecutor::getInstance() … … 156 153 } 157 154 158 /* static */ MultiType CommandExecutor::unhide(const std::string& group, const std::string& name, const std::string& arguments)155 /* static */ MultiType CommandExecutor::unhide(const std::string& command) 159 156 { 160 return CommandExecutor::queryMT( group + " " + name + " " + arguments);157 return CommandExecutor::queryMT(command); 161 158 } 162 159 } -
code/branches/consolecommands3/src/libraries/core/command/CommandExecutor.h
r7233 r7234 59 59 static const int Denied = 4; 60 60 61 static MultiType unhide(const std::string& group, const std::string& name, const std::string& arguments);61 static MultiType unhide(const std::string& command); 62 62 static void _autocomplete(const std::string& group, const std::string& name) {} 63 63
Note: See TracChangeset
for help on using the changeset viewer.