- Timestamp:
- Aug 28, 2010, 1:51:04 AM (14 years ago)
- Location:
- code/branches/consolecommands3/src/libraries/core/command
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/consolecommands3/src/libraries/core/command/ArgumentCompletionFunctions.cc
r7235 r7236 60 60 namespace detail 61 61 { 62 bool groupIsVisible(const std::map<std::string, _ConsoleCommand*>& group, bool bOnlyShowHidden)63 { 64 for (std::map<std::string, _ConsoleCommand*>::const_iterator it_command = group.begin(); it_command != group.end(); ++it_command)62 bool groupIsVisible(const std::map<std::string, ConsoleCommand*>& group, bool bOnlyShowHidden) 63 { 64 for (std::map<std::string, ConsoleCommand*>::const_iterator it_command = group.begin(); it_command != group.end(); ++it_command) 65 65 if (it_command->second->isActive() && it_command->second->hasAccess() && (!it_command->second->isHidden())^bOnlyShowHidden) 66 66 return true; … … 74 74 std::string fragmentLC = getLowercase(fragment); 75 75 76 const std::map<std::string, std::map<std::string, _ConsoleCommand*> >& commands = _ConsoleCommand::getCommands();77 for (std::map<std::string, std::map<std::string, _ConsoleCommand*> >::const_iterator it_group = commands.begin(); it_group != commands.end(); ++it_group)76 const std::map<std::string, std::map<std::string, ConsoleCommand*> >& commands = ConsoleCommand::getCommands(); 77 for (std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = commands.begin(); it_group != commands.end(); ++it_group) 78 78 if (groupIsVisible(it_group->second, bOnlyShowHidden) && it_group->first != "" && (fragmentLC == "" || getLowercase(it_group->first).find_first_of(fragmentLC) == 0)) 79 79 groupList.push_back(ArgumentCompletionListElement(it_group->first, getLowercase(it_group->first))); 80 80 81 std::map<std::string, std::map<std::string, _ConsoleCommand*> >::const_iterator it_group = commands.find("");81 std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = commands.find(""); 82 82 if (it_group != commands.end()) 83 83 { … … 85 85 groupList.push_back(ArgumentCompletionListElement("", "", "\n")); 86 86 87 for (std::map<std::string, _ConsoleCommand*>::const_iterator it_command = it_group->second.begin(); it_command != it_group->second.end(); ++it_command)87 for (std::map<std::string, ConsoleCommand*>::const_iterator it_command = it_group->second.begin(); it_command != it_group->second.end(); ++it_command) 88 88 if (it_command->second->isActive() && it_command->second->hasAccess() && (!it_command->second->isHidden())^bOnlyShowHidden && (fragmentLC == "" || getLowercase(it_command->first).find_first_of(fragmentLC) == 0)) 89 89 groupList.push_back(ArgumentCompletionListElement(it_command->first, getLowercase(it_command->first))); … … 102 102 std::string groupLC = getLowercase(group); 103 103 104 std::map<std::string, std::map<std::string, _ConsoleCommand*> >::const_iterator it_group = _ConsoleCommand::getCommands().begin();105 for ( ; it_group != _ConsoleCommand::getCommands().end(); ++it_group)104 std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommand::getCommands().begin(); 105 for ( ; it_group != ConsoleCommand::getCommands().end(); ++it_group) 106 106 if (getLowercase(it_group->first) == groupLC) 107 107 break; 108 108 109 if (it_group != _ConsoleCommand::getCommands().end())110 { 111 for (std::map<std::string, _ConsoleCommand*>::const_iterator it_command = it_group->second.begin(); it_command != it_group->second.end(); ++it_command)109 if (it_group != ConsoleCommand::getCommands().end()) 110 { 111 for (std::map<std::string, ConsoleCommand*>::const_iterator it_command = it_group->second.begin(); it_command != it_group->second.end(); ++it_command) 112 112 if (it_command->second->isActive() && it_command->second->hasAccess() && (!it_command->second->isHidden())^bOnlyShowHidden) 113 113 commandList.push_back(ArgumentCompletionListElement(it_command->first, getLowercase(it_command->first))); … … 152 152 return detail::_groupsandcommands(fragment, true); 153 153 154 if ( _ConsoleCommand::getCommandLC(getLowercase(tokens[0])))154 if (ConsoleCommand::getCommandLC(getLowercase(tokens[0]))) 155 155 return ARGUMENT_COMPLETION_FUNCTION_CALL(command)(fragment); 156 156 157 157 if (tokens.size() == 1) 158 158 { 159 std::map<std::string, std::map<std::string, _ConsoleCommand*> >::const_iterator it_group = _ConsoleCommand::getCommands().find(tokens[0]);160 if (it_group != _ConsoleCommand::getCommands().end())159 std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommand::getCommands().find(tokens[0]); 160 if (it_group != ConsoleCommand::getCommands().end()) 161 161 return detail::_subcommands(fragment, tokens[0], true); 162 162 else … … 164 164 } 165 165 166 if ( _ConsoleCommand::getCommandLC(getLowercase(tokens[0]), getLowercase(tokens[1])))166 if (ConsoleCommand::getCommandLC(getLowercase(tokens[0]), getLowercase(tokens[1]))) 167 167 return ARGUMENT_COMPLETION_FUNCTION_CALL(command)(fragment); 168 168 -
code/branches/consolecommands3/src/libraries/core/command/CommandEvaluation.cc
r7235 r7236 213 213 { 214 214 std::string groupLC = getLowercase(this->getToken(0)); 215 std::map<std::string, std::map<std::string, _ConsoleCommand*> >::const_iterator it_group = _ConsoleCommand::getCommands().begin();216 for ( ; it_group != _ConsoleCommand::getCommands().end(); ++it_group)215 std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommand::getCommands().begin(); 216 for ( ; it_group != ConsoleCommand::getCommands().end(); ++it_group) 217 217 if (getLowercase(it_group->first) == groupLC) 218 218 return std::string("Error: There is no command in group \"") + this->getToken(0) + "\" starting with \"" + this->getToken(1) + "\"."; … … 380 380 } 381 381 382 /* static */ std::string CommandEvaluation::dump(const _ConsoleCommand* command)382 /* static */ std::string CommandEvaluation::dump(const ConsoleCommand* command) 383 383 { 384 384 std::string output = command->getName(); -
code/branches/consolecommands3/src/libraries/core/command/CommandEvaluation.h
r7235 r7236 59 59 { return (this->execCommand_ != 0); } 60 60 61 inline _ConsoleCommand* getConsoleCommand() const61 inline ConsoleCommand* getConsoleCommand() const 62 62 { return this->execCommand_; } 63 63 … … 84 84 85 85 static std::string dump(const ArgumentCompletionList& list); 86 static std::string dump(const _ConsoleCommand* command);86 static std::string dump(const ConsoleCommand* command); 87 87 88 88 static std::string getCommonBegin(const ArgumentCompletionList& list); 89 89 90 _ConsoleCommand* execCommand_;91 _ConsoleCommand* hintCommand_;90 ConsoleCommand* execCommand_; 91 ConsoleCommand* hintCommand_; 92 92 SubString tokens_; 93 93 std::string string_; -
code/branches/consolecommands3/src/libraries/core/command/CommandExecutor.cc
r7234 r7236 38 38 static const std::string __CC_autocomplete_name = "autocomplete"; 39 39 40 _SetConsoleCommand(__CC_CommandExecutor_name, __CC_autocomplete_name, &CommandExecutor::_autocomplete)40 SetConsoleCommand(__CC_CommandExecutor_name, __CC_autocomplete_name, &CommandExecutor::_autocomplete) 41 41 .hide() 42 42 .argumentCompleter(0, autocompletion::groupsandcommands()) 43 43 .argumentCompleter(1, autocompletion::subcommands()); 44 44 45 _SetConsoleCommand("unhide", &CommandExecutor::unhide)45 SetConsoleCommand("unhide", &CommandExecutor::unhide) 46 46 .argumentCompleter(0, autocompletion::hiddencommand()); 47 47 … … 87 87 evaluation.initialize(command); 88 88 89 evaluation.hintCommand_ = _ConsoleCommand::getCommand(__CC_CommandExecutor_name, __CC_autocomplete_name);89 evaluation.hintCommand_ = ConsoleCommand::getCommand(__CC_CommandExecutor_name, __CC_autocomplete_name); 90 90 91 91 if (evaluation.getNumberOfArguments() >= 1) 92 92 { 93 evaluation.execCommand_ = _ConsoleCommand::getCommandLC(evaluation.getToken(0));93 evaluation.execCommand_ = ConsoleCommand::getCommandLC(evaluation.getToken(0)); 94 94 if (evaluation.execCommand_) 95 95 evaluation.execArgumentsOffset_ = 1; 96 96 else if (evaluation.getNumberOfArguments() >= 2) 97 97 { 98 evaluation.execCommand_ = _ConsoleCommand::getCommandLC(evaluation.getToken(0), evaluation.getToken(1));98 evaluation.execCommand_ = ConsoleCommand::getCommandLC(evaluation.getToken(0), evaluation.getToken(1)); 99 99 if (evaluation.execCommand_) 100 100 evaluation.execArgumentsOffset_ = 2; -
code/branches/consolecommands3/src/libraries/core/command/ConsoleCommand.cc
r7228 r7236 36 36 namespace orxonox 37 37 { 38 _ConsoleCommand::_ConsoleCommand(const std::string& group, const std::string& name, const ExecutorPtr& executor, bool bInitialized)38 ConsoleCommand::ConsoleCommand(const std::string& group, const std::string& name, const ExecutorPtr& executor, bool bInitialized) 39 39 { 40 40 this->bActive_ = true; … … 57 57 this->executor_ = executor; 58 58 59 _ConsoleCommand::registerCommand(group, name, this);60 } 61 62 _ConsoleCommand::~_ConsoleCommand()63 { 64 _ConsoleCommand::unregisterCommand(this);65 } 66 67 _ConsoleCommand& _ConsoleCommand::addShortcut()68 { 69 _ConsoleCommand::registerCommand("", this->baseName_, this);70 return *this; 71 } 72 73 _ConsoleCommand& _ConsoleCommand::addShortcut(const std::string& name)74 { 75 _ConsoleCommand::registerCommand("", name, this);76 return *this; 77 } 78 79 _ConsoleCommand& _ConsoleCommand::addGroup(const std::string& group)80 { 81 _ConsoleCommand::registerCommand(group, this->baseName_, this);82 return *this; 83 } 84 85 _ConsoleCommand& _ConsoleCommand::addGroup(const std::string& group, const std::string& name)86 { 87 _ConsoleCommand::registerCommand(group, name, this);88 return *this; 89 } 90 91 bool _ConsoleCommand::isActive() const59 ConsoleCommand::registerCommand(group, name, this); 60 } 61 62 ConsoleCommand::~ConsoleCommand() 63 { 64 ConsoleCommand::unregisterCommand(this); 65 } 66 67 ConsoleCommand& ConsoleCommand::addShortcut() 68 { 69 ConsoleCommand::registerCommand("", this->baseName_, this); 70 return *this; 71 } 72 73 ConsoleCommand& ConsoleCommand::addShortcut(const std::string& name) 74 { 75 ConsoleCommand::registerCommand("", name, this); 76 return *this; 77 } 78 79 ConsoleCommand& ConsoleCommand::addGroup(const std::string& group) 80 { 81 ConsoleCommand::registerCommand(group, this->baseName_, this); 82 return *this; 83 } 84 85 ConsoleCommand& ConsoleCommand::addGroup(const std::string& group, const std::string& name) 86 { 87 ConsoleCommand::registerCommand(group, name, this); 88 return *this; 89 } 90 91 bool ConsoleCommand::isActive() const 92 92 { 93 93 return (this->bActive_ && this->executor_ && this->executor_->getFunctor() && (this->executor_->getFunctor()->getType() == Functor::Type::Static || this->executor_->getFunctor()->getRawObjectPointer())); 94 94 } 95 95 96 bool _ConsoleCommand::hasAccess() const96 bool ConsoleCommand::hasAccess() const 97 97 { 98 98 switch (this->accessLevel_) … … 110 110 } 111 111 112 bool _ConsoleCommand::headersMatch(const FunctorPtr& functor)112 bool ConsoleCommand::headersMatch(const FunctorPtr& functor) 113 113 { 114 114 unsigned int minparams = std::min(this->baseExecutor_->getParamCount(), functor->getParamCount()); … … 130 130 } 131 131 132 bool _ConsoleCommand::headersMatch(const ExecutorPtr& executor)132 bool ConsoleCommand::headersMatch(const ExecutorPtr& executor) 133 133 { 134 134 unsigned int minparams = std::min(this->baseExecutor_->getParamCount(), executor->getParamCount()); … … 148 148 } 149 149 150 bool _ConsoleCommand::setFunction(const ExecutorPtr& executor, bool bForce)150 bool ConsoleCommand::setFunction(const ExecutorPtr& executor, bool bForce) 151 151 { 152 152 if (!executor || !executor->getFunctor() || bForce || this->headersMatch(executor)) … … 162 162 } 163 163 164 bool _ConsoleCommand::setFunction(const FunctorPtr& functor, bool bForce)164 bool ConsoleCommand::setFunction(const FunctorPtr& functor, bool bForce) 165 165 { 166 166 if (!functor || bForce || this->headersMatch(functor)) … … 180 180 } 181 181 182 void _ConsoleCommand::pushFunction(const ExecutorPtr& executor, bool bForce)182 void ConsoleCommand::pushFunction(const ExecutorPtr& executor, bool bForce) 183 183 { 184 184 Command command; … … 191 191 } 192 192 193 void _ConsoleCommand::pushFunction(const FunctorPtr& functor, bool bForce)193 void ConsoleCommand::pushFunction(const FunctorPtr& functor, bool bForce) 194 194 { 195 195 Command command; … … 202 202 } 203 203 204 void _ConsoleCommand::pushFunction()204 void ConsoleCommand::pushFunction() 205 205 { 206 206 if (this->executor_) … … 210 210 } 211 211 212 void _ConsoleCommand::popFunction()212 void ConsoleCommand::popFunction() 213 213 { 214 214 Command command; … … 224 224 } 225 225 226 void _ConsoleCommand::resetFunction()226 void ConsoleCommand::resetFunction() 227 227 { 228 228 if (this->executor_) … … 230 230 } 231 231 232 const ExecutorPtr& _ConsoleCommand::getExecutor() const232 const ExecutorPtr& ConsoleCommand::getExecutor() const 233 233 { 234 234 return this->executor_; 235 235 } 236 236 237 bool _ConsoleCommand::setObject(void* object)237 bool ConsoleCommand::setObject(void* object) 238 238 { 239 239 if (this->executor_) … … 253 253 } 254 254 255 void _ConsoleCommand::pushObject(void* object)255 void ConsoleCommand::pushObject(void* object) 256 256 { 257 257 void* oldobject = this->getObject(); … … 260 260 } 261 261 262 void _ConsoleCommand::popObject()262 void ConsoleCommand::popObject() 263 263 { 264 264 void* newobject = 0; … … 271 271 } 272 272 273 void* _ConsoleCommand::getObject() const273 void* ConsoleCommand::getObject() const 274 274 { 275 275 if (this->executor_ && this->executor_->getFunctor()) … … 279 279 } 280 280 281 _ConsoleCommand& _ConsoleCommand::defaultValues(const MultiType& param1)281 ConsoleCommand& ConsoleCommand::defaultValues(const MultiType& param1) 282 282 { 283 283 if (this->executor_) … … 289 289 } 290 290 291 _ConsoleCommand& _ConsoleCommand::defaultValues(const MultiType& param1, const MultiType& param2)291 ConsoleCommand& ConsoleCommand::defaultValues(const MultiType& param1, const MultiType& param2) 292 292 { 293 293 if (this->executor_) … … 299 299 } 300 300 301 _ConsoleCommand& _ConsoleCommand::defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3)301 ConsoleCommand& ConsoleCommand::defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3) 302 302 { 303 303 if (this->executor_) … … 309 309 } 310 310 311 _ConsoleCommand& _ConsoleCommand::defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4)311 ConsoleCommand& ConsoleCommand::defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4) 312 312 { 313 313 if (this->executor_) … … 319 319 } 320 320 321 _ConsoleCommand& _ConsoleCommand::defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5)321 ConsoleCommand& ConsoleCommand::defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) 322 322 { 323 323 if (this->executor_) … … 329 329 } 330 330 331 _ConsoleCommand& _ConsoleCommand::defaultValue(unsigned int index, const MultiType& param)331 ConsoleCommand& ConsoleCommand::defaultValue(unsigned int index, const MultiType& param) 332 332 { 333 333 if (this->executor_) … … 339 339 } 340 340 341 _ConsoleCommand& _ConsoleCommand::argumentCompleter(unsigned int param, ArgumentCompleter* completer)341 ConsoleCommand& ConsoleCommand::argumentCompleter(unsigned int param, ArgumentCompleter* completer) 342 342 { 343 343 if (param < 5) … … 349 349 } 350 350 351 ArgumentCompleter* _ConsoleCommand::getArgumentCompleter(unsigned int param) const351 ArgumentCompleter* ConsoleCommand::getArgumentCompleter(unsigned int param) const 352 352 { 353 353 if (param < 5) … … 357 357 } 358 358 359 _ConsoleCommand& _ConsoleCommand::description(const std::string& description)359 ConsoleCommand& ConsoleCommand::description(const std::string& description) 360 360 { 361 361 this->description_ = std::string("ConsoleCommandDescription::" + this->baseName_ + "::function"); … … 364 364 } 365 365 366 const std::string& _ConsoleCommand::getDescription() const366 const std::string& ConsoleCommand::getDescription() const 367 367 { 368 368 return GetLocalisation_noerror(this->description_); 369 369 } 370 370 371 _ConsoleCommand& _ConsoleCommand::descriptionParam(unsigned int param, const std::string& description)371 ConsoleCommand& ConsoleCommand::descriptionParam(unsigned int param, const std::string& description) 372 372 { 373 373 if (param < MAX_FUNCTOR_ARGUMENTS) … … 379 379 } 380 380 381 const std::string& _ConsoleCommand::getDescriptionParam(unsigned int param) const381 const std::string& ConsoleCommand::getDescriptionParam(unsigned int param) const 382 382 { 383 383 if (param < MAX_FUNCTOR_ARGUMENTS) … … 387 387 } 388 388 389 _ConsoleCommand& _ConsoleCommand::descriptionReturnvalue(const std::string& description)389 ConsoleCommand& ConsoleCommand::descriptionReturnvalue(const std::string& description) 390 390 { 391 391 this->descriptionReturnvalue_ = std::string("ConsoleCommandDescription::" + this->baseName_ + "::returnvalue"); … … 394 394 } 395 395 396 const std::string& _ConsoleCommand::getDescriptionReturnvalue(int param) const396 const std::string& ConsoleCommand::getDescriptionReturnvalue(int param) const 397 397 { 398 398 return GetLocalisation_noerror(this->descriptionReturnvalue_); 399 399 } 400 400 401 /* static */ _ConsoleCommand* _ConsoleCommand::getCommand(const std::string& group, const std::string& name, bool bPrintError)402 { 403 std::map<std::string, std::map<std::string, _ConsoleCommand*> >::const_iterator it_group = _ConsoleCommand::getCommandMap().find(group);404 if (it_group != _ConsoleCommand::getCommandMap().end())405 { 406 std::map<std::string, _ConsoleCommand*>::const_iterator it_name = it_group->second.find(name);401 /* static */ ConsoleCommand* ConsoleCommand::getCommand(const std::string& group, const std::string& name, bool bPrintError) 402 { 403 std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommand::getCommandMap().find(group); 404 if (it_group != ConsoleCommand::getCommandMap().end()) 405 { 406 std::map<std::string, ConsoleCommand*>::const_iterator it_name = it_group->second.find(name); 407 407 if (it_name != it_group->second.end()) 408 408 { … … 420 420 } 421 421 422 /* static */ _ConsoleCommand* _ConsoleCommand::getCommandLC(const std::string& group, const std::string& name, bool bPrintError)422 /* static */ ConsoleCommand* ConsoleCommand::getCommandLC(const std::string& group, const std::string& name, bool bPrintError) 423 423 { 424 424 std::string groupLC = getLowercase(group); 425 425 std::string nameLC = getLowercase(name); 426 426 427 std::map<std::string, std::map<std::string, _ConsoleCommand*> >::const_iterator it_group = _ConsoleCommand::getCommandMapLC().find(groupLC);428 if (it_group != _ConsoleCommand::getCommandMapLC().end())429 { 430 std::map<std::string, _ConsoleCommand*>::const_iterator it_name = it_group->second.find(nameLC);427 std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommand::getCommandMapLC().find(groupLC); 428 if (it_group != ConsoleCommand::getCommandMapLC().end()) 429 { 430 std::map<std::string, ConsoleCommand*>::const_iterator it_name = it_group->second.find(nameLC); 431 431 if (it_name != it_group->second.end()) 432 432 { … … 444 444 } 445 445 446 /* static */ std::map<std::string, std::map<std::string, _ConsoleCommand*> >& _ConsoleCommand::getCommandMap()447 { 448 static std::map<std::string, std::map<std::string, _ConsoleCommand*> > commandMap;446 /* static */ std::map<std::string, std::map<std::string, ConsoleCommand*> >& ConsoleCommand::getCommandMap() 447 { 448 static std::map<std::string, std::map<std::string, ConsoleCommand*> > commandMap; 449 449 return commandMap; 450 450 } 451 451 452 /* static */ std::map<std::string, std::map<std::string, _ConsoleCommand*> >& _ConsoleCommand::getCommandMapLC()453 { 454 static std::map<std::string, std::map<std::string, _ConsoleCommand*> > commandMapLC;452 /* static */ std::map<std::string, std::map<std::string, ConsoleCommand*> >& ConsoleCommand::getCommandMapLC() 453 { 454 static std::map<std::string, std::map<std::string, ConsoleCommand*> > commandMapLC; 455 455 return commandMapLC; 456 456 } 457 457 458 /* static */ void _ConsoleCommand::registerCommand(const std::string& group, const std::string& name, _ConsoleCommand* command)458 /* static */ void ConsoleCommand::registerCommand(const std::string& group, const std::string& name, ConsoleCommand* command) 459 459 { 460 460 if (name == "") 461 461 return; 462 462 463 if ( _ConsoleCommand::getCommand(group, name) != 0)463 if (ConsoleCommand::getCommand(group, name) != 0) 464 464 { 465 465 if (group == "") … … 470 470 else 471 471 { 472 _ConsoleCommand::getCommandMap()[group][name] = command;473 _ConsoleCommand::getCommandMapLC()[getLowercase(group)][getLowercase(name)] = command;474 } 475 } 476 477 /* static */ void _ConsoleCommand::unregisterCommand(_ConsoleCommand* command)478 { 479 for (std::map<std::string, std::map<std::string, _ConsoleCommand*> >::iterator it_group = _ConsoleCommand::getCommandMap().begin(); it_group != _ConsoleCommand::getCommandMap().end(); )480 { 481 for (std::map<std::string, _ConsoleCommand*>::iterator it_name = it_group->second.begin(); it_name != it_group->second.end(); )472 ConsoleCommand::getCommandMap()[group][name] = command; 473 ConsoleCommand::getCommandMapLC()[getLowercase(group)][getLowercase(name)] = command; 474 } 475 } 476 477 /* static */ void ConsoleCommand::unregisterCommand(ConsoleCommand* command) 478 { 479 for (std::map<std::string, std::map<std::string, ConsoleCommand*> >::iterator it_group = ConsoleCommand::getCommandMap().begin(); it_group != ConsoleCommand::getCommandMap().end(); ) 480 { 481 for (std::map<std::string, ConsoleCommand*>::iterator it_name = it_group->second.begin(); it_name != it_group->second.end(); ) 482 482 { 483 483 if (it_name->second == command) … … 488 488 489 489 if (it_group->second.empty()) 490 _ConsoleCommand::getCommandMap().erase(it_group++);490 ConsoleCommand::getCommandMap().erase(it_group++); 491 491 else 492 492 ++it_group; 493 493 } 494 494 495 for (std::map<std::string, std::map<std::string, _ConsoleCommand*> >::iterator it_group = _ConsoleCommand::getCommandMapLC().begin(); it_group != _ConsoleCommand::getCommandMapLC().end(); )496 { 497 for (std::map<std::string, _ConsoleCommand*>::iterator it_name = it_group->second.begin(); it_name != it_group->second.end(); )495 for (std::map<std::string, std::map<std::string, ConsoleCommand*> >::iterator it_group = ConsoleCommand::getCommandMapLC().begin(); it_group != ConsoleCommand::getCommandMapLC().end(); ) 496 { 497 for (std::map<std::string, ConsoleCommand*>::iterator it_name = it_group->second.begin(); it_name != it_group->second.end(); ) 498 498 { 499 499 if (it_name->second == command) … … 504 504 505 505 if (it_group->second.empty()) 506 _ConsoleCommand::getCommandMapLC().erase(it_group++);506 ConsoleCommand::getCommandMapLC().erase(it_group++); 507 507 else 508 508 ++it_group; … … 510 510 } 511 511 512 /* static */ void _ConsoleCommand::destroyAll()513 { 514 while (! _ConsoleCommand::getCommandMap().empty() && !_ConsoleCommand::getCommandMap().begin()->second.empty())515 delete _ConsoleCommand::getCommandMap().begin()->second.begin()->second;512 /* static */ void ConsoleCommand::destroyAll() 513 { 514 while (!ConsoleCommand::getCommandMap().empty() && !ConsoleCommand::getCommandMap().begin()->second.empty()) 515 delete ConsoleCommand::getCommandMap().begin()->second.begin()->second; 516 516 } 517 517 } -
code/branches/consolecommands3/src/libraries/core/command/ConsoleCommand.h
r7228 r7236 41 41 42 42 43 #define _SetConsoleCommand(...) \44 BOOST_PP_EXPAND(BOOST_PP_CAT( _SetConsoleCommand, ORXONOX_VA_NARGS(__VA_ARGS__))(__VA_ARGS__))45 #define _SetConsoleCommand2(name, functionpointer) \46 _SetConsoleCommandGeneric("", name, orxonox::createFunctor(functionpointer))47 #define _SetConsoleCommand3(group, name, functionpointer) \48 _SetConsoleCommandGeneric(group, name, orxonox::createFunctor(functionpointer))49 #define _SetConsoleCommand4(group, name, functionpointer, object) \50 _SetConsoleCommandGeneric(group, name, orxonox::createFunctor(functionpointer, object))51 52 #define _SetConsoleCommandGeneric(group, name, functor) \53 static orxonox:: _ConsoleCommand& BOOST_PP_CAT(__consolecommand_, __LINE__) = (*orxonox::_createConsoleCommand(group, name, orxonox::createExecutor(functor)))54 55 56 #define _DeclareConsoleCommand(...) \57 BOOST_PP_CAT( _DeclareConsoleCommand, ORXONOX_VA_NARGS(__VA_ARGS__))(__VA_ARGS__)58 #define _DeclareConsoleCommand2(name, functionpointer) \59 _DeclareConsoleCommandGeneric("", name, orxonox::createFunctor(functionpointer))60 #define _DeclareConsoleCommand3(group, name, functionpointer) \61 _DeclareConsoleCommandGeneric(group, name, orxonox::createFunctor(functionpointer))62 #define _DeclareConsoleCommand4(group, name, functionpointer, object) \63 _DeclareConsoleCommandGeneric(group, name, orxonox::createFunctor(functionpointer, object))64 65 #define _DeclareConsoleCommandGeneric(group, name, functor) \66 static orxonox:: _ConsoleCommand& BOOST_PP_CAT(__consolecommand_, __LINE__) = (*orxonox::_createConsoleCommand(group, name, orxonox::createExecutor(functor), false))43 #define SetConsoleCommand(...) \ 44 BOOST_PP_EXPAND(BOOST_PP_CAT(SetConsoleCommand, ORXONOX_VA_NARGS(__VA_ARGS__))(__VA_ARGS__)) 45 #define SetConsoleCommand2(name, functionpointer) \ 46 SetConsoleCommandGeneric("", name, orxonox::createFunctor(functionpointer)) 47 #define SetConsoleCommand3(group, name, functionpointer) \ 48 SetConsoleCommandGeneric(group, name, orxonox::createFunctor(functionpointer)) 49 #define SetConsoleCommand4(group, name, functionpointer, object) \ 50 SetConsoleCommandGeneric(group, name, orxonox::createFunctor(functionpointer, object)) 51 52 #define SetConsoleCommandGeneric(group, name, functor) \ 53 static orxonox::ConsoleCommand& BOOST_PP_CAT(__consolecommand_, __LINE__) = (*orxonox::createConsoleCommand(group, name, orxonox::createExecutor(functor))) 54 55 56 #define DeclareConsoleCommand(...) \ 57 BOOST_PP_CAT(DeclareConsoleCommand, ORXONOX_VA_NARGS(__VA_ARGS__))(__VA_ARGS__) 58 #define DeclareConsoleCommand2(name, functionpointer) \ 59 DeclareConsoleCommandGeneric("", name, orxonox::createFunctor(functionpointer)) 60 #define DeclareConsoleCommand3(group, name, functionpointer) \ 61 DeclareConsoleCommandGeneric(group, name, orxonox::createFunctor(functionpointer)) 62 #define DeclareConsoleCommand4(group, name, functionpointer, object) \ 63 DeclareConsoleCommandGeneric(group, name, orxonox::createFunctor(functionpointer, object)) 64 65 #define DeclareConsoleCommandGeneric(group, name, functor) \ 66 static orxonox::ConsoleCommand& BOOST_PP_CAT(__consolecommand_, __LINE__) = (*orxonox::createConsoleCommand(group, name, orxonox::createExecutor(functor), false)) 67 67 68 68 … … 90 90 } 91 91 92 class _CoreExport _ConsoleCommand92 class _CoreExport ConsoleCommand 93 93 { 94 friend struct _ConsoleCommandManipulator;94 friend struct ConsoleCommandManipulator; 95 95 96 96 struct Command … … 101 101 102 102 public: 103 struct _ConsoleCommandManipulator103 struct ConsoleCommandManipulator 104 104 { 105 105 public: 106 _ConsoleCommandManipulator(const _ConsoleCommand* command) : command_(const_cast<_ConsoleCommand*>(command)) {}106 ConsoleCommandManipulator(const ConsoleCommand* command) : command_(const_cast<ConsoleCommand*>(command)) {} 107 107 108 108 template <class F> 109 inline _ConsoleCommandManipulator& setFunction(F function, bool bForce = false)109 inline ConsoleCommandManipulator& setFunction(F function, bool bForce = false) 110 110 { 111 111 if (this->command_) … … 122 122 } 123 123 template <class F, class O> 124 inline _ConsoleCommandManipulator& setFunction(F function, O* object, bool bForce = false)124 inline ConsoleCommandManipulator& setFunction(F function, O* object, bool bForce = false) 125 125 { 126 126 if (this->command_) … … 137 137 return *this; 138 138 } 139 inline _ConsoleCommandManipulator& setFunction(const FunctorPtr& functor, bool bForce = false)139 inline ConsoleCommandManipulator& setFunction(const FunctorPtr& functor, bool bForce = false) 140 140 { if (this->command_) { this->command_->setFunction(functor, bForce); } return *this; } 141 inline _ConsoleCommandManipulator& setFunction(const ExecutorPtr& executor, bool bForce = false)141 inline ConsoleCommandManipulator& setFunction(const ExecutorPtr& executor, bool bForce = false) 142 142 { if (this->command_) { this->command_->setFunction(executor, bForce); } return *this; } 143 143 144 144 template <class F> 145 inline _ConsoleCommandManipulator& pushFunction(F function, bool bForce = false)145 inline ConsoleCommandManipulator& pushFunction(F function, bool bForce = false) 146 146 { if (this->command_) { this->command_->pushFunction(createFunctor(function), bForce); } return *this; } 147 147 template <class F, class O> 148 inline _ConsoleCommandManipulator& pushFunction(F function, O* object, bool bForce = false)148 inline ConsoleCommandManipulator& pushFunction(F function, O* object, bool bForce = false) 149 149 { if (this->command_) { this->command_->pushFunction(createFunctor(function, object), bForce); } return *this; } 150 inline _ConsoleCommandManipulator& pushFunction(const FunctorPtr& functor, bool bForce = false)150 inline ConsoleCommandManipulator& pushFunction(const FunctorPtr& functor, bool bForce = false) 151 151 { if (this->command_) { this->command_->pushFunction(functor, bForce); } return *this; } 152 inline _ConsoleCommandManipulator& pushFunction(const ExecutorPtr& executor, bool bForce = false)152 inline ConsoleCommandManipulator& pushFunction(const ExecutorPtr& executor, bool bForce = false) 153 153 { if (this->command_) { this->command_->pushFunction(executor, bForce); } return *this; } 154 154 155 inline _ConsoleCommandManipulator& popFunction()155 inline ConsoleCommandManipulator& popFunction() 156 156 { if (this->command_) { this->command_->popFunction(); } return *this; } 157 157 158 inline _ConsoleCommandManipulator& resetFunction()158 inline ConsoleCommandManipulator& resetFunction() 159 159 { if (this->command_) { this->command_->resetFunction(); } return *this; } 160 160 161 inline _ConsoleCommandManipulator& setObject(void* object)161 inline ConsoleCommandManipulator& setObject(void* object) 162 162 { if (this->command_) { this->command_->setObject(object); } return *this; } 163 inline _ConsoleCommandManipulator& pushObject(void* object)163 inline ConsoleCommandManipulator& pushObject(void* object) 164 164 { if (this->command_) { this->command_->pushObject(object); } return *this; } 165 inline _ConsoleCommandManipulator& popObject()165 inline ConsoleCommandManipulator& popObject() 166 166 { if (this->command_) { this->command_->popObject(); } return *this; } 167 167 168 inline _ConsoleCommandManipulator& setActive(bool bActive)168 inline ConsoleCommandManipulator& setActive(bool bActive) 169 169 { if (this->command_) { this->command_->setActive(bActive); } return *this; } 170 inline _ConsoleCommandManipulator& activate()170 inline ConsoleCommandManipulator& activate() 171 171 { return this->setActive(true); } 172 inline _ConsoleCommandManipulator& deactivate()172 inline ConsoleCommandManipulator& deactivate() 173 173 { return this->setActive(false); } 174 174 175 inline _ConsoleCommandManipulator& setHidden(bool bHidden)175 inline ConsoleCommandManipulator& setHidden(bool bHidden) 176 176 { if (this->command_) { this->command_->setHidden(bHidden); } return *this; } 177 inline _ConsoleCommandManipulator& hide()177 inline ConsoleCommandManipulator& hide() 178 178 { return this->setHidden(true); } 179 inline _ConsoleCommandManipulator& show()179 inline ConsoleCommandManipulator& show() 180 180 { return this->setHidden(false); } 181 181 182 inline _ConsoleCommandManipulator& defaultValues(const MultiType& param1)182 inline ConsoleCommandManipulator& defaultValues(const MultiType& param1) 183 183 { if (this->command_) { this->command_->defaultValues(param1); } return *this; } 184 inline _ConsoleCommandManipulator& defaultValues(const MultiType& param1, const MultiType& param2)184 inline ConsoleCommandManipulator& defaultValues(const MultiType& param1, const MultiType& param2) 185 185 { if (this->command_) { this->command_->defaultValues(param1, param2); } return *this; } 186 inline _ConsoleCommandManipulator& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3)186 inline ConsoleCommandManipulator& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3) 187 187 { if (this->command_) { this->command_->defaultValues(param1, param2, param3); } return *this; } 188 inline _ConsoleCommandManipulator& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4)188 inline ConsoleCommandManipulator& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4) 189 189 { if (this->command_) { this->command_->defaultValues(param1, param2, param3, param4); } return *this; } 190 inline _ConsoleCommandManipulator& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5)190 inline ConsoleCommandManipulator& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) 191 191 { if (this->command_) { this->command_->defaultValues(param1, param2, param3, param4, param5); } return *this; } 192 inline _ConsoleCommandManipulator& defaultValue(unsigned int index, const MultiType& param)192 inline ConsoleCommandManipulator& defaultValue(unsigned int index, const MultiType& param) 193 193 { if (this->command_) { this->command_->defaultValue(index, param); } return *this; } 194 194 195 inline _ConsoleCommandManipulator& accessLevel(AccessLevel::Enum level)195 inline ConsoleCommandManipulator& accessLevel(AccessLevel::Enum level) 196 196 { if (this->command_) { this->command_->accessLevel(level); } return *this; } 197 197 198 inline _ConsoleCommandManipulator& argumentCompleter(unsigned int param, ArgumentCompleter* completer)198 inline ConsoleCommandManipulator& argumentCompleter(unsigned int param, ArgumentCompleter* completer) 199 199 { if (this->command_) { this->command_->argumentCompleter(param, completer); } return *this; } 200 200 201 inline _ConsoleCommandManipulator& setAsInputCommand()201 inline ConsoleCommandManipulator& setAsInputCommand() 202 202 { if (this->command_) { this->command_->setAsInputCommand(); } return *this; } 203 inline _ConsoleCommandManipulator& keybindMode(KeybindMode::Value mode)203 inline ConsoleCommandManipulator& keybindMode(KeybindMode::Value mode) 204 204 { if (this->command_) { this->command_->keybindMode(mode); } return *this; } 205 inline _ConsoleCommandManipulator& inputConfiguredParam(int index)205 inline ConsoleCommandManipulator& inputConfiguredParam(int index) 206 206 { if (this->command_) { this->command_->inputConfiguredParam(index); } return *this; } 207 207 208 208 private: 209 _ConsoleCommand* command_;209 ConsoleCommand* command_; 210 210 }; 211 211 212 212 public: 213 _ConsoleCommand(const std::string& group, const std::string& name, const ExecutorPtr& executor, bool bInitialized = true);214 ~ _ConsoleCommand();215 216 _ConsoleCommand& addShortcut();217 _ConsoleCommand& addShortcut(const std::string& name);218 _ConsoleCommand& addGroup(const std::string& group);219 _ConsoleCommand& addGroup(const std::string& group, const std::string& name);213 ConsoleCommand(const std::string& group, const std::string& name, const ExecutorPtr& executor, bool bInitialized = true); 214 ~ConsoleCommand(); 215 216 ConsoleCommand& addShortcut(); 217 ConsoleCommand& addShortcut(const std::string& name); 218 ConsoleCommand& addGroup(const std::string& group); 219 ConsoleCommand& addGroup(const std::string& group, const std::string& name); 220 220 221 221 inline const std::string& getName() const … … 226 226 { return this->baseExecutor_; } 227 227 228 inline _ConsoleCommand& setActive(bool bActive)228 inline ConsoleCommand& setActive(bool bActive) 229 229 { this->bActive_ = bActive; return *this; } 230 inline _ConsoleCommand& activate()230 inline ConsoleCommand& activate() 231 231 { return this->setActive(true); } 232 inline _ConsoleCommand& deactivate()232 inline ConsoleCommand& deactivate() 233 233 { return this->setActive(false); } 234 234 235 inline _ConsoleCommand& setHidden(bool bHidden)235 inline ConsoleCommand& setHidden(bool bHidden) 236 236 { this->bHidden_ = bHidden; return *this; } 237 inline _ConsoleCommand& hide()237 inline ConsoleCommand& hide() 238 238 { return this->setHidden(true); } 239 inline _ConsoleCommand& show()239 inline ConsoleCommand& show() 240 240 { return this->setHidden(false); } 241 241 … … 245 245 { return this->bHidden_; } 246 246 247 _ConsoleCommand& description(const std::string& description);247 ConsoleCommand& description(const std::string& description); 248 248 const std::string& getDescription() const; 249 249 250 _ConsoleCommand& descriptionParam(unsigned int param, const std::string& description);250 ConsoleCommand& descriptionParam(unsigned int param, const std::string& description); 251 251 const std::string& getDescriptionParam(unsigned int param) const; 252 252 253 _ConsoleCommand& descriptionReturnvalue(const std::string& description);253 ConsoleCommand& descriptionReturnvalue(const std::string& description); 254 254 const std::string& getDescriptionReturnvalue(int param) const; 255 255 256 _ConsoleCommand& defaultValues(const MultiType& param1);257 _ConsoleCommand& defaultValues(const MultiType& param1, const MultiType& param2);258 _ConsoleCommand& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3);259 _ConsoleCommand& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4);260 _ConsoleCommand& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5);261 _ConsoleCommand& defaultValue(unsigned int index, const MultiType& param);262 263 inline _ConsoleCommand& accessLevel(AccessLevel::Enum level)256 ConsoleCommand& defaultValues(const MultiType& param1); 257 ConsoleCommand& defaultValues(const MultiType& param1, const MultiType& param2); 258 ConsoleCommand& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3); 259 ConsoleCommand& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4); 260 ConsoleCommand& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5); 261 ConsoleCommand& defaultValue(unsigned int index, const MultiType& param); 262 263 inline ConsoleCommand& accessLevel(AccessLevel::Enum level) 264 264 { this->accessLevel_ = level; return *this; } 265 265 inline AccessLevel::Enum getAccessLevel() const 266 266 { return this->accessLevel_; } 267 267 268 _ConsoleCommand& argumentCompleter(unsigned int param, ArgumentCompleter* completer);268 ConsoleCommand& argumentCompleter(unsigned int param, ArgumentCompleter* completer); 269 269 ArgumentCompleter* getArgumentCompleter(unsigned int param) const; 270 270 271 inline _ConsoleCommand& setAsInputCommand()271 inline ConsoleCommand& setAsInputCommand() 272 272 { 273 273 this->keybindMode(KeybindMode::OnHold); … … 277 277 } 278 278 279 inline _ConsoleCommand& keybindMode(KeybindMode::Value mode)279 inline ConsoleCommand& keybindMode(KeybindMode::Value mode) 280 280 { this->keybindMode_ = mode; return *this; } 281 281 inline KeybindMode::Value getKeybindMode() const 282 282 { return this->keybindMode_; } 283 283 284 inline _ConsoleCommand& inputConfiguredParam(int index)284 inline ConsoleCommand& inputConfiguredParam(int index) 285 285 { this->inputConfiguredParam_ = index; return *this; } 286 286 inline int getInputConfiguredParam_() const 287 287 { return this->inputConfiguredParam_; } 288 288 289 inline _ConsoleCommandManipulator getManipulator() const289 inline ConsoleCommandManipulator getManipulator() const 290 290 { return this; } 291 291 … … 327 327 328 328 public: 329 static inline const std::map<std::string, std::map<std::string, _ConsoleCommand*> >& getCommands()330 { return _ConsoleCommand::getCommandMap(); }331 static inline const std::map<std::string, std::map<std::string, _ConsoleCommand*> >& getCommandsLC()332 { return _ConsoleCommand::getCommandMapLC(); }333 334 static inline _ConsoleCommand* getCommand(const std::string& name, bool bPrintError = false)335 { return _ConsoleCommand::getCommand("", name, bPrintError); }336 static inline _ConsoleCommand* getCommandLC(const std::string& name, bool bPrintError = false)337 { return _ConsoleCommand::getCommandLC("", name, bPrintError); }338 339 static _ConsoleCommand* getCommand(const std::string& group, const std::string& name, bool bPrintError = false);340 static _ConsoleCommand* getCommandLC(const std::string& group, const std::string& name, bool bPrintError = false);329 static inline const std::map<std::string, std::map<std::string, ConsoleCommand*> >& getCommands() 330 { return ConsoleCommand::getCommandMap(); } 331 static inline const std::map<std::string, std::map<std::string, ConsoleCommand*> >& getCommandsLC() 332 { return ConsoleCommand::getCommandMapLC(); } 333 334 static inline ConsoleCommand* getCommand(const std::string& name, bool bPrintError = false) 335 { return ConsoleCommand::getCommand("", name, bPrintError); } 336 static inline ConsoleCommand* getCommandLC(const std::string& name, bool bPrintError = false) 337 { return ConsoleCommand::getCommandLC("", name, bPrintError); } 338 339 static ConsoleCommand* getCommand(const std::string& group, const std::string& name, bool bPrintError = false); 340 static ConsoleCommand* getCommandLC(const std::string& group, const std::string& name, bool bPrintError = false); 341 341 342 342 static void destroyAll(); 343 343 344 344 private: 345 static std::map<std::string, std::map<std::string, _ConsoleCommand*> >& getCommandMap();346 static std::map<std::string, std::map<std::string, _ConsoleCommand*> >& getCommandMapLC();347 348 static void registerCommand(const std::string& group, const std::string& name, _ConsoleCommand* command);349 static void unregisterCommand( _ConsoleCommand* command);345 static std::map<std::string, std::map<std::string, ConsoleCommand*> >& getCommandMap(); 346 static std::map<std::string, std::map<std::string, ConsoleCommand*> >& getCommandMapLC(); 347 348 static void registerCommand(const std::string& group, const std::string& name, ConsoleCommand* command); 349 static void unregisterCommand(ConsoleCommand* command); 350 350 }; 351 351 352 inline _ConsoleCommand* _createConsoleCommand(const std::string& name, const ExecutorPtr& executor, bool bInitialized = true)353 { return new _ConsoleCommand("", name, executor, bInitialized); }354 inline _ConsoleCommand* _createConsoleCommand(const std::string& group, const std::string& name, const ExecutorPtr& executor, bool bInitialized = true)355 { return new _ConsoleCommand(group, name, executor, bInitialized); }356 357 inline _ConsoleCommand::_ConsoleCommandManipulator _ModifyConsoleCommand(const std::string& name)358 { return _ConsoleCommand::getCommand(name, true); }359 inline _ConsoleCommand::_ConsoleCommandManipulator _ModifyConsoleCommand(const std::string& group, const std::string& name)360 { return _ConsoleCommand::getCommand(group, name, true); }352 inline ConsoleCommand* createConsoleCommand(const std::string& name, const ExecutorPtr& executor, bool bInitialized = true) 353 { return new ConsoleCommand("", name, executor, bInitialized); } 354 inline ConsoleCommand* createConsoleCommand(const std::string& group, const std::string& name, const ExecutorPtr& executor, bool bInitialized = true) 355 { return new ConsoleCommand(group, name, executor, bInitialized); } 356 357 inline ConsoleCommand::ConsoleCommandManipulator ModifyConsoleCommand(const std::string& name) 358 { return ConsoleCommand::getCommand(name, true); } 359 inline ConsoleCommand::ConsoleCommandManipulator ModifyConsoleCommand(const std::string& group, const std::string& name) 360 { return ConsoleCommand::getCommand(group, name, true); } 361 361 } 362 362 -
code/branches/consolecommands3/src/libraries/core/command/ConsoleCommandCompilation.cc
r7219 r7236 41 41 namespace orxonox 42 42 { 43 _SetConsoleCommand("source", source).argumentCompleter(0, autocompletion::files());44 _SetConsoleCommand("echo", echo);45 _SetConsoleCommand("puts", puts);43 SetConsoleCommand("source", source).argumentCompleter(0, autocompletion::files()); 44 SetConsoleCommand("echo", echo); 45 SetConsoleCommand("puts", puts); 46 46 47 _SetConsoleCommand("read", read).argumentCompleter(0, autocompletion::files());48 _SetConsoleCommand("append", append).argumentCompleter(0, autocompletion::files());49 _SetConsoleCommand("write", write).argumentCompleter(0, autocompletion::files());47 SetConsoleCommand("read", read).argumentCompleter(0, autocompletion::files()); 48 SetConsoleCommand("append", append).argumentCompleter(0, autocompletion::files()); 49 SetConsoleCommand("write", write).argumentCompleter(0, autocompletion::files()); 50 50 51 _SetConsoleCommand("calculate", calculate);51 SetConsoleCommand("calculate", calculate); 52 52 53 53 void source(const std::string& filename) -
code/branches/consolecommands3/src/libraries/core/command/IRC.cc
r7219 r7236 42 42 static const unsigned int IRC_TCL_THREADID = 1421421421; 43 43 44 _SetConsoleCommand("IRC", "say", &IRC::say);45 _SetConsoleCommand("IRC", "msg", &IRC::msg);46 _SetConsoleCommand("IRC", "nick", &IRC::nick);44 SetConsoleCommand("IRC", "say", &IRC::say); 45 SetConsoleCommand("IRC", "msg", &IRC::msg); 46 SetConsoleCommand("IRC", "nick", &IRC::nick); 47 47 48 48 IRC::IRC() -
code/branches/consolecommands3/src/libraries/core/command/Shell.cc
r7229 r7236 40 40 namespace orxonox 41 41 { 42 _SetConsoleCommand("log", OutputHandler::log );43 _SetConsoleCommand("error", OutputHandler::error );44 _SetConsoleCommand("warning", OutputHandler::warning);45 _SetConsoleCommand("info", OutputHandler::info );46 _SetConsoleCommand("debug", OutputHandler::debug );42 SetConsoleCommand("log", OutputHandler::log ); 43 SetConsoleCommand("error", OutputHandler::error ); 44 SetConsoleCommand("warning", OutputHandler::warning); 45 SetConsoleCommand("info", OutputHandler::info ); 46 SetConsoleCommand("debug", OutputHandler::debug ); 47 47 48 48 unsigned int Shell::cacheSize_s; -
code/branches/consolecommands3/src/libraries/core/command/TclBind.cc
r7228 r7236 44 44 namespace orxonox 45 45 { 46 _SetConsoleCommand("tcl", &TclBind::tcl);47 _SetConsoleCommand("bgerror", &TclBind::bgerror);46 SetConsoleCommand("tcl", &TclBind::tcl); 47 SetConsoleCommand("bgerror", &TclBind::bgerror); 48 48 49 49 TclBind* TclBind::singletonPtr_s = 0; -
code/branches/consolecommands3/src/libraries/core/command/TclThreadManager.cc
r7228 r7236 50 50 const float TCLTHREADMANAGER_MAX_CPU_USAGE = 0.50f; 51 51 52 _SetConsoleCommand("tclexecute", &TclThreadManager::execute).argumentCompleter(0, autocompletion::tclthreads());53 _SetConsoleCommand("tclquery", &TclThreadManager::query ).argumentCompleter(0, autocompletion::tclthreads());54 _SetConsoleCommand("TclThreadManager", "create", &TclThreadManager::create);55 _SetConsoleCommand("TclThreadManager", "destroy", &TclThreadManager::destroy).argumentCompleter(0, autocompletion::tclthreads());56 _SetConsoleCommand("TclThreadManager", "execute", &TclThreadManager::execute).argumentCompleter(0, autocompletion::tclthreads());57 _SetConsoleCommand("TclThreadManager", "query", &TclThreadManager::query ).argumentCompleter(0, autocompletion::tclthreads());58 _SetConsoleCommand("TclThreadManager", "source", &TclThreadManager::source ).argumentCompleter(0, autocompletion::tclthreads());52 SetConsoleCommand("tclexecute", &TclThreadManager::execute).argumentCompleter(0, autocompletion::tclthreads()); 53 SetConsoleCommand("tclquery", &TclThreadManager::query ).argumentCompleter(0, autocompletion::tclthreads()); 54 SetConsoleCommand("TclThreadManager", "create", &TclThreadManager::create); 55 SetConsoleCommand("TclThreadManager", "destroy", &TclThreadManager::destroy).argumentCompleter(0, autocompletion::tclthreads()); 56 SetConsoleCommand("TclThreadManager", "execute", &TclThreadManager::execute).argumentCompleter(0, autocompletion::tclthreads()); 57 SetConsoleCommand("TclThreadManager", "query", &TclThreadManager::query ).argumentCompleter(0, autocompletion::tclthreads()); 58 SetConsoleCommand("TclThreadManager", "source", &TclThreadManager::source ).argumentCompleter(0, autocompletion::tclthreads()); 59 59 60 60 /**
Note: See TracChangeset
for help on using the changeset viewer.