Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 10, 2008, 4:39:06 PM (17 years ago)
Author:
landauf
Message:

changed ConfigValueContainer to use ConfigFileManager, but there is still an error

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core2/src/orxonox/core/ConfigFileManager.h

    r1006 r1020  
    7676    {
    7777        public:
    78             inline ConfigFileEntryValue(const std::string& name, const std::string& value = "", const std::string& additionalComment = "") : name_(name), value_(value), additionalComment_(additionalComment), bString_(false) {}
     78            inline ConfigFileEntryValue(const std::string& name, const std::string& value = "", const std::string& additionalComment = "") : name_(name), value_(value), additionalComment_(additionalComment), bString_(false) { std::cout << "************* " << value << std::endl; }
    7979            inline virtual ~ConfigFileEntryValue() {}
    8080
     
    161161
    162162            inline void setValue(const std::string& name, const std::string& value)
    163                 { this->getEntry(name)->setValue(value); }
    164             inline const std::string& getValue(const std::string& name)
    165                 { return this->getEntry(name)->getValue(); }
     163                { this->getEntry(name, value)->setValue(value); }
     164            inline const std::string& getValue(const std::string& name, const std::string& fallback)
     165                { return this->getEntry(name, fallback)->getValue(); }
    166166
    167167            inline void setValue(const std::string& name, unsigned int index, const std::string& value)
    168                 { this->getEntry(name, index)->setValue(value); }
    169             inline const std::string& getValue(const std::string& name, unsigned int index)
    170                 { return this->getEntry(name, index)->getValue(); }
     168                { this->getEntry(name, index, value)->setValue(value); }
     169            inline const std::string& getValue(const std::string& name, unsigned int index, const std::string& fallback)
     170                { return this->getEntry(name, index, fallback)->getValue(); }
    171171
    172172            std::string getFileEntry() const;
     
    180180                { return this->entries_.end(); }
    181181
    182             std::list<ConfigFileEntry*>::iterator getEntryIterator(const std::string& name, unsigned int index);
    183 
    184             inline ConfigFileEntry* getEntry(const std::string& name)
    185                 { return (*this->getEntryIterator(name, 0)); }
    186             inline ConfigFileEntry* getEntry(const std::string& name, unsigned int index)
    187                 { return (*this->getEntryIterator(name, index)); }
     182            std::list<ConfigFileEntry*>::iterator getEntryIterator(const std::string& name, const std::string& fallback = "");
     183            std::list<ConfigFileEntry*>::iterator getEntryIterator(const std::string& name, unsigned int index, const std::string& fallback = "");
     184
     185            inline ConfigFileEntry* getEntry(const std::string& name, const std::string& fallback)
     186                { return (*this->getEntryIterator(name, fallback)); }
     187            inline ConfigFileEntry* getEntry(const std::string& name, unsigned int index, const std::string& fallback)
     188                { return (*this->getEntryIterator(name, index, fallback)); }
    188189
    189190            std::string name_;
     
    209210            inline void setValue(const std::string& section, const std::string& name, const std::string& value)
    210211                { this->getSection(section)->setValue(name, value); this->save(); }
    211             inline const std::string& getValue(const std::string& section, const std::string& name)
    212                 { return this->getSection(section)->getValue(name); this->saveIfUpdated(); }
     212            inline const std::string& getValue(const std::string& section, const std::string& name, const std::string& fallback)
     213                { return this->getSection(section)->getValue(name, fallback); this->saveIfUpdated(); }
    213214
    214215            inline void setValue(const std::string& section, const std::string& name, unsigned int index, const std::string& value)
    215216                { this->getSection(section)->setValue(name, index, value); this->save(); }
    216             inline const std::string& getValue(const std::string& section, const std::string& name, unsigned int index)
    217                 { return this->getSection(section)->getValue(name, index); this->saveIfUpdated(); }
     217            inline const std::string& getValue(const std::string& section, const std::string& name, unsigned int index, const std::string& fallback)
     218                { return this->getSection(section)->getValue(name, index, fallback); this->saveIfUpdated(); }
    218219
    219220        private:
     
    233234    {
    234235        public:
    235             static ConfigFileManager* getInstance();
     236            static ConfigFileManager* getSingleton();
    236237
    237238            void setFile(ConfigFileType type, const std::string& filename);
     
    247248            inline void setValue(ConfigFileType type, const std::string& section, const std::string& name, const std::string& value)
    248249                { this->getFile(type)->setValue(section, name, value); }
    249             inline const std::string& getValue(ConfigFileType type, const std::string& section, const std::string& name)
    250                 { return this->getFile(type)->getValue(section, name); }
     250            inline const std::string& getValue(ConfigFileType type, const std::string& section, const std::string& name, const std::string& fallback)
     251                { return this->getFile(type)->getValue(section, name, fallback); }
    251252
    252253            inline void setValue(ConfigFileType type, const std::string& section, const std::string& name, unsigned int index, const std::string& value)
    253254                { this->getFile(type)->setValue(section, name, index, value); }
    254             inline const std::string& getValue(ConfigFileType type, const std::string& section, const std::string& name, unsigned int index)
    255                 { return this->getFile(type)->getValue(section, name, index); }
     255            inline const std::string& getValue(ConfigFileType type, const std::string& section, const std::string& name, unsigned int index, const std::string& fallback)
     256                { return this->getFile(type)->getValue(section, name, index, fallback); }
    256257
    257258            void updateConfigValues() const;
Note: See TracChangeset for help on using the changeset viewer.