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/CommandEvaluation.cc

    r10624 r11071  
    5454    void CommandEvaluation::initialize(const std::string& command)
    5555    {
    56         this->execCommand_ = 0;
    57         this->hintCommand_ = 0;
     56        this->execCommand_ = nullptr;
     57        this->hintCommand_ = nullptr;
    5858        this->string_ = command;
    5959        this->execArgumentsOffset_ = 0;
     
    119119    /**
    120120        @brief Executes the command which was evaluated by this object and returns its return-value.
    121         @param error A pointer to an integer (or NULL) which will be used to write error codes to (see @ref CommandExecutorErrorCodes "CommandExecutor error codes")
     121        @param error A pointer to an integer (or nullptr) which will be used to write error codes to (see @ref CommandExecutorErrorCodes "CommandExecutor error codes")
    122122        @return Returns the result of the command (or MultiType::Null if there is no return value)
    123123    */
     
    306306                // the user typed 1-2 arguments, check what he tried to type and print a suitable error
    307307                std::string groupLC = getLowercase(this->getToken(0));
    308                 for (std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommandManager::getInstance().getCommandsLC().begin(); it_group != ConsoleCommandManager::getInstance().getCommandsLC().end(); ++it_group)
    309                     if (it_group->first == groupLC)
     308                for (const auto& mapEntry : ConsoleCommandManager::getInstance().getCommandsLC())
     309                    if (mapEntry.first == groupLC)
    310310                        return std::string("Error: There is no command in group \"") + this->getToken(0) + "\" starting with \"" + this->getToken(1) + "\".";
    311311
     
    328328
    329329        // iterate through all groups and their commands and calculate the distance to the current command. keep the best.
    330         for (std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommandManager::getInstance().getCommandsLC().begin(); it_group != ConsoleCommandManager::getInstance().getCommandsLC().end(); ++it_group)
    331         {
    332             if (it_group->first != "")
    333             {
    334                 for (std::map<std::string, ConsoleCommand*>::const_iterator it_name = it_group->second.begin(); it_name != it_group->second.end(); ++it_name)
    335                 {
    336                     std::string command = it_group->first + " " + it_name->first;
     330        for (const auto& mapEntryGroup : ConsoleCommandManager::getInstance().getCommandsLC())
     331        {
     332            if (mapEntryGroup.first != "")
     333            {
     334                for (const auto& mapEntryName : mapEntryGroup.second)
     335                {
     336                    std::string command = mapEntryGroup.first + " " + mapEntryName.first;
    337337                    unsigned int distance = getLevenshteinDistance(command, token0_LC + " " + token1_LC);
    338338                    if (distance < nearestDistance)
     
    346346
    347347        // now also iterate through all shortcuts and keep the best if it's better than the one found above.
    348         std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommandManager::getInstance().getCommandsLC().find("");
     348        std::map<std::string, std::map<std::string, ConsoleCommand*>>::const_iterator it_group = ConsoleCommandManager::getInstance().getCommandsLC().find("");
    349349        if (it_group !=  ConsoleCommandManager::getInstance().getCommandsLC().end())
    350350        {
    351             for (std::map<std::string, ConsoleCommand*>::const_iterator it_name = it_group->second.begin(); it_name != it_group->second.end(); ++it_name)
    352             {
    353                 std::string command = it_name->first;
     351            for (const auto& mapEntry : it_group->second)
     352            {
     353                std::string command = mapEntry.first;
    354354                unsigned int distance = getLevenshteinDistance(command, token0_LC);
    355355                if (distance < nearestDistance)
     
    429429    {
    430430        size_t count = 0;
    431         for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it)
    432             if (it->getComparable() != "")
     431        for (const ArgumentCompletionListElement& element : list)
     432            if (element.getComparable() != "")
    433433                ++count;
    434434        return count;
     
    495495        {
    496496            // only one (non-empty) value in the list - search it and return it
    497             for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it)
    498             {
    499                 if (it->getComparable() != "")
     497            for (const ArgumentCompletionListElement& element : list)
     498            {
     499                if (element.getComparable() != "")
    500500                {
    501501                    // 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 (it->hasDisplay())
    503                         return (it->getString());
     502                    if (element.hasDisplay())
     503                        return (element.getString());
    504504                    else
    505                         return (it->getString() + ' ');
     505                        return (element.getString() + ' ');
    506506                }
    507507            }
     
    517517                char tempComparable = '\0';
    518518                char temp = '\0';
    519                 for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it)
    520                 {
    521                     const std::string& argumentComparable = it->getComparable();
    522                     const std::string& argument = it->getString();
     519                for (const ArgumentCompletionListElement& element : list)
     520                {
     521                    const std::string& argumentComparable = element.getComparable();
     522                    const std::string& argument = element.getString();
    523523
    524524                    // ignore empty arguments
     
    560560    {
    561561        std::string output;
    562         for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it)
    563         {
    564             output += it->getDisplay();
     562        for (const ArgumentCompletionListElement& element : list)
     563        {
     564            output += element.getDisplay();
    565565
    566566            // add a space character between two elements for all non-empty arguments
    567             if (it->getComparable() != "")
     567            if (element.getComparable() != "")
    568568                output += ' ';
    569569        }
Note: See TracChangeset for help on using the changeset viewer.