Changeset 1441 for code/branches/console/src/core/CommandExecutor.cc
- Timestamp:
- May 27, 2008, 6:29:08 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/core/CommandExecutor.cc
r1437 r1441 371 371 { 372 372 // There is exactly one possible argument 373 CommandExecutor::getEvaluation().argument_ = (*CommandExecutor::getEvaluation().listOfPossibleArguments_.begin()). second;374 CommandExecutor::getEvaluation().possibleArgument_ = (*CommandExecutor::getEvaluation().listOfPossibleArguments_.begin()). second;373 CommandExecutor::getEvaluation().argument_ = (*CommandExecutor::getEvaluation().listOfPossibleArguments_.begin()).getString(); 374 CommandExecutor::getEvaluation().possibleArgument_ = (*CommandExecutor::getEvaluation().listOfPossibleArguments_.begin()).getString(); 375 375 CommandExecutor::getEvaluation().state_ = CS_ParamPreparation; 376 376 return; … … 457 457 if ((*it).first.find(lowercase) == 0 || fragment == "") 458 458 CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName())); 459 460 CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.sort(CommandExecutor::compareStringsInList);461 459 } 462 460 … … 477 475 CommandExecutor::getEvaluation().listOfPossibleFunctions_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName())); 478 476 } 479 480 CommandExecutor::getEvaluation().listOfPossibleFunctions_.sort(CommandExecutor::compareStringsInList);481 477 } 482 478 … … 487 483 CommandExecutor::getEvaluation().listOfPossibleArguments_.clear(); 488 484 std::string lowercase = getLowercase(fragment); 489 for (std::list<std::pair<std::string, std::string> >::const_iterator it = command->getArgumentCompletionListBegin(); it != command->getArgumentCompletionListEnd(); ++it) 490 if ((*it).first.find(lowercase) == 0 || fragment == "") 491 CommandExecutor::getEvaluation().listOfPossibleArguments_.push_back(std::pair<std::string, std::string>((*it).first, (*it).second)); 492 493 CommandExecutor::getEvaluation().listOfPossibleArguments_.sort(CommandExecutor::compareStringsInList2); 485 for (ArgumentCompletionList::const_iterator it = command->getArgumentCompletionListBegin(); it != command->getArgumentCompletionListEnd(); ++it) 486 { 487 if ((*it).lowercaseComparison()) 488 { 489 if ((*it).getComparable().find(lowercase) == 0 || fragment == "") 490 CommandExecutor::getEvaluation().listOfPossibleArguments_.push_back(*it); 491 } 492 else 493 { 494 if ((*it).getComparable().find(fragment) == 0 || fragment == "") 495 CommandExecutor::getEvaluation().listOfPossibleArguments_.push_back(*it); 496 } 497 } 494 498 } 495 499 … … 527 531 528 532 std::string lowercase = getLowercase(name); 529 for (std::list<std::pair<std::string, std::string> >::const_iterator it = command->getArgumentCompletionListBegin(); it != command->getArgumentCompletionListEnd(); ++it) 530 { 531 if ((*it).first == lowercase) 532 return (*it).second; 533 for (ArgumentCompletionList::const_iterator it = command->getArgumentCompletionListBegin(); it != command->getArgumentCompletionListEnd(); ++it) 534 { 535 if ((*it).lowercaseComparison()) 536 { 537 if ((*it).getComparable() == lowercase) 538 return (*it).getString(); 539 } 540 else 541 { 542 if ((*it).getComparable() == name) 543 return (*it).getString(); 544 } 533 545 } 534 546 … … 595 607 } 596 608 597 std::string CommandExecutor::getCommonBegin(const std::list<std::pair<std::string, std::string> >& list)609 std::string CommandExecutor::getCommonBegin(const ArgumentCompletionList& list) 598 610 { 599 611 if (list.size() == 0) … … 603 615 else if (list.size() == 1) 604 616 { 605 return ((*list.begin()). first+ " ");617 return ((*list.begin()).getComparable() + " "); 606 618 } 607 619 else … … 611 623 { 612 624 char temp = 0; 613 for (std::list<std::pair<std::string, std::string> >::const_iterator it = list.begin(); it != list.end(); ++it) 614 { 615 if ((*it).first.size() > i) 625 for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it) 626 { 627 std::string argument = (*it).getComparable(); 628 if (argument.size() > i) 616 629 { 617 630 if (it == list.begin()) 618 631 { 619 temp = (*it).first[i];632 temp = argument[i]; 620 633 } 621 634 else 622 635 { 623 if (temp != (*it).first[i])636 if (temp != argument[i]) 624 637 return output; 625 638 } … … 635 648 } 636 649 } 637 638 bool CommandExecutor::compareStringsInList(const std::pair<const std::string*, const std::string*>& first, const std::pair<const std::string*, const std::string*>& second)639 {640 return ((*first.first) < (*second.first));641 }642 643 bool CommandExecutor::compareStringsInList2(const std::pair<std::string, std::string>& first, const std::pair<std::string, std::string>& second)644 {645 return (first.first < second.first);646 }647 650 }
Note: See TracChangeset
for help on using the changeset viewer.