Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (8 years ago)
Author:
landauf
Message:

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/command/ArgumentCompletionFunctions.cc

    r10624 r11071  
    7777            bool groupIsVisible(const std::map<std::string, ConsoleCommand*>& group, bool bOnlyShowHidden)
    7878            {
    79                 for (std::map<std::string, ConsoleCommand*>::const_iterator it_command = group.begin(); it_command != group.end(); ++it_command)
    80                     if (it_command->second->isActive() && it_command->second->hasAccess() && (!it_command->second->isHidden())^bOnlyShowHidden)
     79                for (const auto& mapEntry : group)
     80                    if (mapEntry.second->isActive() && mapEntry.second->hasAccess() && (!mapEntry.second->isHidden())^bOnlyShowHidden)
    8181                        return true;
    8282
     
    9999
    100100                // get all the groups that are visible (except the shortcut group "")
    101                 const std::map<std::string, std::map<std::string, ConsoleCommand*> >& commands = ConsoleCommandManager::getInstance().getCommands();
    102                 for (std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = commands.begin(); it_group != commands.end(); ++it_group)
    103                     if (groupIsVisible(it_group->second, bOnlyShowHidden) && it_group->first != "" && (fragmentLC == "" || getLowercase(it_group->first).find(fragmentLC) == 0))
    104                         groupList.push_back(ArgumentCompletionListElement(it_group->first, getLowercase(it_group->first)));
     101                const std::map<std::string, std::map<std::string, ConsoleCommand*>>& commands = ConsoleCommandManager::getInstance().getCommands();
     102                for (const auto& mapEntry : commands)
     103                    if (groupIsVisible(mapEntry.second, bOnlyShowHidden) && mapEntry.first != "" && (fragmentLC == "" || getLowercase(mapEntry.first).find(fragmentLC) == 0))
     104                        groupList.emplace_back(mapEntry.first, getLowercase(mapEntry.first));
    105105
    106106                // now add all shortcuts (in group "")
    107                 std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = commands.find("");
     107                std::map<std::string, std::map<std::string, ConsoleCommand*>>::const_iterator it_group = commands.find("");
    108108                if (it_group != commands.end())
    109109                {
    110110                    // add a line-break if the list isn't empty
    111111                    if (!groupList.empty())
    112                         groupList.push_back(ArgumentCompletionListElement("", "", "\n"));
     112                        groupList.emplace_back("", "", "\n");
    113113
    114114                    // add the shortcuts
    115                     for (std::map<std::string, ConsoleCommand*>::const_iterator it_command = it_group->second.begin(); it_command != it_group->second.end(); ++it_command)
    116                         if (it_command->second->isActive() && it_command->second->hasAccess() && (!it_command->second->isHidden())^bOnlyShowHidden && (fragmentLC == "" || getLowercase(it_command->first).find(fragmentLC) == 0))
    117                             groupList.push_back(ArgumentCompletionListElement(it_command->first, getLowercase(it_command->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.emplace_back(mapEntry.first, getLowercase(mapEntry.first));
    118118                }
    119119
     
    138138
    139139                // find the iterator of the given group
    140                 std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommandManager::getInstance().getCommands().begin();
     140                std::map<std::string, std::map<std::string, ConsoleCommand*>>::const_iterator it_group = ConsoleCommandManager::getInstance().getCommands().begin();
    141141                for ( ; it_group != ConsoleCommandManager::getInstance().getCommands().end(); ++it_group)
    142142                    if (getLowercase(it_group->first) == groupLC)
     
    146146                if (it_group != ConsoleCommandManager::getInstance().getCommands().end())
    147147                {
    148                     for (std::map<std::string, ConsoleCommand*>::const_iterator it_command = it_group->second.begin(); it_command != it_group->second.end(); ++it_command)
    149                         if (it_command->second->isActive() && it_command->second->hasAccess() && (!it_command->second->isHidden())^bOnlyShowHidden)
    150                             commandList.push_back(ArgumentCompletionListElement(it_command->first, getLowercase(it_command->first)));
     148                    for (const auto& mapEntry : it_group->second)
     149                        if (mapEntry.second->isActive() && mapEntry.second->hasAccess() && (!mapEntry.second->isHidden())^bOnlyShowHidden)
     150                            commandList.emplace_back(mapEntry.first, getLowercase(mapEntry.first));
    151151                }
    152152
     
    188188            {
    189189                ArgumentCompletionList list;
    190                 list.push_back(ArgumentCompletionListElement("", "", hint));
     190                list.emplace_back("", "", hint);
    191191                return list;
    192192            }
     
    212212            if (tokens.size() == 1)
    213213            {
    214                 std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommandManager::getInstance().getCommands().find(tokens[0]);
     214                std::map<std::string, std::map<std::string, ConsoleCommand*>>::const_iterator it_group = ConsoleCommandManager::getInstance().getCommands().find(tokens[0]);
    215215                if (it_group != ConsoleCommandManager::getInstance().getCommands().end())
    216216                    return detail::_subcommands(fragment, tokens[0], true);
     
    261261                {
    262262                    if (boost::filesystem::is_directory(*file))
    263                         dirlist.push_back(ArgumentCompletionListElement(file->BF_DICTIONARY_ENTRY_NAME() + '/', getLowercase(file->BF_DICTIONARY_ENTRY_NAME()) + '/', file->BF_LEAF() + '/'));
     263                        dirlist.emplace_back(file->BF_DICTIONARY_ENTRY_NAME() + '/', getLowercase(file->BF_DICTIONARY_ENTRY_NAME()) + '/', file->BF_LEAF() + '/');
    264264                    else
    265                         filelist.push_back(ArgumentCompletionListElement(file->BF_DICTIONARY_ENTRY_NAME(), getLowercase(file->BF_DICTIONARY_ENTRY_NAME()), file->BF_LEAF()));
     265                        filelist.emplace_back(file->BF_DICTIONARY_ENTRY_NAME(), getLowercase(file->BF_DICTIONARY_ENTRY_NAME()), file->BF_LEAF());
    266266                    ++file;
    267267                }
     
    281281
    282282            const std::set<std::string>& names = SettingsConfigFile::getInstance().getSectionNames();
    283             for (std::set<std::string>::const_iterator it = names.begin(); it != names.end(); ++it)
    284                 sectionList.push_back(ArgumentCompletionListElement(*it, getLowercase(*it)));
     283            for (const std::string& name : names)
     284                sectionList.emplace_back(name, getLowercase(name));
    285285
    286286            return sectionList;
     
    298298            SettingsConfigFile::ContainerMap::const_iterator upper = settings.getContainerUpperBound(sectionLC);
    299299            for (SettingsConfigFile::ContainerMap::const_iterator it = settings.getContainerLowerBound(sectionLC); it != upper; ++it)
    300                 entryList.push_back(ArgumentCompletionListElement(it->second.second->getName(), it->second.first));
     300                entryList.emplace_back(it->second.second->getName(), it->second.first);
    301301
    302302            return entryList;
     
    319319                {
    320320                    const std::string& valuestring = it->second.second->toString();
    321                     oldValue.push_back(ArgumentCompletionListElement(valuestring, getLowercase(valuestring), "Old value: " + valuestring));
     321                    oldValue.emplace_back(valuestring, getLowercase(valuestring), "Old value: " + valuestring);
    322322                }
    323323            }
     
    334334            ArgumentCompletionList threads;
    335335
    336             for (std::list<unsigned int>::const_iterator it = threadnumbers.begin(); it != threadnumbers.end(); ++it)
    337                 threads.push_back(ArgumentCompletionListElement(multi_cast<std::string>(*it)));
     336            for (unsigned int threadnumber : threadnumbers)
     337                threads.emplace_back(multi_cast<std::string>(threadnumber));
    338338
    339339            return threads;
Note: See TracChangeset for help on using the changeset viewer.