Changeset 6417 for code/trunk/src/libraries/core/ConfigFileManager.h
- Timestamp:
- Dec 25, 2009, 10:23:58 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/ConfigFileManager.h
r6105 r6417 40 40 #include "util/Singleton.h" 41 41 42 // tolua_begin 42 43 namespace orxonox 43 44 { 45 // tolua_end 44 46 // Use int as config file type to have an arbitrary number of files 45 47 struct ConfigFileType : OrxEnum<ConfigFileType> … … 50 52 static const int Settings = 1; 51 53 static const int JoyStickCalibration = 2; 54 static const int CommandHistory = 3; 52 55 53 56 static const int numberOfReservedTypes = 1024; 54 57 }; 55 58 56 _CoreExport bool config(const std::string& classname, const std::string& varname, const std::string& value); 59 _CoreExport bool config(const std::string& classname, const std::string& varname, const std::string& value); // tolua_export 60 _CoreExport std::string getConfig(const std::string& classname, const std::string& varname); // tolua_export 57 61 _CoreExport bool tconfig(const std::string& classname, const std::string& varname, const std::string& value); 58 62 _CoreExport void reloadConfig(); … … 85 89 { 86 90 public: 87 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) {} 91 inline ConfigFileEntryValue(const std::string& name, const std::string& value = "", bool bString = false, const std::string& additionalComment = "") 92 : name_(name) 93 , value_(value) 94 , bString_(bString) 95 , additionalComment_(additionalComment) 96 {} 88 97 inline virtual ~ConfigFileEntryValue() {} 89 98 … … 169 178 170 179 public: 171 inline ConfigFileSection(const std::string& name, const std::string& additionalComment = "") : name_(name), additionalComment_(additionalComment), bUpdated_(false) {} 180 inline ConfigFileSection(const std::string& name, const std::string& additionalComment = "") 181 : name_(name) 182 , additionalComment_(additionalComment) 183 , bUpdated_(false) 184 {} 172 185 ~ConfigFileSection(); 173 186 … … 240 253 { this->getSection(section)->setValue(name, value, bString); this->save(); } 241 254 inline std::string getValue(const std::string& section, const std::string& name, const std::string& fallback, bool bString) 242 { std::stringoutput = this->getSection(section)->getValue(name, fallback, bString); this->saveIfUpdated(); return output; }255 { const std::string& output = this->getSection(section)->getValue(name, fallback, bString); this->saveIfUpdated(); return output; } 243 256 244 257 inline void setValue(const std::string& section, const std::string& name, unsigned int index, const std::string& value, bool bString) 245 258 { this->getSection(section)->setValue(name, index, value, bString); this->save(); } 246 259 inline std::string getValue(const std::string& section, const std::string& name, unsigned int index, const std::string& fallback, bool bString) 247 { std::stringoutput = this->getSection(section)->getValue(name, index, fallback, bString); this->saveIfUpdated(); return output; }260 { const std::string& output = this->getSection(section)->getValue(name, index, fallback, bString); this->saveIfUpdated(); return output; } 248 261 249 262 inline void deleteVectorEntries(const std::string& section, const std::string& name, unsigned int startindex = 0) … … 319 332 static ConfigFileManager* singletonPtr_s; 320 333 }; 321 } 334 } // tolua_export 322 335 323 336 #endif /* _ConfigFileManager_H__ */
Note: See TracChangeset
for help on using the changeset viewer.