Changeset 10916 for code/branches/cpp11_v2/src/libraries/core/command
- Timestamp:
- Dec 2, 2015, 11:22:03 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/libraries/core/command
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/libraries/core/command/ArgumentCompletionFunctions.cc
r10821 r10916 77 77 bool groupIsVisible(const std::map<std::string, ConsoleCommand*>& group, bool bOnlyShowHidden) 78 78 { 79 for (const auto & elem: group)80 if ( elem.second->isActive() && elem.second->hasAccess() && (!elem.second->isHidden())^bOnlyShowHidden)79 for (const auto& mapEntry : group) 80 if (mapEntry.second->isActive() && mapEntry.second->hasAccess() && (!mapEntry.second->isHidden())^bOnlyShowHidden) 81 81 return true; 82 82 … … 100 100 // get all the groups that are visible (except the shortcut group "") 101 101 const std::map<std::string, std::map<std::string, ConsoleCommand*>>& commands = ConsoleCommandManager::getInstance().getCommands(); 102 for (const auto & command: commands)103 if (groupIsVisible( command.second, bOnlyShowHidden) && command.first != "" && (fragmentLC == "" || getLowercase(command.first).find(fragmentLC) == 0))104 groupList.push_back(ArgumentCompletionListElement( command.first, getLowercase(command.first)));102 for (const auto& mapEntry : commands) 103 if (groupIsVisible(mapEntry.second, bOnlyShowHidden) && mapEntry.first != "" && (fragmentLC == "" || getLowercase(mapEntry.first).find(fragmentLC) == 0)) 104 groupList.push_back(ArgumentCompletionListElement(mapEntry.first, getLowercase(mapEntry.first))); 105 105 106 106 // now add all shortcuts (in group "") … … 113 113 114 114 // add the shortcuts 115 for (const auto & elem: it_group->second)116 if ( elem.second->isActive() && elem.second->hasAccess() && (!elem.second->isHidden())^bOnlyShowHidden && (fragmentLC == "" || getLowercase(elem.first).find(fragmentLC) == 0))117 groupList.push_back(ArgumentCompletionListElement( elem.first, getLowercase(elem.first)));115 for (const auto& mapEntry : it_group->second) 116 if (mapEntry.second->isActive() && mapEntry.second->hasAccess() && (!mapEntry.second->isHidden())^bOnlyShowHidden && (fragmentLC == "" || getLowercase(mapEntry.first).find(fragmentLC) == 0)) 117 groupList.push_back(ArgumentCompletionListElement(mapEntry.first, getLowercase(mapEntry.first))); 118 118 } 119 119 … … 146 146 if (it_group != ConsoleCommandManager::getInstance().getCommands().end()) 147 147 { 148 for (const auto & elem: it_group->second)149 if ( elem.second->isActive() && elem.second->hasAccess() && (!elem.second->isHidden())^bOnlyShowHidden)150 commandList.push_back(ArgumentCompletionListElement( elem.first, getLowercase(elem.first)));148 for (const auto& mapEntry : it_group->second) 149 if (mapEntry.second->isActive() && mapEntry.second->hasAccess() && (!mapEntry.second->isHidden())^bOnlyShowHidden) 150 commandList.push_back(ArgumentCompletionListElement(mapEntry.first, getLowercase(mapEntry.first))); 151 151 } 152 152 … … 281 281 282 282 const std::set<std::string>& names = SettingsConfigFile::getInstance().getSectionNames(); 283 for (const auto& name : names)283 for (const std::string& name : names) 284 284 sectionList.push_back(ArgumentCompletionListElement(name, getLowercase(name))); 285 285 -
code/branches/cpp11_v2/src/libraries/core/command/CommandEvaluation.cc
r10821 r10916 306 306 // the user typed 1-2 arguments, check what he tried to type and print a suitable error 307 307 std::string groupLC = getLowercase(this->getToken(0)); 308 for (const auto & elem: ConsoleCommandManager::getInstance().getCommandsLC())309 if ( elem.first == groupLC)308 for (const auto& mapEntry : ConsoleCommandManager::getInstance().getCommandsLC()) 309 if (mapEntry.first == groupLC) 310 310 return std::string("Error: There is no command in group \"") + this->getToken(0) + "\" starting with \"" + this->getToken(1) + "\"."; 311 311 … … 328 328 329 329 // iterate through all groups and their commands and calculate the distance to the current command. keep the best. 330 for (const auto & elem: ConsoleCommandManager::getInstance().getCommandsLC())331 { 332 if ( elem.first != "")333 { 334 for (std::map<std::string, ConsoleCommand*>::const_iterator it_name = elem.second.begin(); it_name != elem.second.end(); ++it_name)335 { 336 std::string command = elem.first + " " + it_name->first;330 for (const auto& mapEntry : ConsoleCommandManager::getInstance().getCommandsLC()) 331 { 332 if (mapEntry.first != "") 333 { 334 for (std::map<std::string, ConsoleCommand*>::const_iterator it_name = mapEntry.second.begin(); it_name != mapEntry.second.end(); ++it_name) 335 { 336 std::string command = mapEntry.first + " " + it_name->first; 337 337 unsigned int distance = getLevenshteinDistance(command, token0_LC + " " + token1_LC); 338 338 if (distance < nearestDistance) … … 349 349 if (it_group != ConsoleCommandManager::getInstance().getCommandsLC().end()) 350 350 { 351 for (const auto & elem: it_group->second)352 { 353 std::string command = elem.first;351 for (const auto& mapEntry : it_group->second) 352 { 353 std::string command = mapEntry.first; 354 354 unsigned int distance = getLevenshteinDistance(command, token0_LC); 355 355 if (distance < nearestDistance) … … 429 429 { 430 430 size_t count = 0; 431 for (const auto & elem: list)432 if (elem .getComparable() != "")431 for (const ArgumentCompletionListElement& element : list) 432 if (element.getComparable() != "") 433 433 ++count; 434 434 return count; … … 495 495 { 496 496 // only one (non-empty) value in the list - search it and return it 497 for (const auto & elem: list)498 { 499 if (elem .getComparable() != "")497 for (const ArgumentCompletionListElement& element : list) 498 { 499 if (element.getComparable() != "") 500 500 { 501 501 // arguments that have a separate string to be displayed need a little more care - just return them without modification. add a space character to the others. 502 if (elem .hasDisplay())503 return (elem .getString());502 if (element.hasDisplay()) 503 return (element.getString()); 504 504 else 505 return (elem .getString() + ' ');505 return (element.getString() + ' '); 506 506 } 507 507 } … … 517 517 char tempComparable = '\0'; 518 518 char temp = '\0'; 519 for (const auto & elem: list)520 { 521 const std::string& argumentComparable = elem .getComparable();522 const std::string& argument = elem .getString();519 for (const ArgumentCompletionListElement& element : list) 520 { 521 const std::string& argumentComparable = element.getComparable(); 522 const std::string& argument = element.getString(); 523 523 524 524 // ignore empty arguments … … 560 560 { 561 561 std::string output; 562 for (const auto & elem: list)563 { 564 output += elem .getDisplay();562 for (const ArgumentCompletionListElement& element : list) 563 { 564 output += element.getDisplay(); 565 565 566 566 // add a space character between two elements for all non-empty arguments 567 if (elem .getComparable() != "")567 if (element.getComparable() != "") 568 568 output += ' '; 569 569 } -
code/branches/cpp11_v2/src/libraries/core/command/ConsoleCommand.cc
r10825 r10916 75 75 this->baseFunctor_ = executor->getFunctor(); 76 76 77 for ( auto & elem: this->argumentCompleter_)78 elem= nullptr;77 for (ArgumentCompleter*& completer : this->argumentCompleter_) 78 completer = nullptr; 79 79 80 80 this->keybindMode_ = KeybindMode::OnPress; -
code/branches/cpp11_v2/src/libraries/core/command/Shell.cc
r10821 r10916 258 258 vectorize(text, '\n', &lines); 259 259 260 for ( auto& line : lines)260 for (const std::string& line : lines) 261 261 this->addLine(line, type); 262 262 } -
code/branches/cpp11_v2/src/libraries/core/command/TclThreadList.h
r10821 r10916 262 262 boost::shared_lock<boost::shared_mutex> lock(this->mutex_); 263 263 264 for (const auto & elem: this->list_)265 if (elem == value)264 for (const T& element : this->list_) 265 if (element == value) 266 266 return true; 267 267 -
code/branches/cpp11_v2/src/libraries/core/command/TclThreadManager.cc
r10821 r10916 551 551 552 552 std::list<unsigned int> threads; 553 for (const auto & elem: this->interpreterBundles_)554 if ( elem.first > 0 && elem.first <= this->numInterpreterBundles_) // only list autonumbered interpreters (created with create()) - exclude the default interpreter 0 and all manually numbered interpreters)555 threads.push_back( elem.first);553 for (const auto& mapEntry : this->interpreterBundles_) 554 if (mapEntry.first > 0 && mapEntry.first <= this->numInterpreterBundles_) // only list autonumbered interpreters (created with create()) - exclude the default interpreter 0 and all manually numbered interpreters) 555 threads.push_back(mapEntry.first); 556 556 return threads; 557 557 }
Note: See TracChangeset
for help on using the changeset viewer.