Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 2, 2015, 11:22:03 PM (9 years ago)
Author:
landauf
Message:

use actual types instead of 'auto'. only exception is for complicated template types, e.g. when iterating over a map

Location:
code/branches/cpp11_v2/src/libraries/core/config
Files:
4 edited

Legend:

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

    r10821 r10916  
    234234        }
    235235
    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)
     236        for (ConfigFileSection* section : this->sections_)
     237        {
     238            file << section->getFileEntry() << endl;
     239
     240            for (std::list<ConfigFileEntry*>::const_iterator it_entries = section->getEntriesBegin(); it_entries != section->getEntriesEnd(); ++it_entries)
    241241                file << (*it_entries)->getFileEntry() << endl;
    242242
     
    278278        @brief Returns a pointer to the section with given name (or nullptr if the section doesn't exist).
    279279    */
    280     ConfigFileSection* ConfigFile::getSection(const std::string& section) const
    281     {
    282         for (const auto & elem : this->sections_)
    283             if ((elem)->getName() == section)
    284                 return (elem);
     280    ConfigFileSection* ConfigFile::getSection(const std::string& sectionName) const
     281    {
     282        for (ConfigFileSection* section : this->sections_)
     283            if (section->getName() == sectionName)
     284                return section;
    285285        return nullptr;
    286286    }
     
    289289        @brief Returns a pointer to the section with given name. If it doesn't exist, the section is created.
    290290    */
    291     ConfigFileSection* ConfigFile::getOrCreateSection(const std::string& section)
    292     {
    293         for (auto & elem : this->sections_)
    294             if ((elem)->getName() == section)
    295                 return (elem);
     291    ConfigFileSection* ConfigFile::getOrCreateSection(const std::string& sectionName)
     292    {
     293        for (ConfigFileSection* section : this->sections_)
     294            if (section->getName() == sectionName)
     295                return section;
    296296
    297297        this->bUpdated_ = true;
    298298
    299         return (*this->sections_.insert(this->sections_.end(), new ConfigFileSection(section)));
     299        return (*this->sections_.insert(this->sections_.end(), new ConfigFileSection(sectionName)));
    300300    }
    301301
     
    307307        bool sectionsUpdated = false;
    308308
    309         for (auto & elem : this->sections_)
    310         {
    311             if ((elem)->bUpdated_)
     309        for (ConfigFileSection* section : this->sections_)
     310        {
     311            if (section->bUpdated_)
    312312            {
    313313                sectionsUpdated = true;
    314                 (elem)->bUpdated_ = false;
     314                section->bUpdated_ = false;
    315315            }
    316316        }
  • code/branches/cpp11_v2/src/libraries/core/config/ConfigFileManager.cc

    r10821 r10916  
    5353    ConfigFileManager::~ConfigFileManager()
    5454    {
    55         for (const auto & elem : this->configFiles_)
    56             if (elem)
    57                 delete (elem);
     55        for (ConfigFile* configFile : this->configFiles_)
     56            if (configFile)
     57                delete configFile;
    5858    }
    5959
  • code/branches/cpp11_v2/src/libraries/core/config/ConfigFileSection.cc

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

    r10845 r10916  
    130130
    131131                this->value_ = V();
    132                 for (auto & elem : defvalue)
    133                     this->valueVector_.push_back(MultiType(elem));
     132                for (const D& defvalueElement : defvalue)
     133                    this->valueVector_.push_back(MultiType(defvalueElement));
    134134
    135135                this->initVector();
     
    183183                    std::vector<T> temp = *value;
    184184                    value->clear();
    185                     for (auto & elem : this->valueVector_)
    186                         value->push_back(elem);
     185                    for (const MultiType& vectorEntry : this->valueVector_)
     186                        value->push_back(vectorEntry);
    187187
    188188                    if (value->size() != temp.size())
     
    211211                {
    212212                    value->clear();
    213                     for (auto & elem : this->valueVector_)
    214                         value->push_back(elem);
     213                    for (const MultiType& vectorEntry : this->valueVector_)
     214                        value->push_back(vectorEntry);
    215215                }
    216216                return *this;
Note: See TracChangeset for help on using the changeset viewer.