Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 21, 2015, 7:05:53 PM (8 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
File:
1 edited

Legend:

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