Changeset 1020 for code/branches/core2/src/orxonox/core/ConfigFileManager.h
- Timestamp:
- Apr 10, 2008, 4:39:06 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core2/src/orxonox/core/ConfigFileManager.h
r1006 r1020 76 76 { 77 77 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; } 79 79 inline virtual ~ConfigFileEntryValue() {} 80 80 … … 161 161 162 162 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(); } 166 166 167 167 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(); } 171 171 172 172 std::string getFileEntry() const; … … 180 180 { return this->entries_.end(); } 181 181 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)); } 188 189 189 190 std::string name_; … … 209 210 inline void setValue(const std::string& section, const std::string& name, const std::string& value) 210 211 { 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(); } 213 214 214 215 inline void setValue(const std::string& section, const std::string& name, unsigned int index, const std::string& value) 215 216 { 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(); } 218 219 219 220 private: … … 233 234 { 234 235 public: 235 static ConfigFileManager* get Instance();236 static ConfigFileManager* getSingleton(); 236 237 237 238 void setFile(ConfigFileType type, const std::string& filename); … … 247 248 inline void setValue(ConfigFileType type, const std::string& section, const std::string& name, const std::string& value) 248 249 { 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); } 251 252 252 253 inline void setValue(ConfigFileType type, const std::string& section, const std::string& name, unsigned int index, const std::string& value) 253 254 { 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); } 256 257 257 258 void updateConfigValues() const;
Note: See TracChangeset
for help on using the changeset viewer.