Changeset 1049 for code/branches/core2/src/orxonox/core/ConfigFileManager.h
- Timestamp:
- Apr 14, 2008, 12:48:25 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core2/src/orxonox/core/ConfigFileManager.h
r1030 r1049 63 63 public: 64 64 virtual void setValue(const std::string& value) = 0; 65 virtual const std::string&getValue() const = 0;65 virtual std::string getValue() const = 0; 66 66 virtual const std::string& getName() const = 0; 67 67 virtual void setComment(const std::string& comment) = 0; 68 68 virtual unsigned int getIndex() const { return 0; } 69 virtual void setString(bool bString) = 0; 69 70 virtual std::string getFileEntry() const = 0; 70 71 }; … … 77 78 { 78 79 public: 79 inline ConfigFileEntryValue(const std::string& name, const std::string& value = "", const std::string& additionalComment = "") : name_(name), value_(value), additionalComment_(additionalComment), bString_(false) {}80 inline ConfigFileEntryValue(const std::string& name, const std::string& value = "", bool bString = false, const std::string& additionalComment = "") : name_(name), value_(value), bString_(bString), additionalComment_(additionalComment) {} 80 81 inline virtual ~ConfigFileEntryValue() {} 81 82 … … 86 87 { this->additionalComment_ = comment; } 87 88 88 inline virtual void setValue(const std::string& value) 89 { this->value_ = value; } 90 inline virtual const std::string& getValue() const 91 { return this->value_; } 89 virtual void setValue(const std::string& value); 90 virtual std::string getValue() const; 92 91 93 92 inline bool isString() const … … 101 100 std::string name_; 102 101 std::string value_; 102 bool bString_; 103 103 std::string additionalComment_; 104 bool bString_;105 104 }; 106 105 … … 112 111 { 113 112 public: 114 inline ConfigFileEntryVectorValue(const std::string& name, unsigned int index, const std::string& value = "", const std::string& additionalComment = "") : ConfigFileEntryValue(name, value, additionalComment), index_(index) {}113 inline ConfigFileEntryVectorValue(const std::string& name, unsigned int index, const std::string& value = "", bool bString = false, const std::string& additionalComment = "") : ConfigFileEntryValue(name, value, bString, additionalComment), index_(index) {} 115 114 inline virtual ~ConfigFileEntryVectorValue() {} 116 115 … … 142 141 inline virtual void setValue(const std::string& value) 143 142 {} 144 inline virtual const std::string&getValue() const143 inline virtual std::string getValue() const 145 144 { return this->comment_; } 145 146 inline void setString(bool bString) {} 146 147 147 148 inline virtual std::string getFileEntry() const … … 170 171 { this->additionalComment_ = comment; } 171 172 172 inline void setValue(const std::string& name, const std::string& value )173 { this->getEntry(name, value )->setValue(value); }174 inline const std::string& getValue(const std::string& name, const std::string& fallback)175 { return this->getEntry(name, fallback )->getValue(); }176 177 inline void setValue(const std::string& name, unsigned int index, const std::string& value )178 { this->getEntry(name, index, value )->setValue(value); }179 inline const std::string& getValue(const std::string& name, unsigned int index, const std::string& fallback)180 { return this->getEntry(name, index, fallback )->getValue(); }173 inline void setValue(const std::string& name, const std::string& value, bool bString) 174 { this->getEntry(name, value, bString)->setValue(value); } 175 inline std::string getValue(const std::string& name, const std::string& fallback, bool bString) 176 { return this->getEntry(name, fallback, bString)->getValue(); } 177 178 inline void setValue(const std::string& name, unsigned int index, const std::string& value, bool bString) 179 { this->getEntry(name, index, value, bString)->setValue(value); } 180 inline std::string getValue(const std::string& name, unsigned int index, const std::string& fallback, bool bString) 181 { return this->getEntry(name, index, fallback, bString)->getValue(); } 181 182 182 183 void deleteVectorEntries(const std::string& name, unsigned int startindex = 0); … … 193 194 { return this->entries_.end(); } 194 195 195 std::list<ConfigFileEntry*>::iterator getEntryIterator(const std::string& name, const std::string& fallback = "");196 std::list<ConfigFileEntry*>::iterator getEntryIterator(const std::string& name, unsigned int index, const std::string& fallback = "");197 198 inline ConfigFileEntry* getEntry(const std::string& name, const std::string& fallback )199 { return (*this->getEntryIterator(name, fallback )); }200 inline ConfigFileEntry* getEntry(const std::string& name, unsigned int index, const std::string& fallback )201 { return (*this->getEntryIterator(name, index, fallback )); }196 std::list<ConfigFileEntry*>::iterator getEntryIterator(const std::string& name, const std::string& fallback, bool bString); 197 std::list<ConfigFileEntry*>::iterator getEntryIterator(const std::string& name, unsigned int index, const std::string& fallback, bool bString); 198 199 inline ConfigFileEntry* getEntry(const std::string& name, const std::string& fallback, bool bString) 200 { return (*this->getEntryIterator(name, fallback, bString)); } 201 inline ConfigFileEntry* getEntry(const std::string& name, unsigned int index, const std::string& fallback, bool bString) 202 { return (*this->getEntryIterator(name, index, fallback, bString)); } 202 203 203 204 std::string name_; … … 221 222 void clean(bool bCleanComments = false); 222 223 223 inline void setValue(const std::string& section, const std::string& name, const std::string& value )224 { this->getSection(section)->setValue(name, value ); this->save(); }225 inline const std::string& getValue(const std::string& section, const std::string& name, const std::string& fallback)226 { const std::string& output = this->getSection(section)->getValue(name, fallback); this->saveIfUpdated(); return output; }227 228 inline void setValue(const std::string& section, const std::string& name, unsigned int index, const std::string& value )229 { this->getSection(section)->setValue(name, index, value ); this->save(); }230 inline const std::string& getValue(const std::string& section, const std::string& name, unsigned int index, const std::string& fallback)231 { const std::string& output = this->getSection(section)->getValue(name, index, fallback); this->saveIfUpdated(); return output; }224 inline void setValue(const std::string& section, const std::string& name, const std::string& value, bool bString) 225 { this->getSection(section)->setValue(name, value, bString); this->save(); } 226 inline std::string getValue(const std::string& section, const std::string& name, const std::string& fallback, bool bString) 227 { std::string output = this->getSection(section)->getValue(name, fallback, bString); this->saveIfUpdated(); return output; } 228 229 inline void setValue(const std::string& section, const std::string& name, unsigned int index, const std::string& value, bool bString) 230 { this->getSection(section)->setValue(name, index, value, bString); this->save(); } 231 inline std::string getValue(const std::string& section, const std::string& name, unsigned int index, const std::string& fallback, bool bString) 232 { std::string output = this->getSection(section)->getValue(name, index, fallback, bString); this->saveIfUpdated(); return output; } 232 233 233 234 inline void deleteVectorEntries(const std::string& section, const std::string& name, unsigned int startindex = 0) … … 264 265 void clean(ConfigFileType type, bool bCleanComments = false); 265 266 266 inline void setValue(ConfigFileType type, const std::string& section, const std::string& name, const std::string& value )267 { this->getFile(type)->setValue(section, name, value ); }268 inline const std::string& getValue(ConfigFileType type, const std::string& section, const std::string& name, const std::string& fallback)269 { return this->getFile(type)->getValue(section, name, fallback ); }270 271 inline void setValue(ConfigFileType type, const std::string& section, const std::string& name, unsigned int index, const std::string& value )272 { this->getFile(type)->setValue(section, name, index, value ); }273 inline const std::string& getValue(ConfigFileType type, const std::string& section, const std::string& name, unsigned int index, const std::string& fallback)274 { return this->getFile(type)->getValue(section, name, index, fallback ); }267 inline void setValue(ConfigFileType type, const std::string& section, const std::string& name, const std::string& value, bool bString) 268 { this->getFile(type)->setValue(section, name, value, bString); } 269 inline std::string getValue(ConfigFileType type, const std::string& section, const std::string& name, const std::string& fallback, bool bString) 270 { return this->getFile(type)->getValue(section, name, fallback, bString); } 271 272 inline void setValue(ConfigFileType type, const std::string& section, const std::string& name, unsigned int index, const std::string& value, bool bString) 273 { this->getFile(type)->setValue(section, name, index, value, bString); } 274 inline std::string getValue(ConfigFileType type, const std::string& section, const std::string& name, unsigned int index, const std::string& fallback, bool bString) 275 { return this->getFile(type)->getValue(section, name, index, fallback, bString); } 275 276 276 277 inline void deleteVectorEntries(ConfigFileType type, const std::string& section, const std::string& name, unsigned int startindex = 0)
Note: See TracChangeset
for help on using the changeset viewer.