Changeset 1430 for code/branches/console/src/core/CommandExecutor.cc
- Timestamp:
- May 26, 2008, 8:30:33 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/core/CommandExecutor.cc
r1427 r1430 355 355 else 356 356 { 357 unsigned int argumentNumber = CommandExecutor::argumentsGiven() - 1;357 unsigned int argumentNumber = CommandExecutor::argumentsGiven() - 2; 358 358 if (CommandExecutor::getEvaluation().functionclass_) 359 359 argumentNumber -= 1; 360 360 361 std::cout << "arglist: " << CommandExecutor::getLastArgument() << ", " << CommandExecutor::getEvaluation().function_->getName() << ", " << argumentNumber << std::endl; 361 362 CommandExecutor::createListOfPossibleArguments(CommandExecutor::getLastArgument(), CommandExecutor::getEvaluation().function_, argumentNumber); 362 363 CommandExecutor::getEvaluation().state_ = CS_Params; … … 488 489 void CommandExecutor::createListOfPossibleArguments(const std::string& fragment, ConsoleCommand* command, unsigned int param) 489 490 { 491 CommandExecutor::createArgumentCompletionList(command, param); 492 490 493 CommandExecutor::getEvaluation().listOfPossibleArguments_.clear(); 491 494 std::string lowercase = getLowercase(fragment); 492 for (std::list<std::pair<std::string, std::string> >::const_iterator it = command->getArgumentCompletionListBegin( param); it != command->getArgumentCompletionListEnd(param); ++it)495 for (std::list<std::pair<std::string, std::string> >::const_iterator it = command->getArgumentCompletionListBegin(); it != command->getArgumentCompletionListEnd(); ++it) 493 496 if ((*it).first.find(lowercase) == 0 || fragment == "") 494 497 CommandExecutor::getEvaluation().listOfPossibleArguments_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second)); … … 527 530 std::string CommandExecutor::getPossibleArgument(const std::string& name, ConsoleCommand* command, unsigned int param) 528 531 { 532 CommandExecutor::createArgumentCompletionList(command, param); 533 529 534 std::string lowercase = getLowercase(name); 530 for (std::list<std::pair<std::string, std::string> >::const_iterator it = command->getArgumentCompletionListBegin( param); it != command->getArgumentCompletionListEnd(param); ++it)535 for (std::list<std::pair<std::string, std::string> >::const_iterator it = command->getArgumentCompletionListBegin(); it != command->getArgumentCompletionListEnd(); ++it) 531 536 if ((*it).first == lowercase) 532 537 return (*it).second; … … 535 540 } 536 541 542 void CommandExecutor::createArgumentCompletionList(ConsoleCommand* command, unsigned int param) 543 { 544 std::string params[5]; 545 546 unsigned int index = 0; 547 unsigned int lowestIndex = 1 + (CommandExecutor::getEvaluation().functionclass_ != 0); 548 549 for (unsigned int i = CommandExecutor::argumentsGiven() - 2; i >= lowestIndex; --i) 550 { 551 params[index] = CommandExecutor::getArgument(i); 552 ++index; 553 if (index >= 5) 554 break; 555 } 556 557 command->createArgumentCompletionList(param, params[0], params[1], params[2], params[3], params[4]); 558 } 559 537 560 std::string CommandExecutor::getCommonBegin(const std::list<std::pair<const std::string*, const std::string*> >& list) 538 561 {
Note: See TracChangeset
for help on using the changeset viewer.