Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11070 for code


Ignore:
Timestamp:
Jan 17, 2016, 8:40:36 PM (9 years ago)
Author:
landauf
Message:

return collections directly instead of begin and end iterators.
this also fixes an issue in MultiStateEngine where two for-loops used begin() instead of end() in the loop condition.

Location:
code/branches/cpp11_v3/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3/src/libraries/core/class/Identifier.h

    r11054 r11070  
    204204            /// Returns the map that stores all XMLPort params.
    205205            inline const std::map<std::string, XMLPortParamContainer*>& getXMLPortParamMap() const { return this->xmlportParamContainers_; }
    206             /// Returns a const_iterator to the beginning of the map that stores all XMLPort params.
    207             inline std::map<std::string, XMLPortParamContainer*>::const_iterator getXMLPortParamMapBegin() const { return this->xmlportParamContainers_.begin(); }
    208             /// Returns a const_iterator to the end of the map that stores all XMLPort params.
    209             inline std::map<std::string, XMLPortParamContainer*>::const_iterator getXMLPortParamMapEnd() const { return this->xmlportParamContainers_.end(); }
    210206
    211207            /// Returns the map that stores all XMLPort objects.
    212208            inline const std::map<std::string, XMLPortObjectContainer*>& getXMLPortObjectMap() const { return this->xmlportObjectContainers_; }
    213             /// Returns a const_iterator to the beginning of the map that stores all XMLPort objects.
    214             inline std::map<std::string, XMLPortObjectContainer*>::const_iterator getXMLPortObjectMapBegin() const { return this->xmlportObjectContainers_.begin(); }
    215             /// Returns a const_iterator to the end of the map that stores all XMLPort objects.
    216             inline std::map<std::string, XMLPortObjectContainer*>::const_iterator getXMLPortObjectMapEnd() const { return this->xmlportObjectContainers_.end(); }
    217209
    218210            void addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container);
  • code/branches/cpp11_v3/src/libraries/core/config/ConfigFile.cc

    r11054 r11070  
    238238            file << section->getFileEntry() << endl;
    239239
    240             for (std::list<ConfigFileEntry*>::const_iterator it_entries = section->getEntriesBegin(); it_entries != section->getEntriesEnd(); ++it_entries)
    241                 file << (*it_entries)->getFileEntry() << endl;
     240            for (ConfigFileEntry* entry : section->getEntries())
     241                file << entry->getFileEntry() << endl;
    242242
    243243            file << endl;
  • code/branches/cpp11_v3/src/libraries/core/config/ConfigFileSection.h

    r11068 r11070  
    161161            std::list<ConfigFileEntry*>& getEntries()
    162162                { return this->entries_; }
    163             /// Returns the begin-iterator of the list of entries in this section.
    164             std::list<ConfigFileEntry*>::const_iterator getEntriesBegin() const
    165                 { return this->entries_.begin(); }
    166             /// Returns the end-iterator of the list of entries in this section.
    167             std::list<ConfigFileEntry*>::const_iterator getEntriesEnd() const
    168                 { return this->entries_.end(); }
     163            const std::list<ConfigFileEntry*>& getEntries() const
     164                { return this->entries_; }
    169165
    170166            std::list<ConfigFileEntry*>::iterator getOrCreateEntryIterator(const std::string& name, const std::string& fallback, bool bString);
  • code/branches/cpp11_v3/src/orxonox/items/MultiStateEngine.cc

    r11068 r11070  
    8686                // We have no ship, so the effects are not attached and won't be destroyed automatically
    8787                for (EffectContainer* container : this->effectContainers_)
    88                     for (std::vector<WorldEntity*>::const_iterator it = container->getEffectsBegin(); it != container->getEffectsBegin(); ++it)
    89                         (*it)->destroy();
     88                    for (WorldEntity* effect : container->getEffects())
     89                        effect->destroy();
    9090                if (this->defEngineSndNormal_)
    9191                    this->defEngineSndNormal_->destroy();
     
    199199
    200200        for (EffectContainer* container : this->effectContainers_)
    201             for (std::vector<WorldEntity*>::const_iterator it = container->getEffectsBegin(); it != container->getEffectsEnd(); ++it)
    202                 this->getShip()->attach(*it);
    203     }
    204 
    205     void MultiStateEngine::addEffectContainer(EffectContainer* effect)
    206     {
    207         if (effect == nullptr)
     201            for (WorldEntity* effect : container->getEffects())
     202                this->getShip()->attach(effect);
     203    }
     204
     205    void MultiStateEngine::addEffectContainer(EffectContainer* container)
     206    {
     207        if (container == nullptr)
    208208            return;
    209         effect->setLuaState(this->lua_, 'f' + multi_cast<std::string>(this->effectContainers_.size()));
    210         this->effectContainers_.push_back(effect);
     209        container->setLuaState(this->lua_, 'f' + multi_cast<std::string>(this->effectContainers_.size()));
     210        this->effectContainers_.push_back(container);
    211211        if (this->getShip())
    212212        {
    213             for (std::vector<WorldEntity*>::const_iterator it = effect->getEffectsBegin(); it != effect->getEffectsBegin(); ++it)
    214                 this->getShip()->attach(*it);
     213            for (WorldEntity* effect : container->getEffects())
     214                this->getShip()->attach(effect);
    215215        }
    216216    }
  • code/branches/cpp11_v3/src/orxonox/worldentities/EffectContainer.h

    r11054 r11070  
    5454            WorldEntity* getEffect(unsigned int index) const;
    5555
    56             inline std::vector<WorldEntity*>::const_iterator getEffectsBegin()
    57                 { return this->effects_.begin(); }
    58             inline std::vector<WorldEntity*>::const_iterator getEffectsEnd()
    59                 { return this->effects_.end(); }
     56            inline const std::vector<WorldEntity*>& getEffects() const
     57                { return this->effects_; }
    6058
    6159            void updateCondition();
Note: See TracChangeset for help on using the changeset viewer.