Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 5, 2015, 10:47:51 PM (9 years ago)
Author:
landauf
Message:

use range-based for-loop where it makes sense (e.g. ObjectList)

Location:
code/branches/cpp11_v2/src/libraries/core
Files:
25 edited

Legend:

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

    r10916 r10919  
    163163        this->setName(name);
    164164
    165         for (ObjectList<XMLNameListener>::iterator it = ObjectList<XMLNameListener>::begin(); it != ObjectList<XMLNameListener>::end(); ++it)
    166             it->loadedNewXMLName(this);
     165        for (XMLNameListener* listener : ObjectList<XMLNameListener>())
     166            listener->loadedNewXMLName(this);
    167167    }
    168168
  • code/branches/cpp11_v2/src/libraries/core/ClassTreeMask.cc

    r10916 r10919  
    915915
    916916            // Iterate through all subnodes
    917             for (std::list<ClassTreeMaskNode*>::iterator it1 = node->subnodes_.begin(); it1 != node->subnodes_.end(); ++it1)
     917            for (ClassTreeMaskNode* subnode : node->subnodes_)
    918918            {
    919919                // Recursive call to this function with the subnode
    920                 this->create(*it1);
     920                this->create(subnode);
    921921
    922922                // Only execute the following code if the current node is included, meaning some of the subnodes might be included too
     
    926926
    927927                    // Iterate through all direct children
    928                     for (std::set<const Identifier*>::iterator it2 = directChildren.begin(); it2 != directChildren.end(); ++it2)
     928                    for (std::set<const Identifier*>::iterator it = directChildren.begin(); it != directChildren.end(); ++it)
    929929                    {
    930930                        // Check if the subnode (it1) is a child of the directChild (it2)
    931                         if ((*it1)->getClass()->isA(*it2))
     931                        if (subnode->getClass()->isA(*it))
    932932                        {
    933933                            // Yes it is - remove the directChild (it2) from the list, because it will already be handled by a recursive call to the create() function
    934                             directChildren.erase(it2);
     934                            directChildren.erase(it);
    935935
    936936                            // Check if the removed directChild was exactly the subnode
    937                             if (!(*it1)->getClass()->isExactlyA(*it2))
     937                            if (!subnode->getClass()->isExactlyA(*it))
    938938                            {
    939939                                // No, it wasn't exactly the subnode - therefore there are some classes between
    940940
    941941                                // Add the previously removed directChild (it2) to the subclass-list
    942                                 this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(*it2, true));
     942                                this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(*it, true));
    943943
    944944                                // Insert all directChildren of the directChild
    945                                 directChildren.insert((*it2)->getDirectChildren().begin(), (*it2)->getDirectChildren().end());
     945                                directChildren.insert((*it)->getDirectChildren().begin(), (*it)->getDirectChildren().end());
    946946
    947947                                // Restart the scan with the expanded set of directChildren
  • code/branches/cpp11_v2/src/libraries/core/Core.cc

    r10916 r10919  
    460460    {
    461461        // Update UpdateListeners before general ticking
    462         for (ObjectList<UpdateListener>::iterator it = ObjectList<UpdateListener>::begin(); it != ObjectList<UpdateListener>::end(); ++it)
    463             it->preUpdate(time);
     462        for (UpdateListener* listener : ObjectList<UpdateListener>())
     463            listener->preUpdate(time);
    464464        if (this->bGraphicsLoaded_)
    465465        {
     
    479479    {
    480480        // Update UpdateListeners just before rendering
    481         for (ObjectList<UpdateListener>::iterator it = ObjectList<UpdateListener>::begin(); it != ObjectList<UpdateListener>::end(); ++it)
    482             it->postUpdate(time);
     481        for (UpdateListener* listener : ObjectList<UpdateListener>())
     482            listener->postUpdate(time);
    483483        if (this->bGraphicsLoaded_)
    484484        {
  • code/branches/cpp11_v2/src/libraries/core/CoreConfig.cc

    r10813 r10919  
    108108    {
    109109        // Inform listeners
    110         ObjectList<DevModeListener>::iterator it = ObjectList<DevModeListener>::begin();
    111         for (; it != ObjectList<DevModeListener>::end(); ++it)
    112             it->devModeChanged(bDevMode_);
     110        for (DevModeListener* listener : ObjectList<DevModeListener>())
     111            listener->devModeChanged(bDevMode_);
    113112    }
    114113
  • code/branches/cpp11_v2/src/libraries/core/CoreStaticInitializationHandler.cc

    r10916 r10919  
    129129            {
    130130                // iterate over all contexts
    131                 for (ObjectList<Context>::iterator it_context = ObjectList<Context>::begin(); it_context != ObjectList<Context>::end(); ++it_context)
    132                     it_context->destroyObjectList(identifier);
     131                for (Context* context : ObjectList<Context>())
     132                    context->destroyObjectList(identifier);
    133133            }
    134134        }
  • code/branches/cpp11_v2/src/libraries/core/Game.cc

    r10918 r10919  
    115115
    116116        // After the core has been created, we can safely instantiate the GameStates that don't require graphics
    117         for (std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.begin();
    118             it != gameStateDeclarations_s.end(); ++it)
    119         {
    120             if (!it->second.bGraphicsMode)
    121                 constructedStates_[it->second.stateName] = GameStateFactory::fabricate(it->second);
     117        for (const auto& mapEntry : gameStateDeclarations_s)
     118        {
     119            if (!mapEntry.second.bGraphicsMode)
     120                constructedStates_[mapEntry.second.stateName] = GameStateFactory::fabricate(mapEntry.second);
    122121        }
    123122
     
    262261    {
    263262        // Note: The first element is the empty root state, which doesn't need ticking
    264         for (GameStateVector::const_iterator it = this->loadedStates_.begin() + 1;
    265             it != this->loadedStates_.end(); ++it)
     263        for (const std::shared_ptr<GameState>& state : this->loadedStates_)
    266264        {
    267265            try
     
    269267                // Add tick time for most of the states
    270268                uint64_t timeBeforeTick = 0;
    271                 if ((*it)->getInfo().bIgnoreTickTime)
     269                if (state->getInfo().bIgnoreTickTime)
    272270                    timeBeforeTick = this->gameClock_->getRealMicroseconds();
    273                 (*it)->update(*this->gameClock_);
    274                 if ((*it)->getInfo().bIgnoreTickTime)
     271                state->update(*this->gameClock_);
     272                if (state->getInfo().bIgnoreTickTime)
    275273                    this->subtractTickTime(static_cast<int32_t>(this->gameClock_->getRealMicroseconds() - timeBeforeTick));
    276274            }
    277275            catch (...)
    278276            {
    279                 orxout(user_error) << "An exception occurred while updating '" << (*it)->getName() << "': " << Exception::handleMessage() << endl;
     277                orxout(user_error) << "An exception occurred while updating '" << state->getName() << "': " << Exception::handleMessage() << endl;
    280278                orxout(user_error) << "This should really never happen!" << endl;
    281279                orxout(user_error) << "Unloading all GameStates depending on the one that crashed." << endl;
    282280                std::shared_ptr<GameStateTreeNode> current = this->loadedTopStateNode_;
    283                 while (current->name_ != (*it)->getName() && current)
     281                while (current->name_ != state->getName() && current)
    284282                    current = current->parent_.lock();
    285283                if (current && current->parent_.lock())
     
    520518
    521519            // Construct all the GameStates that require graphics
    522             for (std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.begin();
    523                 it != gameStateDeclarations_s.end(); ++it)
    524             {
    525                 if (it->second.bGraphicsMode)
     520            for (const auto& mapEntry : gameStateDeclarations_s)
     521            {
     522                if (mapEntry.second.bGraphicsMode)
    526523                {
    527524                    // Game state loading failure is serious --> don't catch
    528                     std::shared_ptr<GameState> gameState = GameStateFactory::fabricate(it->second);
     525                    std::shared_ptr<GameState> gameState = GameStateFactory::fabricate(mapEntry.second);
    529526                    if (!constructedStates_.insert(std::make_pair(
    530                         it->second.stateName, gameState)).second)
     527                        mapEntry.second.stateName, gameState)).second)
    531528                        assert(false); // GameState was already created!
    532529                }
  • code/branches/cpp11_v2/src/libraries/core/GraphicsManager.cc

    r10845 r10919  
    389389        GUIManager::getInstance().setCamera(camera);
    390390
    391         for (ObjectList<ViewportEventListener>::iterator it = ObjectList<ViewportEventListener>::begin(); it != ObjectList<ViewportEventListener>::end(); ++it)
    392             it->cameraChanged(this->viewport_, oldCamera);
     391        for (ViewportEventListener* listener : ObjectList<ViewportEventListener>())
     392            listener->cameraChanged(this->viewport_, oldCamera);
    393393    }
    394394
  • code/branches/cpp11_v2/src/libraries/core/NamespaceNode.cc

    r10917 r10919  
    149149
    150150            int i = 0;
    151             for (std::map<std::string, NamespaceNode*>::const_iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); i++, ++it)
     151            for (const auto& mapEntry : this->subnodes_)
    152152            {
    153153                if (i > 0)
    154154                    output += ", ";
    155155
    156                 output += it->second->toString();
     156                output += mapEntry.second->toString();
     157                i++;
    157158            }
    158159
  • code/branches/cpp11_v2/src/libraries/core/ThreadPool.cc

    r8394 r10919  
    8383    bool ThreadPool::passFunction( const ExecutorPtr& executor, bool addThread )
    8484    {
    85         std::vector<Thread*>::iterator it;
    86         for ( it=this->threadPool_.begin(); it!=this->threadPool_.end(); ++it )
     85        for ( Thread* thread : threadPool_ )
    8786        {
    88             if ( ! (*it)->isWorking() )
     87            if ( ! thread->isWorking() )
    8988            {
    9089                // If that fails, then there is some code error
    91                 OrxVerify( (*it)->evaluateExecutor( executor ), "ERROR: could not evaluate Executor" );
     90                OrxVerify( thread->evaluateExecutor( executor ), "ERROR: could not evaluate Executor" );
    9291                return true;
    9392            }
     
    105104    void ThreadPool::synchronise()
    106105    {
    107         std::vector<Thread*>::iterator it;
    108         for ( it=this->threadPool_.begin(); it!=this->threadPool_.end(); ++it )
     106        for ( Thread* thread : this->threadPool_ )
    109107        {
    110             (*it)->waitUntilFinished();
     108            thread->waitUntilFinished();
    111109        }
    112110    }
  • code/branches/cpp11_v2/src/libraries/core/WindowEventListener.cc

    r10624 r10919  
    4545    /*static*/ void WindowEventListener::moveWindow()
    4646    {
    47         for (ObjectList<WindowEventListener>::iterator it = ObjectList<WindowEventListener>::begin(); it; ++it)
    48             it->windowMoved();
     47        for (WindowEventListener* listener : ObjectList<WindowEventListener>())
     48            listener->windowMoved();
    4949    }
    5050
     
    5454        windowWidth_s = newWidth;
    5555        windowHeight_s = newHeight;
    56         for (ObjectList<WindowEventListener>::iterator it = ObjectList<WindowEventListener>::begin(); it; ++it)
    57             it->windowResized(newWidth, newHeight);
     56        for (WindowEventListener* listener : ObjectList<WindowEventListener>())
     57            listener->windowResized(newWidth, newHeight);
    5858    }
    5959
     
    6161    /*static*/ void WindowEventListener::changeWindowFocus(bool bFocus)
    6262    {
    63         for (ObjectList<WindowEventListener>::iterator it = ObjectList<WindowEventListener>::begin(); it; ++it)
    64             it->windowFocusChanged(bFocus);
     63        for (WindowEventListener* listener : ObjectList<WindowEventListener>())
     64            listener->windowFocusChanged(bFocus);
    6565    }
    6666}
  • code/branches/cpp11_v2/src/libraries/core/class/Identifier.cc

    r10917 r10919  
    7979            delete this->factory_;
    8080
    81         for (std::list<const InheritsFrom*>::const_iterator it = this->manualDirectParents_.begin(); it != this->manualDirectParents_.end(); ++it)
    82             delete (*it);
     81        for (const InheritsFrom* manualDirectParent : this->manualDirectParents_)
     82            delete manualDirectParent;
    8383
    8484        // erase this Identifier from all related identifiers
    85         for (std::list<const Identifier*>::const_iterator it = this->parents_.begin(); it != this->parents_.end(); ++it)
    86             const_cast<Identifier*>(*it)->children_.erase(this);
    87         for (std::list<const Identifier*>::const_iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it)
    88             const_cast<Identifier*>(*it)->directChildren_.erase(this);
     85        for (const Identifier* parent : this->parents_)
     86            const_cast<Identifier*>(parent)->children_.erase(this);
     87        for (const Identifier* directParent : this->directParents_)
     88            const_cast<Identifier*>(directParent)->directChildren_.erase(this);
    8989        for (const Identifier* child : this->children_)
    9090            const_cast<Identifier*>(child)->parents_.remove(this);
     
    184184
    185185            // initialize all parents
    186             for (std::list<const Identifier*>::const_iterator it = this->parents_.begin(); it != this->parents_.end(); ++it)
    187                 const_cast<Identifier*>(*it)->finishInitialization(); // initialize parent
     186            for (const Identifier* parent : this->parents_)
     187                const_cast<Identifier*>(parent)->finishInitialization(); // initialize parent
    188188
    189189            // parents of parents are no direct parents of this identifier
    190190            this->directParents_ = this->parents_;
    191             for (std::list<const Identifier*>::const_iterator it_parent = this->parents_.begin(); it_parent != this->parents_.end(); ++it_parent)
    192                 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)
    193                     this->directParents_.remove(*it_parent_parent);
     191            for (const Identifier* parent : this->parents_)
     192                for (const Identifier* parent_parent : const_cast<Identifier*>(parent)->parents_)
     193                    this->directParents_.remove(parent_parent);
    194194
    195195            this->verifyIdentifierTrace();
     
    200200
    201201            // initialize all direct parents
    202             for (std::list<const InheritsFrom*>::const_iterator it = this->manualDirectParents_.begin(); it != this->manualDirectParents_.end(); ++it)
     202            for (const InheritsFrom* manualDirectParent : this->manualDirectParents_)
    203203            {
    204                 Identifier* directParent = (*it)->getParent();
     204                Identifier* directParent = manualDirectParent->getParent();
    205205                this->directParents_.push_back(directParent);
    206206                directParent->finishInitialization(); // initialize parent
     
    208208
    209209            // direct parents and their parents are also parents of this identifier (but only add them once)
    210             for (std::list<const Identifier*>::const_iterator it_parent = this->directParents_.begin(); it_parent != this->directParents_.end(); ++it_parent)
     210            for (const Identifier* parent : this->directParents_)
    211211            {
    212                 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)
    213                     this->addIfNotExists(this->parents_, *it_parent_parent);
    214                 this->addIfNotExists(this->parents_, *it_parent);
     212                for (const Identifier* parent_parent : const_cast<Identifier*>(parent)->parents_)
     213                    this->addIfNotExists(this->parents_, parent_parent);
     214                this->addIfNotExists(this->parents_, parent);
    215215            }
    216216        }
     
    224224
    225225        // tell all parents that this identifier is a child
    226         for (std::list<const Identifier*>::const_iterator it = this->parents_.begin(); it != this->parents_.end(); ++it)
    227             const_cast<Identifier*>(*it)->children_.insert(this);
     226        for (const Identifier* parent : this->parents_)
     227            const_cast<Identifier*>(parent)->children_.insert(this);
    228228
    229229        // tell all direct parents that this identifier is a direct child
    230         for (std::list<const Identifier*>::const_iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it)
    231         {
    232             const_cast<Identifier*>(*it)->directChildren_.insert(this);
     230        for (const Identifier* directChild : this->directParents_)
     231        {
     232            const_cast<Identifier*>(directChild)->directChildren_.insert(this);
    233233
    234234            // Create the super-function dependencies
    235             (*it)->createSuperFunctionCaller();
     235            directChild->createSuperFunctionCaller();
    236236        }
    237237
     
    265265            if (parent->isVirtualBase())
    266266            {
    267                 for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(parent)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(parent)->parents_.end(); ++it_parent_parent)
    268                     this->addIfNotExists(expectedIdentifierTrace, *it_parent_parent);
     267                for (const Identifier* parent_parent : const_cast<Identifier*>(parent)->parents_)
     268                    this->addIfNotExists(expectedIdentifierTrace, parent_parent);
    269269                this->addIfNotExists(expectedIdentifierTrace, parent);
    270270            }
     
    274274        for (const Identifier* directParent : this->directParents_)
    275275        {
    276             for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(directParent)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(directParent)->parents_.end(); ++it_parent_parent)
    277                 this->addIfNotExists(expectedIdentifierTrace, *it_parent_parent);
     276            for (const Identifier* parent_parent : const_cast<Identifier*>(directParent)->parents_)
     277                this->addIfNotExists(expectedIdentifierTrace, parent_parent);
    278278            this->addIfNotExists(expectedIdentifierTrace, directParent);
    279279        }
     
    290290
    291291            orxout(internal_warning) << "  Expected trace (according to class hierarchy definitions):" << endl << "    ";
    292             for (std::list<const Identifier*>::const_iterator it_parent = expectedIdentifierTrace.begin(); it_parent != expectedIdentifierTrace.end(); ++it_parent)
    293                 orxout(internal_warning) << " " << (*it_parent)->getName();
     292            for (const Identifier* parent : expectedIdentifierTrace)
     293                orxout(internal_warning) << " " << parent->getName();
    294294            orxout(internal_warning) << endl;
    295295
  • code/branches/cpp11_v2/src/libraries/core/class/Identifier.h

    r10918 r10919  
    458458            return;
    459459
    460         for (ObjectListIterator<T> it = ObjectList<T>::begin(); it; ++it)
    461             this->setConfigValues(*it, *it);
     460        for (T* object : ObjectList<T>())
     461            this->setConfigValues(object, object);
    462462
    463463        if (updateChildren)
  • code/branches/cpp11_v2/src/libraries/core/class/Super.h

    r10817 r10919  
    103103            { \
    104104                ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier(); \
    105                 for (std::set<const Identifier*>::iterator it = identifier->getDirectChildren().begin(); it != identifier->getDirectChildren().end(); ++it) \
     105                for (const Identifier* child : identifier->getDirectChildren()) \
    106106                { \
    107                     if (((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_) \
     107                    if (((ClassIdentifier<T>*)child)->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_) \
    108108                    { \
    109                         delete ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_; \
    110                         ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = nullptr; \
    111                         ((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ = false; \
     109                        delete ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_; \
     110                        ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_ = nullptr; \
     111                        ((ClassIdentifier<T>*)child)->bSuperFunctionCaller_##functionname##_isFallback_ = false; \
    112112                    } \
    113113                    \
    114                     if (!((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_) \
     114                    if (!((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_) \
    115115                    { \
    116                         orxout(verbose, context::super) << "Added SuperFunctionCaller for " << #functionname << ": " << ClassIdentifier<T>::getIdentifier()->getName() << " <- " << ((ClassIdentifier<T>*)(*it))->getName() << endl; \
    117                         ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>; \
     116                        orxout(verbose, context::super) << "Added SuperFunctionCaller for " << #functionname << ": " << ClassIdentifier<T>::getIdentifier()->getName() << " <- " << ((ClassIdentifier<T>*)child)->getName() << endl; \
     117                        ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>; \
    118118                    } \
    119                     else if (((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier() != ClassIdentifier<T>::getIdentifier()) \
    120                         orxout(internal_warning, context::super) << "SuperFunctionCaller for " << #functionname << " in " << ((ClassIdentifier<T>*)(*it))->getName() << " calls function of " << ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier()->getName() << " but " << ClassIdentifier<T>::getIdentifier()->getName() << " is also possible (do you use multiple inheritance?)" << endl; \
     119                    else if (((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_->getParentIdentifier() != ClassIdentifier<T>::getIdentifier()) \
     120                        orxout(internal_warning, context::super) << "SuperFunctionCaller for " << #functionname << " in " << ((ClassIdentifier<T>*)child)->getName() << " calls function of " << ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_->getParentIdentifier()->getName() << " but " << ClassIdentifier<T>::getIdentifier()->getName() << " is also possible (do you use multiple inheritance?)" << endl; \
    121121                } \
    122122            } \
     
    171171
    172172                // Iterate through all children
    173                 for (std::set<const Identifier*>::iterator it = identifier->getDirectChildren().begin(); it != identifier->getDirectChildren().end(); ++it)
     173                for (const Identifier* child : identifier->getDirectChildren())
    174174                {
    175175                    // Check if the caller is a fallback-caller
    176                     if (((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_)
     176                    if (((ClassIdentifier<T>*)child)->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_)
    177177                    {
    178178                        // Delete the fallback caller an prepare to get a real caller
    179                         delete ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_;
    180                         ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = nullptr;
    181                         ((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ = false;
     179                        delete ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_;
     180                        ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_ = nullptr;
     181                        ((ClassIdentifier<T>*)child)->bSuperFunctionCaller_##functionname##_isFallback_ = false;
    182182                    }
    183183
    184184                    // Check if there's not already a caller
    185                     if (!((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_)
     185                    if (!((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_)
    186186                    {
    187187                        // Add the SuperFunctionCaller
    188                         orxout(verbose, context::super) << "adding functionpointer to " << ((ClassIdentifier<T>*)(*it))->getName() << endl;
    189                         ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>;
     188                        orxout(verbose, context::super) << "adding functionpointer to " << ((ClassIdentifier<T>*)child)->getName() << endl;
     189                        ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>;
    190190                    }
    191191
    192192                    // If there is already a caller, but for another parent, print a warning
    193                     else if (((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier() != ClassIdentifier<T>::getIdentifier())
    194                         orxout(internal_warning, context::super) << "SuperFunctionCaller for " << #functionname << " in " << ((ClassIdentifier<T>*)(*it))->getName() << " calls function of " << ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier()->getName() << " but " << ClassIdentifier<T>::getIdentifier()->getName() << " is also possible (do you use multiple inheritance?)" << endl;
     193                    else if (((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_->getParentIdentifier() != ClassIdentifier<T>::getIdentifier())
     194                        orxout(internal_warning, context::super) << "SuperFunctionCaller for " << #functionname << " in " << ((ClassIdentifier<T>*)child)->getName() << " calls function of " << ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_->getParentIdentifier()->getName() << " but " << ClassIdentifier<T>::getIdentifier()->getName() << " is also possible (do you use multiple inheritance?)" << endl;
    195195                }
    196196            }
  • code/branches/cpp11_v2/src/libraries/core/command/ArgumentCompletionFunctions.cc

    r10918 r10919  
    334334            ArgumentCompletionList threads;
    335335
    336             for (std::list<unsigned int>::const_iterator it = threadnumbers.begin(); it != threadnumbers.end(); ++it)
    337                 threads.emplace_back(multi_cast<std::string>(*it));
     336            for (unsigned int threadnumber : threadnumbers)
     337                threads.emplace_back(multi_cast<std::string>(threadnumber));
    338338
    339339            return threads;
  • code/branches/cpp11_v2/src/libraries/core/command/CommandEvaluation.cc

    r10916 r10919  
    328328
    329329        // iterate through all groups and their commands and calculate the distance to the current command. keep the best.
    330         for (const auto& mapEntry : ConsoleCommandManager::getInstance().getCommandsLC())
    331         {
    332             if (mapEntry.first != "")
    333             {
    334                 for (std::map<std::string, ConsoleCommand*>::const_iterator it_name = mapEntry.second.begin(); it_name != mapEntry.second.end(); ++it_name)
    335                 {
    336                     std::string command = mapEntry.first + " " + it_name->first;
     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)
  • code/branches/cpp11_v2/src/libraries/core/command/TclThreadManager.cc

    r10916 r10919  
    145145            {
    146146                boost::shared_lock<boost::shared_mutex> lock(*this->interpreterBundlesMutex_);
    147                 for (std::map<unsigned int, TclInterpreterBundle*>::const_iterator it = this->interpreterBundles_.begin(); it != this->interpreterBundles_.end(); ++it)
     147                for (const auto& mapEntry : this->interpreterBundles_)
    148148                {
    149                     if (it->first == 0)
     149                    if (mapEntry.first == 0)
    150150                        continue; // We'll handle the default interpreter later (and without threads of course)
    151151
    152                     TclInterpreterBundle* bundle = it->second;
     152                    TclInterpreterBundle* bundle = mapEntry.second;
    153153                    if (!bundle->queue_.empty())
    154154                    {
  • code/branches/cpp11_v2/src/libraries/core/commandline/CommandLineParser.cc

    r10916 r10919  
    110110            {
    111111                // first shove all the shortcuts in a map
    112                 for (std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.begin();
    113                     it != cmdLineArgs_.end(); ++it)
     112                for (const auto& mapEntry : cmdLineArgs_)
    114113                {
    115                     OrxAssert(cmdLineArgsShortcut_.find(it->second->getShortcut()) == cmdLineArgsShortcut_.end(),
     114                    OrxAssert(cmdLineArgsShortcut_.find(mapEntry.second->getShortcut()) == cmdLineArgsShortcut_.end(),
    116115                        "Cannot have two command line shortcut with the same name.");
    117                     if (!it->second->getShortcut().empty())
    118                         cmdLineArgsShortcut_[it->second->getShortcut()] = it->second;
     116                    if (!mapEntry.second->getShortcut().empty())
     117                        cmdLineArgsShortcut_[mapEntry.second->getShortcut()] = mapEntry.second;
    119118                }
    120119                bFirstTimeParse_ = false;
     
    257256        // determine maximum name size
    258257        size_t maxNameSize = 0;
    259         for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin();
    260             it != inst.cmdLineArgs_.end(); ++it)
    261         {
    262             maxNameSize = std::max(it->second->getName().size(), maxNameSize);
     258        for (const auto& mapEntry : inst.cmdLineArgs_)
     259        {
     260            maxNameSize = std::max(mapEntry.second->getName().size(), maxNameSize);
    263261        }
    264262
     
    267265        infoStr << "Available options:" << endl;
    268266
    269         for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin();
    270             it != inst.cmdLineArgs_.end(); ++it)
    271         {
    272             if (!it->second->getShortcut().empty())
    273                 infoStr << " [-" << it->second->getShortcut() << "] ";
     267        for (const auto& mapEntry : inst.cmdLineArgs_)
     268        {
     269            if (!mapEntry.second->getShortcut().empty())
     270                infoStr << " [-" << mapEntry.second->getShortcut() << "] ";
    274271            else
    275272                infoStr << "      ";
    276             infoStr << "--" << it->second->getName() << ' ';
    277             if (it->second->getValue().isType<bool>())
     273            infoStr << "--" << mapEntry.second->getName() << ' ';
     274            if (mapEntry.second->getValue().isType<bool>())
    278275                infoStr << "    ";
    279276            else
    280277                infoStr << "ARG ";
    281278            // fill with the necessary amount of blanks
    282             infoStr << std::string(maxNameSize - it->second->getName().size(), ' ');
    283             infoStr << ": " << it->second->getInformation();
     279            infoStr << std::string(maxNameSize - mapEntry.second->getName().size(), ' ');
     280            infoStr << ": " << mapEntry.second->getInformation();
    284281            infoStr << endl;
    285282        }
  • code/branches/cpp11_v2/src/libraries/core/config/SettingsConfigFile.cc

    r10768 r10919  
    142142        // todo: can this be done more efficiently? looks like some identifiers will be updated multiple times.
    143143
    144         for (ContainerMap::const_iterator it = this->containers_.begin(); it != this->containers_.end(); ++it)
    145         {
    146             it->second.second->update();
    147             it->second.second->getIdentifier()->updateConfigValues();
     144        for (const auto& mapEntry : this->containers_)
     145        {
     146            mapEntry.second.second->update();
     147            mapEntry.second.second->getIdentifier()->updateConfigValues();
    148148        }
    149149    }
  • code/branches/cpp11_v2/src/libraries/core/input/InputBuffer.cc

    r10916 r10919  
    7575    InputBuffer::~InputBuffer()
    7676    {
    77         for (std::list<BaseInputBufferListenerTuple*>::const_iterator it = this->listeners_.begin();
    78             it != this->listeners_.end(); ++it)
    79             delete *it;
     77        for (BaseInputBufferListenerTuple* listener : this->listeners_)
     78            delete listener;
    8079    }
    8180
  • code/branches/cpp11_v2/src/libraries/core/input/InputManager.cc

    r10917 r10919  
    531531            {
    532532                // Make sure we don't add two high priority states with the same priority
    533                 for (std::map<std::string, InputState*>::const_iterator it = this->statesByName_.begin();
    534                     it != this->statesByName_.end(); ++it)
     533                for (const auto& mapEntry : this->statesByName_)
    535534                {
    536                     if (it->second->getPriority() == priority)
     535                    if (mapEntry.second->getPriority() == priority)
    537536                    {
    538537                        orxout(internal_warning, context::input) << "Could not add an InputState with the same priority '"
  • code/branches/cpp11_v2/src/libraries/core/input/JoyStickQuantityListener.cc

    r10624 r10919  
    4747    {
    4848        joyStickList_s = joyStickList;
    49         for (ObjectList<JoyStickQuantityListener>::iterator it = ObjectList<JoyStickQuantityListener>::begin(); it; ++it)
    50             it->JoyStickQuantityChanged(joyStickList);
     49        for (JoyStickQuantityListener* listener : ObjectList<JoyStickQuantityListener>())
     50            listener->JoyStickQuantityChanged(joyStickList);
    5151    }
    5252}
  • code/branches/cpp11_v2/src/libraries/core/input/KeyBinder.cc

    r10918 r10919  
    274274
    275275        // Parse bindings and create the ConfigValueContainers if necessary
    276         for (std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it)
    277         {
    278             it->second->readBinding(this->configFile_, this->fallbackConfigFile_);
    279             addButtonToCommand(it->second->bindingString_, it->second);
     276        for (const auto& mapEntry : allButtons_)
     277        {
     278            mapEntry.second->readBinding(this->configFile_, this->fallbackConfigFile_);
     279            addButtonToCommand(mapEntry.second->bindingString_, mapEntry.second);
    280280        }
    281281
     
    380380    void KeyBinder::clearBindings()
    381381    {
    382         for (std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it)
    383             it->second->clear();
     382        for (const auto& mapEntry : allButtons_)
     383            mapEntry.second->clear();
    384384
    385385        for (BufferedParamCommand* command : paramCommandBuffer_)
  • code/branches/cpp11_v2/src/libraries/core/input/KeyBinderManager.cc

    r10829 r10919  
    7676    {
    7777        // Delete all remaining KeyBinders
    78         for (std::map<std::string, KeyBinder*>::const_iterator it = this->binders_.begin(); it != this->binders_.end(); ++it)
    79             delete it->second;
     78        for (const auto& mapEntry : this->binders_)
     79            delete mapEntry.second;
    8080
    8181        // Reset console commands
  • code/branches/cpp11_v2/src/libraries/core/input/KeyDetector.cc

    r10765 r10919  
    7070    {
    7171        // Assign every button/axis the same command, but with its name as argument
    72         for (std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it)
    73             it->second->parse(__CC_KeyDetector_callback_name + ' ' + it->second->groupName_ + "." + it->second->name_);
     72        for (const auto& mapEntry : allButtons_)
     73            mapEntry.second->parse(__CC_KeyDetector_callback_name + ' ' + mapEntry.second->groupName_ + "." + mapEntry.second->name_);
    7474    }
    7575
  • code/branches/cpp11_v2/src/libraries/core/module/ModuleInstance.cc

    r10917 r10919  
    7676        this->staticallyInitializedInstancesByType_.clear();
    7777        for (const auto& mapEntry : copy)
    78             for (std::set<StaticallyInitializedInstance*>::iterator it2 = mapEntry.second.begin(); it2 != mapEntry.second.end(); ++it2)
    79                 delete (*it2);
     78            for (StaticallyInitializedInstance* instance : mapEntry.second)
     79                delete instance;
    8080    }
    8181
Note: See TracChangeset for help on using the changeset viewer.