Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 21, 2015, 7:05:53 PM (9 years ago)
Author:
muemart
Message:

Run clang-modernize -loop-convert

  • Again, not all possible loops were converted
  • It can do pretty cool transformations, but I had to fix a few compile errors, so there might be some runtime errors lurking around too
Location:
code/branches/cpp11_v2/src/libraries/core
Files:
41 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/libraries/core/BaseObject.cc

    r10768 r10821  
    234234    {
    235235        unsigned int i = 0;
    236         for (std::set<Template*>::const_iterator it = this->templates_.begin(); it != this->templates_.end(); ++it)
     236        for (const auto & elem : this->templates_)
    237237        {
    238238            if (i == index)
    239                 return (*it);
     239                return (elem);
    240240            i++;
    241241        }
     
    269269    {
    270270        unsigned int i = 0;
    271         for (std::map<BaseObject*, std::string>::const_iterator it = this->eventSources_.begin(); it != this->eventSources_.end(); ++it)
    272         {
    273             if (it->second != state)
     271        for (const auto & elem : this->eventSources_)
     272        {
     273            if (elem.second != state)
    274274                continue;
    275275
    276276            if (i == index)
    277                 return it->first;
     277                return elem.first;
    278278            ++i;
    279279        }
     
    296296    {
    297297        unsigned int i = 0;
    298         for (std::set<BaseObject*>::const_iterator it = this->eventListenersXML_.begin(); it != this->eventListenersXML_.end(); ++it)
     298        for (const auto & elem : this->eventListenersXML_)
    299299        {
    300300            if (i == index)
    301                 return *it;
     301                return elem;
    302302            ++i;
    303303        }
     
    358358        Event event(activate, originator, name);
    359359
    360         for (std::set<BaseObject*>::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
    361         {
    362             event.statename_ = (*it)->eventSources_[this];
    363             (*it)->processEvent(event);
     360        for (const auto & elem : this->eventListeners_)
     361        {
     362            event.statename_ = (elem)->eventSources_[this];
     363            (elem)->processEvent(event);
    364364        }
    365365    }
     
    370370    void BaseObject::fireEvent(Event& event)
    371371    {
    372         for (std::set<BaseObject*>::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
    373             (*it)->processEvent(event);
     372        for (const auto & elem : this->eventListeners_)
     373            (elem)->processEvent(event);
    374374    }
    375375
     
    474474
    475475            // iterate through all states and get the event sources
    476             for (std::list<std::string>::iterator it = eventnames.begin(); it != eventnames.end(); ++it)
     476            for (auto & statename : eventnames)
    477477            {
    478                 const std::string& statename = (*it);
     478               
    479479
    480480                // if the event state is already known, continue with the next state
  • code/branches/cpp11_v2/src/libraries/core/ClassTreeMask.cc

    r10768 r10821  
    293293        {
    294294            // No it's not: Search for classes inheriting from the given class and add the rules for them
    295             for (std::set<const Identifier*>::const_iterator it = subclass->getDirectChildren().begin(); it != subclass->getDirectChildren().end(); ++it)
    296                 if ((*it)->isA(this->root_->getClass()))
    297                     if (overwrite || (!this->nodeExists(*it))) // If we don't want to overwrite, only add nodes that don't already exist
    298                         this->add(this->root_, *it, bInclude, overwrite);
     295            for (const auto & elem : subclass->getDirectChildren())
     296                if ((elem)->isA(this->root_->getClass()))
     297                    if (overwrite || (!this->nodeExists(elem))) // If we don't want to overwrite, only add nodes that don't already exist
     298                        this->add(this->root_, elem, bInclude, overwrite);
    299299        }
    300300
     
    325325        {
    326326            // Search for an already existing node, containing the subclass we want to add
    327             for (std::list<ClassTreeMaskNode*>::iterator it = node->subnodes_.begin(); it != node->subnodes_.end(); ++it)
     327            for (auto & elem : node->subnodes_)
    328328            {
    329                 if (subclass->isA((*it)->getClass()))
     329                if (subclass->isA((elem)->getClass()))
    330330                {
    331331                    // We've found an existing node -> delegate the work with a recursive function-call and return
    332                     this->add(*it, subclass, bInclude, overwrite);
     332                    this->add(elem, subclass, bInclude, overwrite);
    333333                    return;
    334334                }
     
    392392        if (!subclass)
    393393            return;
    394         for (std::set<const Identifier*>::const_iterator it = subclass->getDirectChildren().begin(); it != subclass->getDirectChildren().end(); ++it)
    395             this->add(*it, this->isIncluded(*it), false, false);
     394        for (const auto & elem : subclass->getDirectChildren())
     395            this->add(elem, this->isIncluded(elem), false, false);
    396396
    397397        this->add(subclass, bInclude, false, clean);
     
    435435
    436436            // Go through the list of subnodes and look for a node containing the searched subclass and delegate the request by a recursive function-call.
    437             for (std::list<ClassTreeMaskNode*>::iterator it = node->subnodes_.begin(); it != node->subnodes_.end(); ++it)
    438                 if (subclass->isA((*it)->getClass()))
    439                     return isIncluded(*it, subclass);
     437            for (auto & elem : node->subnodes_)
     438                if (subclass->isA((elem)->getClass()))
     439                    return isIncluded(elem, subclass);
    440440
    441441            // There is no subnode containing our class -> the rule of the current node takes in effect
     
    957957            // The bool is "false", meaning they have no subnodes and therefore need no further checks
    958958            if (node->isIncluded())
    959                 for (std::set<const Identifier*>::iterator it = directChildren.begin(); it != directChildren.end(); ++it)
    960                     this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(*it, false));
     959                for (const auto & elem : directChildren)
     960                    this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(elem, false));
    961961        }
    962962    }
  • code/branches/cpp11_v2/src/libraries/core/Core.cc

    r10768 r10821  
    279279
    280280        const std::vector<std::string>& modulePaths = ApplicationPaths::getInstance().getModulePaths();
    281         for (std::vector<std::string>::const_iterator it = modulePaths.begin(); it != modulePaths.end(); ++it)
    282         {
    283             ModuleInstance* module = new ModuleInstance(*it);
     281        for (const auto & modulePath : modulePaths)
     282        {
     283            ModuleInstance* module = new ModuleInstance(modulePath);
    284284            this->loadModule(module);
    285285            this->modules_.push_back(module);
     
    309309    void Core::unloadModules()
    310310    {
    311         for (std::list<ModuleInstance*>::iterator it = this->modules_.begin(); it != this->modules_.end(); ++it)
    312         {
    313             ModuleInstance* module = (*it);
     311        for (auto module : this->modules_)
     312        {
     313           
    314314            this->unloadModule(module);
    315315            delete module;
  • code/branches/cpp11_v2/src/libraries/core/CoreStaticInitializationHandler.cc

    r10624 r10821  
    9999        std::set<Identifier*> identifiers;
    100100        const std::set<StaticallyInitializedInstance*>& instances = module->getInstances(StaticInitialization::IDENTIFIER);
    101         for (std::set<StaticallyInitializedInstance*>::const_iterator it = instances.begin(); it != instances.end(); ++it)
    102             identifiers.insert(&static_cast<StaticallyInitializedIdentifier*>(*it)->getIdentifier());
     101        for (const auto & instance : instances)
     102            identifiers.insert(&static_cast<StaticallyInitializedIdentifier*>(instance)->getIdentifier());
    103103
    104104        // destroy objects. some objects may survive this at first because they still have strong pointers pointing at them. this is
     
    106106        // that objects within one module may reference each other by strong pointers. but it is not allowed that objects from another
    107107        // module (which is not unloaded) uses strong pointers to point at objects inside the unloaded module. this will lead to a crash.
    108         for (std::set<Identifier*>::iterator it = identifiers.begin(); it != identifiers.end(); ++it)
    109             (*it)->destroyObjects();
     108        for (const auto & identifier : identifiers)
     109            (identifier)->destroyObjects();
    110110
    111111        // check if all objects were really destroyed. this is not the case if an object is referenced by a strong pointer from another
    112112        // module (or if two objects inside this module reference each other). this will lead to a crash and must be fixed (e.g. by
    113113        // changing object dependencies; or by changing the logic that allows modules to be unloaded).
    114         for (std::set<Identifier*>::iterator it = identifiers.begin(); it != identifiers.end(); ++it)
     114        for (const auto & identifier : identifiers)
    115115        {
    116             ObjectListBase* objectList = Context::getRootContext()->getObjectList(*it);
     116            ObjectListBase* objectList = Context::getRootContext()->getObjectList(identifier);
    117117            if (objectList->size() > 0)
    118118            {
    119                 orxout(internal_error) << "There are still " << objectList->size() << " objects of type " << (*it)->getName()
     119                orxout(internal_error) << "There are still " << objectList->size() << " objects of type " << (identifier)->getName()
    120120                    << " after unloading the Identifier. This may lead to a crash" << endl;
    121121            }
     
    123123
    124124        // destroy object-lists in all contexts
    125         for (std::set<Identifier*>::iterator it_identifier = identifiers.begin(); it_identifier != identifiers.end(); ++it_identifier)
     125        for (const auto & identifier : identifiers)
    126126        {
    127127            // only do this if the Identifier is not a Context itself; otherwise we delete the list we're iterating over
    128             if (!(*it_identifier)->isExactlyA(Class(Context)))
     128            if (!(identifier)->isExactlyA(Class(Context)))
    129129            {
    130130                // iterate over all contexts
    131131                for (ObjectList<Context>::iterator it_context = ObjectList<Context>::begin(); it_context != ObjectList<Context>::end(); ++it_context)
    132                     it_context->destroyObjectList((*it_identifier));
     132                    it_context->destroyObjectList((identifier));
    133133            }
    134134        }
  • code/branches/cpp11_v2/src/libraries/core/Game.cc

    r10772 r10821  
    612612        // Check if graphics is still required
    613613        bool graphicsRequired = false;
    614         for (unsigned i = 0; i < loadedStates_.size(); ++i)
    615             graphicsRequired |= loadedStates_[i]->getInfo().bGraphicsMode;
     614        for (auto & elem : loadedStates_)
     615            graphicsRequired |= elem->getInfo().bGraphicsMode;
    616616        if (!graphicsRequired)
    617617            this->unloadGraphics(!this->bAbort_); // if abort is false, that means the game is still running while unloading graphics. in this case we load a graphics manager without renderer (to keep all necessary ogre instances alive)
  • code/branches/cpp11_v2/src/libraries/core/Language.cc

    r10768 r10821  
    107107    Language::~Language()
    108108    {
    109         for (std::map<std::string, LanguageEntry*>::iterator it = this->languageEntries_.begin(); it != this->languageEntries_.end(); ++it)
    110             delete (it->second);
     109        for (auto & elem : this->languageEntries_)
     110            delete (elem.second);
    111111    }
    112112
     
    319319
    320320        // Iterate through the list an write the lines into the file
    321         for (std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.begin(); it != this->languageEntries_.end(); ++it)
    322         {
    323             file << it->second->getLabel() << '=' << it->second->getDefault() << endl;
     321        for (const auto & elem : this->languageEntries_)
     322        {
     323            file << elem.second->getLabel() << '=' << elem.second->getDefault() << endl;
    324324        }
    325325
  • code/branches/cpp11_v2/src/libraries/core/Loader.cc

    r10777 r10821  
    165165                        std::ostringstream message;
    166166                        message << "Possible sources of error:" << endl;
    167                         for (std::vector<std::pair<std::string, size_t>>::iterator it = linesources.begin(); it != linesources.end(); ++it)
     167                        for (auto & linesource : linesources)
    168168                        {
    169                             message << it->first << ", Line " << it->second << endl;
     169                            message << linesource.first << ", Line " << linesource.second << endl;
    170170                        }
    171171                        orxout(user_error, context::loader) << message.str() << endl;
     
    261261        {
    262262            bool expectedValue = true;
    263             for (std::map<size_t, bool>::iterator it = luaTags.begin(); it != luaTags.end(); ++it)
    264             {
    265                 if (it->second == expectedValue)
     263            for (auto & luaTag : luaTags)
     264            {
     265                if (luaTag.second == expectedValue)
    266266                    expectedValue = !expectedValue;
    267267                else
  • code/branches/cpp11_v2/src/libraries/core/LuaState.cc

    r10817 r10821  
    326326    /*static*/ bool LuaState::addToluaInterface(int (*function)(lua_State*), const std::string& name)
    327327    {
    328         for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
    329         {
    330             if (it->first == name || it->second == function)
     328        for (const auto & interface : getToluaInterfaces())
     329        {
     330            if (interface.first == name || interface.second == function)
    331331            {
    332332                orxout(internal_warning, context::lua) << "Trying to add a Tolua interface with the same name or function." << endl;
     
    337337
    338338        // Open interface in all LuaStates
    339         for (std::vector<LuaState*>::const_iterator it = getInstances().begin(); it != getInstances().end(); ++it)
    340             (*function)((*it)->luaState_);
     339        for (const auto & state : getInstances())
     340            (*function)(state->luaState_);
    341341
    342342        // Return dummy bool
     
    354354
    355355        // Close interface in all LuaStates
    356         for (std::vector<LuaState*>::const_iterator itState = getInstances().begin(); itState != getInstances().end(); ++itState)
    357         {
    358             lua_pushnil((*itState)->luaState_);
    359             lua_setglobal((*itState)->luaState_, it->first.c_str());
     356        for (const auto & state : getInstances())
     357        {
     358            lua_pushnil(state->luaState_);
     359            lua_setglobal(state->luaState_, it->first.c_str());
    360360        }
    361361
     
    369369    /*static*/ void LuaState::openToluaInterfaces(lua_State* state)
    370370    {
    371         for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
    372             (*it->second)(state);
     371        for (const auto & interface : getToluaInterfaces())
     372            (interface.second)(state);
    373373    }
    374374
    375375    /*static*/ void LuaState::closeToluaInterfaces(lua_State* state)
    376376    {
    377         for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
     377        for (const auto & interface : getToluaInterfaces())
    378378        {
    379379            lua_pushnil(state);
    380             lua_setglobal(state, it->first.c_str());
     380            lua_setglobal(state, interface.first.c_str());
    381381        }
    382382    }
  • code/branches/cpp11_v2/src/libraries/core/Namespace.cc

    r10768 r10821  
    5353    {
    5454        if (this->bRoot_)
    55             for (std::set<NamespaceNode*>::iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); ++it)
    56                 delete (*it);
     55            for (auto & elem : this->representingNamespaces_)
     56                delete elem;
    5757    }
    5858
     
    8080            for (unsigned int i = 0; i < tokens.size(); i++)
    8181            {
    82                 for (std::set<NamespaceNode*>::iterator it = this->getNamespace()->representingNamespaces_.begin(); it != this->getNamespace()->representingNamespaces_.end(); ++it)
     82                for (auto & elem : this->getNamespace()->representingNamespaces_)
    8383                {
    84                     std::set<NamespaceNode*> temp = (*it)->getNodeRelative(tokens[i]);
     84                    std::set<NamespaceNode*> temp = elem->getNodeRelative(tokens[i]);
    8585                    this->representingNamespaces_.insert(temp.begin(), temp.end());
    8686                }
     
    9393        if (this->bAutogeneratedFileRootNamespace_)
    9494        {
    95             for (std::set<NamespaceNode*>::iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); ++it)
     95            for (auto & elem : this->representingNamespaces_)
    9696            {
    97                 (*it)->setRoot(true);
    98                 (*it)->setHidden(true);
     97                elem->setRoot(true);
     98                elem->setHidden(true);
    9999            }
    100100        }
     
    114114    bool Namespace::includes(const Namespace* ns) const
    115115    {
    116         for (std::set<NamespaceNode*>::const_iterator it1 = this->representingNamespaces_.begin(); it1 != this->representingNamespaces_.end(); ++it1)
     116        for (const auto & elem1 : this->representingNamespaces_)
    117117        {
    118             for (std::set<NamespaceNode*>::const_iterator it2 = ns->representingNamespaces_.begin(); it2 != ns->representingNamespaces_.end(); ++it2)
     118            for (const auto & elem2 : ns->representingNamespaces_)
    119119            {
    120                 if ((*it1)->includes(*it2))
     120                if (elem1->includes(elem2))
    121121                {
    122122                    if (this->operator_ == "or")
     
    149149
    150150        int i = 0;
    151         for (std::set<NamespaceNode*>::const_iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); i++, ++it)
     151        for (const auto & elem : this->representingNamespaces_)
    152152        {
    153153            if (i > 0)
    154154                output += " / ";
    155155
    156             output += (*it)->toString();
     156            output += elem->toString();
     157            i++;
    157158        }
    158159
     
    165166
    166167        int i = 0;
    167         for (std::set<NamespaceNode*>::const_iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); i++, ++it)
     168        for (const auto & elem : this->representingNamespaces_)
    168169        {
    169170            if (i > 0)
    170171                output += '\n';
    171172
    172             output += (*it)->toString(indentation);
     173            output += elem->toString(indentation);
     174            i++;
    173175        }
    174176
  • code/branches/cpp11_v2/src/libraries/core/NamespaceNode.cc

    r8858 r10821  
    103103                bool bFoundMatchingNamespace = false;
    104104
    105                 for (std::map<std::string, NamespaceNode*>::iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); ++it)
     105                for (auto & elem : this->subnodes_)
    106106                {
    107                     if (it->first.find(firstPart) == (it->first.size() - firstPart.size()))
     107                    if (elem.first.find(firstPart) == (elem.first.size() - firstPart.size()))
    108108                    {
    109                         std::set<NamespaceNode*> temp2 = it->second->getNodeRelative(secondPart);
     109                        std::set<NamespaceNode*> temp2 = elem.second->getNodeRelative(secondPart);
    110110                        nodes.insert(temp2.begin(), temp2.end());
    111111                        bFoundMatchingNamespace = true;
     
    132132        else
    133133        {
    134             for (std::map<std::string, NamespaceNode*>::const_iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); ++it)
    135                 if (it->second->includes(ns))
     134            for (const auto & elem : this->subnodes_)
     135                if (elem.second->includes(ns))
    136136                    return true;
    137137        }
     
    167167        std::string output = (indentation + this->name_ + '\n');
    168168
    169         for (std::map<std::string, NamespaceNode*>::const_iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); ++it)
    170             output += it->second->toString(indentation + "  ");
     169        for (const auto & elem : this->subnodes_)
     170            output += elem.second->toString(indentation + "  ");
    171171
    172172        return output;
  • code/branches/cpp11_v2/src/libraries/core/Resource.cc

    r10772 r10821  
    5858        DataStreamListPtr resources(new Ogre::DataStreamList());
    5959        const Ogre::StringVector& groups = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
    60         for (Ogre::StringVector::const_iterator it = groups.begin(); it != groups.end(); ++it)
     60        for (const auto & group : groups)
    6161        {
    62             DataStreamListPtr temp = Ogre::ResourceGroupManager::getSingleton().openResources(pattern, *it);
     62            DataStreamListPtr temp = Ogre::ResourceGroupManager::getSingleton().openResources(pattern, group);
    6363            resources->insert(resources->end(), temp->begin(), temp->end());
    6464        }
     
    121121        StringVectorPtr resourceNames(new Ogre::StringVector());
    122122        const Ogre::StringVector& groups = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
    123         for (Ogre::StringVector::const_iterator it = groups.begin(); it != groups.end(); ++it)
     123        for (const auto & group : groups)
    124124        {
    125             StringVectorPtr temp = Ogre::ResourceGroupManager::getSingleton().findResourceNames(*it, pattern);
     125            StringVectorPtr temp = Ogre::ResourceGroupManager::getSingleton().findResourceNames(group, pattern);
    126126            resourceNames->insert(resourceNames->end(), temp->begin(), temp->end());
    127127        }
  • code/branches/cpp11_v2/src/libraries/core/class/Identifier.cc

    r10768 r10821  
    8787        for (std::list<const Identifier*>::const_iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it)
    8888            const_cast<Identifier*>(*it)->directChildren_.erase(this);
    89         for (std::set<const Identifier*>::const_iterator it = this->children_.begin(); it != this->children_.end(); ++it)
    90             const_cast<Identifier*>(*it)->parents_.remove(this);
    91         for (std::set<const Identifier*>::const_iterator it = this->directChildren_.begin(); it != this->directChildren_.end(); ++it)
    92             const_cast<Identifier*>(*it)->directParents_.remove(this);
    93 
    94         for (std::map<std::string, ConfigValueContainer*>::iterator it = this->configValues_.begin(); it != this->configValues_.end(); ++it)
    95             delete (it->second);
    96         for (std::map<std::string, XMLPortParamContainer*>::iterator it = this->xmlportParamContainers_.begin(); it != this->xmlportParamContainers_.end(); ++it)
    97             delete (it->second);
    98         for (std::map<std::string, XMLPortObjectContainer*>::iterator it = this->xmlportObjectContainers_.begin(); it != this->xmlportObjectContainers_.end(); ++it)
    99             delete (it->second);
     89        for (const auto & elem : this->children_)
     90            const_cast<Identifier*>(elem)->parents_.remove(this);
     91        for (const auto & elem : this->directChildren_)
     92            const_cast<Identifier*>(elem)->directParents_.remove(this);
     93
     94        for (auto & elem : this->configValues_)
     95            delete (elem.second);
     96        for (auto & elem : this->xmlportParamContainers_)
     97            delete (elem.second);
     98        for (auto & elem : this->xmlportObjectContainers_)
     99            delete (elem.second);
    100100    }
    101101
     
    157157        if (this->directParents_.empty())
    158158        {
    159             for (std::list<const Identifier*>::const_iterator it = initializationTrace.begin(); it != initializationTrace.end(); ++it)
    160                 if (*it != this)
    161                     this->parents_.push_back(*it);
     159            for (const auto & elem : initializationTrace)
     160                if (elem != this)
     161                    this->parents_.push_back(elem);
    162162        }
    163163        else
     
    261261
    262262        // if any parent class is virtual, it will be instantiated first, so we need to add them first.
    263         for (std::list<const Identifier*>::const_iterator it_parent = this->parents_.begin(); it_parent != this->parents_.end(); ++it_parent)
    264         {
    265             if ((*it_parent)->isVirtualBase())
     263        for (const auto & elem : this->parents_)
     264        {
     265            if ((elem)->isVirtualBase())
    266266            {
    267                 for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(*it_parent)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(*it_parent)->parents_.end(); ++it_parent_parent)
     267                for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(elem)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(elem)->parents_.end(); ++it_parent_parent)
    268268                    this->addIfNotExists(expectedIdentifierTrace, *it_parent_parent);
    269                 this->addIfNotExists(expectedIdentifierTrace, *it_parent);
     269                this->addIfNotExists(expectedIdentifierTrace, elem);
    270270            }
    271271        }
    272272
    273273        // now all direct parents get created recursively. already added identifiers (e.g. virtual base classes) are not added again.
    274         for (std::list<const Identifier*>::const_iterator it_parent = this->directParents_.begin(); it_parent != this->directParents_.end(); ++it_parent)
    275         {
    276             for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(*it_parent)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(*it_parent)->parents_.end(); ++it_parent_parent)
     274        for (const auto & elem : this->directParents_)
     275        {
     276            for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(elem)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(elem)->parents_.end(); ++it_parent_parent)
    277277                this->addIfNotExists(expectedIdentifierTrace, *it_parent_parent);
    278             this->addIfNotExists(expectedIdentifierTrace, *it_parent);
     278            this->addIfNotExists(expectedIdentifierTrace, elem);
    279279        }
    280280
     
    285285
    286286            orxout(internal_warning) << "  Actual trace (after creating a sample instance):" << endl << "    ";
    287             for (std::list<const Identifier*>::const_iterator it_parent = this->parents_.begin(); it_parent != this->parents_.end(); ++it_parent)
    288                 orxout(internal_warning) << " " << (*it_parent)->getName();
     287            for (const auto & elem : this->parents_)
     288                orxout(internal_warning) << " " << (elem)->getName();
    289289            orxout(internal_warning) << endl;
    290290
     
    295295
    296296            orxout(internal_warning) << "  Direct parents (according to class hierarchy definitions):" << endl << "    ";
    297             for (std::list<const Identifier*>::const_iterator it_parent = this->directParents_.begin(); it_parent != this->directParents_.end(); ++it_parent)
    298                 orxout(internal_warning) << " " << (*it_parent)->getName();
     297            for (const auto & elem : this->directParents_)
     298                orxout(internal_warning) << " " << (elem)->getName();
    299299            orxout(internal_warning) << endl;
    300300        }
  • code/branches/cpp11_v2/src/libraries/core/class/Identifier.h

    r10817 r10821  
    462462
    463463        if (updateChildren)
    464             for (std::set<const Identifier*>::const_iterator it = this->getChildren().begin(); it != this->getChildren().end(); ++it)
    465                 (*it)->updateConfigValues(false);
     464            for (const auto & elem : this->getChildren())
     465                (elem)->updateConfigValues(false);
    466466    }
    467467
  • code/branches/cpp11_v2/src/libraries/core/class/IdentifierManager.cc

    r10768 r10821  
    9393        {
    9494            Context temporaryContext(nullptr);
    95             for (std::set<Identifier*>::const_iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); ++it)
     95            for (auto identifier : this->identifiers_)
    9696            {
    97                 Identifier* identifier = (*it);
     97               
    9898                if (identifier->isInitialized())
    9999                    continue;
     
    127127
    128128        // finish the initialization of all identifiers
    129         for (std::set<Identifier*>::const_iterator it = initializedIdentifiers.begin(); it != initializedIdentifiers.end(); ++it)
    130             (*it)->finishInitialization();
     129        for (const auto & initializedIdentifier : initializedIdentifiers)
     130            (initializedIdentifier)->finishInitialization();
    131131
    132132        // only check class hierarchy in dev mode because it's an expensive operation and it requires a developer to fix detected problems anyway.
     
    144144    {
    145145        // check if there are any uninitialized identifiers remaining
    146         for (std::set<Identifier*>::const_iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); ++it)
    147             if (!(*it)->isInitialized())
    148                 orxout(internal_error) << "Identifier was registered late and is not initialized: " << (*it)->getName() << " / " << (*it)->getTypeInfo().name() << endl;
     146        for (const auto & elem : this->identifiers_)
     147            if (!(elem)->isInitialized())
     148                orxout(internal_error) << "Identifier was registered late and is not initialized: " << (elem)->getName() << " / " << (elem)->getTypeInfo().name() << endl;
    149149
    150150        // for all initialized identifiers, check if a sample instance behaves as expected according to the class hierarchy
    151151        Context temporaryContext(nullptr);
    152         for (std::set<Identifier*>::const_iterator it1 = initializedIdentifiers.begin(); it1 != initializedIdentifiers.end(); ++it1)
     152        for (const auto & initializedIdentifier : initializedIdentifiers)
    153153        {
    154             if (!(*it1)->hasFactory())
     154            if (!(initializedIdentifier)->hasFactory())
    155155                continue;
    156156
    157             Identifiable* temp = (*it1)->fabricate(&temporaryContext);
    158 
    159             for (std::set<Identifier*>::const_iterator it2 = this->identifiers_.begin(); it2 != this->identifiers_.end(); ++it2)
     157            Identifiable* temp = (initializedIdentifier)->fabricate(&temporaryContext);
     158
     159            for (const auto & elem : this->identifiers_)
    160160            {
    161                 bool isA_AccordingToRtti = (*it2)->canDynamicCastObjectToIdentifierClass(temp);
    162                 bool isA_AccordingToClassHierarchy = temp->isA((*it2));
     161                bool isA_AccordingToRtti = (elem)->canDynamicCastObjectToIdentifierClass(temp);
     162                bool isA_AccordingToClassHierarchy = temp->isA((elem));
    163163
    164164                if (isA_AccordingToRtti != isA_AccordingToClassHierarchy)
    165165                {
    166                     orxout(internal_error) << "Class hierarchy does not match RTTI: Class hierarchy claims that " << (*it1)->getName() <<
    167                         (isA_AccordingToClassHierarchy ? " is a " : " is not a ") << (*it2)->getName() << " but RTTI says the opposite." << endl;
     166                    orxout(internal_error) << "Class hierarchy does not match RTTI: Class hierarchy claims that " << (initializedIdentifier)->getName() <<
     167                        (isA_AccordingToClassHierarchy ? " is a " : " is not a ") << (elem)->getName() << " but RTTI says the opposite." << endl;
    168168                }
    169169            }
     
    184184    {
    185185        orxout(internal_status) << "Destroy class-hierarchy" << endl;
    186         for (std::set<Identifier*>::const_iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); ++it)
    187             (*it)->reset();
     186        for (const auto & elem : this->identifiers_)
     187            (elem)->reset();
    188188    }
    189189
     
    260260    {
    261261        // TODO: use std::type_index and a map to find identifiers by type_info (only with c++11)
    262         for (std::set<Identifier*>::iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); ++it)
    263             if ((*it)->getTypeInfo() == typeInfo)
    264                 return (*it);
     262        for (const auto & elem : this->identifiers_)
     263            if ((elem)->getTypeInfo() == typeInfo)
     264                return (elem);
    265265        return nullptr;
    266266    }
  • code/branches/cpp11_v2/src/libraries/core/command/ArgumentCompletionFunctions.cc

    r10769 r10821  
    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 & elem : group)
     80                    if (elem.second->isActive() && elem.second->hasAccess() && (!elem.second->isHidden())^bOnlyShowHidden)
    8181                        return true;
    8282
     
    100100                // get all the groups that are visible (except the shortcut group "")
    101101                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)));
     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)));
    105105
    106106                // now add all shortcuts (in group "")
     
    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 & 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)));
    118118                }
    119119
     
    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 & 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)));
    151151                }
    152152
     
    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 auto & name : names)
     284                sectionList.push_back(ArgumentCompletionListElement(name, getLowercase(name)));
    285285
    286286            return sectionList;
  • code/branches/cpp11_v2/src/libraries/core/command/CommandEvaluation.cc

    r10769 r10821  
    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 & elem : ConsoleCommandManager::getInstance().getCommandsLC())
     309                    if (elem.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 & 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;
    337337                    unsigned int distance = getLevenshteinDistance(command, token0_LC + " " + token1_LC);
    338338                    if (distance < nearestDistance)
     
    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 & elem : it_group->second)
     352            {
     353                std::string command = elem.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 auto & elem : list)
     432            if (elem.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 auto & elem : list)
     498            {
     499                if (elem.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 (elem.hasDisplay())
     503                        return (elem.getString());
    504504                    else
    505                         return (it->getString() + ' ');
     505                        return (elem.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 auto & elem : list)
     520                {
     521                    const std::string& argumentComparable = elem.getComparable();
     522                    const std::string& argument = elem.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 auto & elem : list)
     563        {
     564            output += elem.getDisplay();
    565565
    566566            // add a space character between two elements for all non-empty arguments
    567             if (it->getComparable() != "")
     567            if (elem.getComparable() != "")
    568568                output += ' ';
    569569        }
  • code/branches/cpp11_v2/src/libraries/core/command/ConsoleCommand.cc

    r10768 r10821  
    7575        this->baseFunctor_ = executor->getFunctor();
    7676
    77         for (size_t i = 0; i < MAX_FUNCTOR_ARGUMENTS; ++i)
    78             this->argumentCompleter_[i] = nullptr;
     77        for (auto & elem : this->argumentCompleter_)
     78            elem = nullptr;
    7979
    8080        this->keybindMode_ = KeybindMode::OnPress;
  • code/branches/cpp11_v2/src/libraries/core/command/Shell.cc

    r10624 r10821  
    258258        vectorize(text, '\n', &lines);
    259259
    260         for (size_t i = 0; i < lines.size(); ++i)
    261             this->addLine(lines[i], type);
     260        for (auto & line : lines)
     261            this->addLine(line, type);
    262262    }
    263263
  • code/branches/cpp11_v2/src/libraries/core/command/TclThreadList.h

    r7401 r10821  
    262262        boost::shared_lock<boost::shared_mutex> lock(this->mutex_);
    263263
    264         for (typename std::list<T>::const_iterator it = this->list_.begin(); it != this->list_.end(); ++it)
    265             if (*it == value)
     264        for (const auto & elem : this->list_)
     265            if (elem == value)
    266266                return true;
    267267
  • code/branches/cpp11_v2/src/libraries/core/command/TclThreadManager.cc

    r10775 r10821  
    551551
    552552        std::list<unsigned int> threads;
    553         for (std::map<unsigned int, TclInterpreterBundle*>::const_iterator it = this->interpreterBundles_.begin(); it != this->interpreterBundles_.end(); ++it)
    554             if (it->first > 0 && it->first <= this->numInterpreterBundles_) // only list autonumbered interpreters (created with create()) - exclude the default interpreter 0 and all manually numbered interpreters)
    555                 threads.push_back(it->first);
     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);
    556556        return threads;
    557557    }
  • code/branches/cpp11_v2/src/libraries/core/commandline/CommandLineParser.cc

    r10768 r10821  
    124124            std::string shortcut;
    125125            std::string value;
    126             for (unsigned int i = 0; i < arguments.size(); ++i)
    127             {
    128                 if (arguments[i].size() != 0)
     126            for (auto & argument : arguments)
     127            {
     128                if (argument.size() != 0)
    129129                {
    130130                    // sure not ""
    131                     if (arguments[i][0] == '-')
     131                    if (argument[0] == '-')
    132132                    {
    133133                        // start with "-"
    134                         if (arguments[i].size() == 1)
     134                        if (argument.size() == 1)
    135135                        {
    136136                            // argument[i] is "-", probably a minus sign
    137137                            value += "- ";
    138138                        }
    139                         else if (arguments[i][1] <= 57 && arguments[i][1] >= 48)
     139                        else if (argument[1] <= 57 && argument[1] >= 48)
    140140                        {
    141141                            // negative number as a value
    142                             value += arguments[i] + ' ';
     142                            value += argument + ' ';
    143143                        }
    144144                        else
     
    161161                            }
    162162
    163                             if (arguments[i][1] == '-')
     163                            if (argument[1] == '-')
    164164                            {
    165165                                // full name argument with "--name"
    166                                 name = arguments[i].substr(2);
     166                                name = argument.substr(2);
    167167                            }
    168168                            else
    169169                            {
    170170                                // shortcut with "-s"
    171                                 shortcut = arguments[i].substr(1);
     171                                shortcut = argument.substr(1);
    172172                            }
    173173
     
    186186
    187187                        // Concatenate strings as long as there's no new argument by "-" or "--"
    188                         value += arguments[i] + ' ';
     188                        value += argument + ' ';
    189189                    }
    190190                }
  • code/branches/cpp11_v2/src/libraries/core/config/ConfigFile.cc

    r10817 r10821  
    234234        }
    235235
    236         for (std::list<ConfigFileSection*>::const_iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
    237         {
    238             file << (*it)->getFileEntry() << endl;
    239 
    240             for (std::list<ConfigFileEntry*>::const_iterator it_entries = (*it)->getEntriesBegin(); it_entries != (*it)->getEntriesEnd(); ++it_entries)
     236        for (const auto & elem : this->sections_)
     237        {
     238            file << (elem)->getFileEntry() << endl;
     239
     240            for (std::list<ConfigFileEntry*>::const_iterator it_entries = (elem)->getEntriesBegin(); it_entries != (elem)->getEntriesEnd(); ++it_entries)
    241241                file << (*it_entries)->getFileEntry() << endl;
    242242
     
    280280    ConfigFileSection* ConfigFile::getSection(const std::string& section) const
    281281    {
    282         for (std::list<ConfigFileSection*>::const_iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
    283             if ((*it)->getName() == section)
    284                 return (*it);
     282        for (const auto & elem : this->sections_)
     283            if ((elem)->getName() == section)
     284                return (elem);
    285285        return nullptr;
    286286    }
     
    291291    ConfigFileSection* ConfigFile::getOrCreateSection(const std::string& section)
    292292    {
    293         for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
    294             if ((*it)->getName() == section)
    295                 return (*it);
     293        for (auto & elem : this->sections_)
     294            if ((elem)->getName() == section)
     295                return (elem);
    296296
    297297        this->bUpdated_ = true;
     
    307307        bool sectionsUpdated = false;
    308308
    309         for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
    310         {
    311             if ((*it)->bUpdated_)
     309        for (auto & elem : this->sections_)
     310        {
     311            if ((elem)->bUpdated_)
    312312            {
    313313                sectionsUpdated = true;
    314                 (*it)->bUpdated_ = false;
     314                (elem)->bUpdated_ = false;
    315315            }
    316316        }
  • code/branches/cpp11_v2/src/libraries/core/config/ConfigFileManager.cc

    r10776 r10821  
    5353    ConfigFileManager::~ConfigFileManager()
    5454    {
    55         for (std::array<ConfigFile*, 3>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); ++it)
    56             if (*it)
    57                 delete (*it);
     55        for (const auto & elem : this->configFiles_)
     56            if (elem)
     57                delete (elem);
    5858    }
    5959
  • code/branches/cpp11_v2/src/libraries/core/config/ConfigFileSection.cc

    r10765 r10821  
    8080    {
    8181        unsigned int size = 0;
    82         for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
    83             if ((*it)->getName() == name)
    84                 if ((*it)->getIndex() >= size)
    85                     size = (*it)->getIndex() + 1;
     82        for (const auto & elem : this->entries_)
     83            if ((elem)->getName() == name)
     84                if ((elem)->getIndex() >= size)
     85                    size = (elem)->getIndex() + 1;
    8686        return size;
    8787    }
     
    105105    ConfigFileEntry* ConfigFileSection::getEntry(const std::string& name) const
    106106    {
    107         for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
     107        for (const auto & elem : this->entries_)
    108108        {
    109             if ((*it)->getName() == name)
    110                 return *it;
     109            if ((elem)->getName() == name)
     110                return elem;
    111111        }
    112112        return nullptr;
     
    121121    ConfigFileEntry* ConfigFileSection::getEntry(const std::string& name, unsigned int index) const
    122122    {
    123         for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
     123        for (const auto & elem : this->entries_)
    124124        {
    125             if (((*it)->getName() == name) && ((*it)->getIndex() == index))
    126                 return *it;
     125            if (((elem)->getName() == name) && ((elem)->getIndex() == index))
     126                return elem;
    127127        }
    128128        return nullptr;
  • code/branches/cpp11_v2/src/libraries/core/config/ConfigValueContainer.h

    r10817 r10821  
    130130
    131131                this->value_ = V();
    132                 for (unsigned int i = 0; i < defvalue.size(); i++)
    133                     this->valueVector_.push_back(MultiType(defvalue[i]));
     132                for (auto & elem : defvalue)
     133                    this->valueVector_.push_back(MultiType(elem));
    134134
    135135                this->initVector();
     
    183183                    std::vector<T> temp = *value;
    184184                    value->clear();
    185                     for (unsigned int i = 0; i < this->valueVector_.size(); ++i)
    186                         value->push_back(this->valueVector_[i]);
     185                    for (auto & elem : this->valueVector_)
     186                        value->push_back(elem);
    187187
    188188                    if (value->size() != temp.size())
     
    211211                {
    212212                    value->clear();
    213                     for (unsigned int i = 0; i < this->valueVector_.size(); ++i)
    214                         value->push_back(this->valueVector_[i]);
     213                    for (auto & elem : this->valueVector_)
     214                        value->push_back(elem);
    215215                }
    216216                return *this;
  • code/branches/cpp11_v2/src/libraries/core/input/Button.cc

    r10768 r10821  
    196196
    197197                    // add command to the buffer if not yet existing
    198                     for (unsigned int iParamCmd = 0; iParamCmd < paramCommandBuffer_->size(); iParamCmd++)
    199                     {
    200                         if ((*paramCommandBuffer_)[iParamCmd]->evaluation_.getConsoleCommand()
     198                    for (auto & elem : *paramCommandBuffer_)
     199                    {
     200                        if (elem->evaluation_.getConsoleCommand()
    201201                            == eval.getConsoleCommand())
    202202                        {
    203203                            // already in list
    204                             cmd->paramCommand_ = (*paramCommandBuffer_)[iParamCmd];
     204                            cmd->paramCommand_ = elem;
    205205                            break;
    206206                        }
  • code/branches/cpp11_v2/src/libraries/core/input/InputBuffer.cc

    r9667 r10821  
    110110    void InputBuffer::insert(const std::string& input, bool update)
    111111    {
    112         for (unsigned int i = 0; i < input.size(); ++i)
    113         {
    114             this->insert(input[i], false);
     112        for (auto & elem : input)
     113        {
     114            this->insert(elem, false);
    115115
    116116            if (update)
    117                 this->updated(input[i], false);
     117                this->updated(elem, false);
    118118        }
    119119
     
    170170    void InputBuffer::updated()
    171171    {
    172         for (std::list<BaseInputBufferListenerTuple*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
    173         {
    174             if ((*it)->bListenToAllChanges_)
    175                 (*it)->callFunction();
     172        for (auto & elem : this->listeners_)
     173        {
     174            if ((elem)->bListenToAllChanges_)
     175                (elem)->callFunction();
    176176        }
    177177    }
     
    179179    void InputBuffer::updated(const char& update, bool bSingleInput)
    180180    {
    181         for (std::list<BaseInputBufferListenerTuple*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
    182         {
    183             if ((!(*it)->trueKeyFalseChar_) && ((*it)->bListenToAllChanges_ || ((*it)->char_ == update)) && (!(*it)->bOnlySingleInput_ || bSingleInput))
    184                 (*it)->callFunction();
     181        for (auto & elem : this->listeners_)
     182        {
     183            if ((!(elem)->trueKeyFalseChar_) && ((elem)->bListenToAllChanges_ || ((elem)->char_ == update)) && (!(elem)->bOnlySingleInput_ || bSingleInput))
     184                (elem)->callFunction();
    185185        }
    186186    }
     
    201201            return;
    202202
    203         for (std::list<BaseInputBufferListenerTuple*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
    204         {
    205             if ((*it)->trueKeyFalseChar_ && ((*it)->key_ == evt.getKeyCode()))
    206                 (*it)->callFunction();
     203        for (auto & elem : this->listeners_)
     204        {
     205            if ((elem)->trueKeyFalseChar_ && ((elem)->key_ == evt.getKeyCode()))
     206                (elem)->callFunction();
    207207        }
    208208
  • code/branches/cpp11_v2/src/libraries/core/input/InputDevice.h

    r10817 r10821  
    158158
    159159            // Call all the states with the held button event
    160             for (unsigned int iB = 0; iB < pressedButtons_.size(); ++iB)
    161                 for (unsigned int iS = 0; iS < inputStates_.size(); ++iS)
    162                     inputStates_[iS]->template buttonEvent<ButtonEvent::THold, typename Traits::ButtonTypeParam>(
    163                         this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(pressedButtons_[iB]));
     160            for (auto & button : pressedButtons_)
     161                for (auto & state : inputStates_)
     162                    state->template buttonEvent<ButtonEvent::THold, typename Traits::ButtonTypeParam>(
     163                        this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
    164164
    165165            // Call states with device update events
    166             for (unsigned int i = 0; i < inputStates_.size(); ++i)
    167                 inputStates_[i]->update(time.getDeltaTime(), this->getDeviceID());
     166            for (auto & elem : inputStates_)
     167                elem->update(time.getDeltaTime(), this->getDeviceID());
    168168
    169169            static_cast<DeviceClass*>(this)->updateImpl(time);
     
    196196
    197197            // Call states
    198             for (unsigned int i = 0; i < inputStates_.size(); ++i)
    199                 inputStates_[i]->template buttonEvent<ButtonEvent::TPress, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
     198            for (auto & elem : inputStates_)
     199                elem->template buttonEvent<ButtonEvent::TPress, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
    200200        }
    201201
     
    218218
    219219            // Call states
    220             for (unsigned int i = 0; i < inputStates_.size(); ++i)
    221                 inputStates_[i]->template buttonEvent<ButtonEvent::TRelease, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
     220            for (auto & elem : inputStates_)
     221                elem->template buttonEvent<ButtonEvent::TRelease, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
    222222        }
    223223
  • code/branches/cpp11_v2/src/libraries/core/input/InputManager.cc

    r10778 r10821  
    373373        // check whether a state has changed its EMPTY situation
    374374        bool bUpdateRequired = false;
    375         for (std::map<int, InputState*>::iterator it = activeStates_.begin(); it != activeStates_.end(); ++it)
    376         {
    377             if (it->second->hasExpired())
    378             {
    379                 it->second->resetExpiration();
     375        for (auto & elem : activeStates_)
     376        {
     377            if (elem.second->hasExpired())
     378            {
     379                elem.second->resetExpiration();
    380380                bUpdateRequired = true;
    381381            }
     
    391391
    392392        // Collect function calls for the update
    393         for (unsigned int i = 0; i < activeStatesTicked_.size(); ++i)
    394             activeStatesTicked_[i]->update(time.getDeltaTime());
     393        for (auto & elem : activeStatesTicked_)
     394            elem->update(time.getDeltaTime());
    395395
    396396        // Execute all cached function calls in order
     
    401401        // If we delay the calls, then OIS and and the InputStates are not anymore
    402402        // in the call stack and can therefore be edited.
    403         for (size_t i = 0; i < this->callBuffer_.size(); ++i)
    404             this->callBuffer_[i]();
     403        for (auto & elem : this->callBuffer_)
     404            elem();
    405405
    406406        this->callBuffer_.clear();
     
    437437        // Using an std::set to avoid duplicates
    438438        std::set<InputState*> tempSet;
    439         for (unsigned int i = 0; i < devices_.size(); ++i)
    440             if (devices_[i] != nullptr)
    441                 for (unsigned int iState = 0; iState < devices_[i]->getStateListRef().size(); ++iState)
    442                     tempSet.insert(devices_[i]->getStateListRef()[iState]);
     439        for (auto & elem : devices_)
     440            if (elem != nullptr)
     441                for (unsigned int iState = 0; iState < elem->getStateListRef().size(); ++iState)
     442                    tempSet.insert(elem->getStateListRef()[iState]);
    443443
    444444        // Copy the content of the std::set back to the actual vector
    445445        activeStatesTicked_.clear();
    446         for (std::set<InputState*>::const_iterator it = tempSet.begin();it != tempSet.end(); ++it)
    447             activeStatesTicked_.push_back(*it);
     446        for (const auto & elem : tempSet)
     447            activeStatesTicked_.push_back(elem);
    448448
    449449        // Check whether we have to change the mouse mode
  • code/branches/cpp11_v2/src/libraries/core/input/JoyStick.cc

    r10778 r10821  
    186186    void JoyStick::clearBuffersImpl()
    187187    {
    188         for (int j = 0; j < 4; ++j)
    189             povStates_[j] = 0;
     188        for (auto & elem : povStates_)
     189            elem = 0;
    190190    }
    191191
  • code/branches/cpp11_v2/src/libraries/core/input/KeyBinder.cc

    r10772 r10821  
    153153    void KeyBinder::buttonThresholdChanged()
    154154    {
    155         for (unsigned int i = 0; i < allHalfAxes_.size(); i++)
    156             if (!allHalfAxes_[i]->bButtonThresholdUser_)
    157                 allHalfAxes_[i]->buttonThreshold_ = this->buttonThreshold_;
     155        for (auto & elem : allHalfAxes_)
     156            if (!elem->bButtonThresholdUser_)
     157                elem->buttonThreshold_ = this->buttonThreshold_;
    158158    }
    159159
     
    383383            it->second->clear();
    384384
    385         for (unsigned int i = 0; i < paramCommandBuffer_.size(); i++)
    386             delete paramCommandBuffer_[i];
     385        for (auto & elem : paramCommandBuffer_)
     386            delete elem;
    387387        paramCommandBuffer_.clear();
    388388    }
     
    394394    {
    395395        // iterate over all buttons
    396         for (std::map<std::string, Button*>::iterator it = this->allButtons_.begin(); it != this->allButtons_.end(); ++it)
    397         {
    398             Button* button = it->second;
     396        for (const auto & elem : this->allButtons_)
     397        {
     398            Button* button = elem.second;
    399399
    400400            // iterate over all modes
     
    465465        this->mousePosition_[1] = 0.0f;
    466466
    467         for (unsigned int i = 0; i < MouseAxisCode::numberOfAxes * 2; i++)
    468             mouseAxes_[i].reset();
     467        for (auto & elem : mouseAxes_)
     468            elem.reset();
    469469    }
    470470
     
    505505        }
    506506
    507         for (unsigned int i = 0; i < MouseAxisCode::numberOfAxes * 2; i++)
     507        for (auto & elem : mouseAxes_)
    508508        {
    509509            // Why dividing relative value by dt? The reason lies in the simple fact, that when you
     
    515515            {
    516516                // just ignore if dt == 0.0 because we have multiplied by 0.0 anyway..
    517                 mouseAxes_[i].relVal_ /= dt;
    518             }
    519 
    520             tickHalfAxis(mouseAxes_[i]);
     517                elem.relVal_ /= dt;
     518            }
     519
     520            tickHalfAxis(elem);
    521521        }
    522522    }
  • code/branches/cpp11_v2/src/libraries/core/input/KeyBinder.h

    r10817 r10821  
    226226    {
    227227        // execute all buffered bindings (additional parameter)
    228         for (unsigned int i = 0; i < paramCommandBuffer_.size(); i++)
     228        for (auto & elem : paramCommandBuffer_)
    229229        {
    230             paramCommandBuffer_[i]->rel_ *= dt;
    231             paramCommandBuffer_[i]->execute();
     230            elem->rel_ *= dt;
     231            elem->execute();
    232232        }
    233233
    234234        // always reset the relative movement of the mouse
    235         for (unsigned int i = 0; i < MouseAxisCode::numberOfAxes * 2; i++)
    236             mouseAxes_[i].relVal_ = 0.0f;
     235        for (auto & elem : mouseAxes_)
     236            elem.relVal_ = 0.0f;
    237237    }
    238238}// tolua_export
  • code/branches/cpp11_v2/src/libraries/core/input/Mouse.cc

    r10768 r10821  
    8282            IntVector2 rel(e.state.X.rel, e.state.Y.rel);
    8383            IntVector2 clippingSize(e.state.width, e.state.height);
    84             for (unsigned int i = 0; i < inputStates_.size(); ++i)
    85                 inputStates_[i]->mouseMoved(abs, rel, clippingSize);
     84            for (auto & elem : inputStates_)
     85                elem->mouseMoved(abs, rel, clippingSize);
    8686        }
    8787
     
    8989        if (e.state.Z.rel != 0)
    9090        {
    91             for (unsigned int i = 0; i < inputStates_.size(); ++i)
    92                 inputStates_[i]->mouseScrolled(e.state.Z.abs, e.state.Z.rel);
     91            for (auto & elem : inputStates_)
     92                elem->mouseScrolled(e.state.Z.abs, e.state.Z.rel);
    9393        }
    9494
  • code/branches/cpp11_v2/src/libraries/core/module/DynLibManager.cc

    r10768 r10821  
    7575    {
    7676        // Unload & delete resources in turn
    77         for (DynLibList::iterator it = mLibList.begin(); it != mLibList.end(); ++it)
     77        for (auto & elem : mLibList)
    7878        {
    79             it->second->unload();
    80             delete it->second;
     79            elem.second->unload();
     80            delete elem.second;
    8181        }
    8282
  • code/branches/cpp11_v2/src/libraries/core/module/ModuleInstance.cc

    r10769 r10821  
    5959    {
    6060        const std::set<StaticallyInitializedInstance*>& instances = this->staticallyInitializedInstancesByType_[type];
    61         for (std::set<StaticallyInitializedInstance*>::iterator it = instances.begin(); it != instances.end(); ++it)
    62             (*it)->load();
     61        for (const auto & instance : instances)
     62            (instance)->load();
    6363    }
    6464
     
    7575        std::map<StaticInitialization::Type, std::set<StaticallyInitializedInstance*>> copy(this->staticallyInitializedInstancesByType_);
    7676        this->staticallyInitializedInstancesByType_.clear();
    77         for (std::map<StaticInitialization::Type, std::set<StaticallyInitializedInstance*>>::iterator it1 = copy.begin(); it1 != copy.end(); ++it1)
    78             for (std::set<StaticallyInitializedInstance*>::iterator it2 = it1->second.begin(); it2 != it1->second.end(); ++it2)
     77        for (auto & elem : copy)
     78            for (std::set<StaticallyInitializedInstance*>::iterator it2 = elem.second.begin(); it2 != elem.second.end(); ++it2)
    7979                delete (*it2);
    8080    }
  • code/branches/cpp11_v2/src/libraries/core/module/PluginManager.cc

    r10768 r10821  
    5959        ModifyConsoleCommand("PluginManager", __CC_PluginManager_unload_name).setObject(nullptr);
    6060
    61         for (std::map<std::string, PluginReference*>::iterator it = this->references_.begin(); it != this->references_.end(); ++it)
    62             delete it->second;
    63         for (std::map<std::string, Plugin*>::iterator it = this->plugins_.begin(); it != this->plugins_.end(); ++it)
    64             delete it->second;
     61        for (auto & elem : this->references_)
     62            delete elem.second;
     63        for (auto & elem : this->plugins_)
     64            delete elem.second;
    6565    }
    6666
     
    6868    {
    6969        const std::vector<std::string>& pluginPaths = ApplicationPaths::getInstance().getPluginPaths();
    70         for (std::vector<std::string>::const_iterator it = pluginPaths.begin(); it != pluginPaths.end(); ++it)
     70        for (auto libraryName : pluginPaths)
    7171        {
    7272            std::string name;
    73             std::string libraryName = (*it);
     73           
    7474            std::string filename = libraryName +  + specialConfig::pluginExtension;
    7575            std::ifstream infile(filename.c_str());
  • code/branches/cpp11_v2/src/libraries/core/module/StaticInitializationManager.cc

    r10768 r10821  
    5050    {
    5151        // attention: loading a module may add new handlers to the list
    52         for (std::list<StaticInitializationHandler*>::iterator it = this->handlers_.begin(); it != this->handlers_.end(); ++it)
    53             (*it)->loadModule(module);
     52        for (auto & elem : this->handlers_)
     53            (elem)->loadModule(module);
    5454    }
    5555
  • code/branches/cpp11_v2/src/libraries/core/object/Context.cc

    r10768 r10821  
    7070        // unregister context from object lists before object lists are destroyed
    7171        this->unregisterObject();
    72         for (size_t i = 0; i < this->objectLists_.size(); ++i)
    73             delete this->objectLists_[i];
     72        for (auto & elem : this->objectLists_)
     73            delete elem;
    7474    }
    7575
  • code/branches/cpp11_v2/src/libraries/core/object/Listable.cc

    r10624 r10821  
    7676    void Listable::unregisterObject()
    7777    {
    78         for (size_t i = 0; i < this->elements_.size(); ++i)
    79             Listable::deleteObjectListElement(this->elements_[i]);
     78        for (auto & elem : this->elements_)
     79            Listable::deleteObjectListElement(elem);
    8080        this->elements_.clear();
    8181    }
     
    9191        this->elements_.clear();
    9292
    93         for (size_t i = 0; i < copy.size(); ++i)
     93        for (auto & elem : copy)
    9494        {
    95             copy[i]->changeContext(this->context_, context);
    96             Listable::deleteObjectListElement(copy[i]);
     95            elem->changeContext(this->context_, context);
     96            Listable::deleteObjectListElement(elem);
    9797        }
    9898
  • code/branches/cpp11_v2/src/libraries/core/object/ObjectListBase.cc

    r10768 r10821  
    9292    void ObjectListBase::notifyRemovalListeners(ObjectListBaseElement* element) const
    9393    {
    94         for (std::vector<ObjectListElementRemovalListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
    95             (*it)->removedElement(element);
     94        for (const auto & elem : this->listeners_)
     95            (elem)->removedElement(element);
    9696    }
    9797
  • code/branches/cpp11_v2/src/libraries/core/singleton/ScopeManager.cc

    r10768 r10821  
    7373    void ScopeManager::activateListenersForScope(ScopeID::Value scope)
    7474    {
    75         for (std::set<ScopeListener*>::iterator it = this->listeners_[scope].begin(); it != this->listeners_[scope].end(); ++it)
    76             this->activateListener(*it);
     75        for (const auto & elem : this->listeners_[scope])
     76            this->activateListener(elem);
    7777    }
    7878
    7979    void ScopeManager::deactivateListenersForScope(ScopeID::Value scope)
    8080    {
    81         for (std::set<ScopeListener*>::iterator it = this->listeners_[scope].begin(); it != this->listeners_[scope].end(); ++it)
    82             this->deactivateListener(*it);
     81        for (const auto & elem : this->listeners_[scope])
     82            this->deactivateListener(elem);
    8383    }
    8484
Note: See TracChangeset for help on using the changeset viewer.