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/input
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.