Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 29, 2009, 10:30:19 PM (14 years ago)
Author:
rgrieder
Message:

Changed the way config values associated with general settings (ConfigFileType::Settings) are handled:

  • ConfigFileManager only handles config files listed in the ConfigFileType enum (normal enum again)
  • ConfigFileManager only takes care of ConfigFiles and returns a pointer to the right one, just two functions left. —> use like: ConfigFileManager::getInstance().getConfigFile(myType)→doSomething();
  • Moved all code (except for the argument completion functions) relating to ConfigFileType::Settings to a new class: SettingsConfigFile, which is a Singleton (it doesn't make sense to have multiple instances unless you start coding a lot more)
  • SettingsConfigFile handles config value containers according to their section and entry in the ini file, not according to class and variables names. (In most cases it will be class and variable names though)
  • SettingsConfigFile supports:
    • clear() (removes any file entries not associated to a config value container)
    • updateConfigValues() (does exactly that through the identifier)
    • config, tconfig and getConfig
    • commands listed above are exported to tolua, and tconfig, config and getConfig were given shortcuts in Lua (e.g. orxonox.config)
  • If you need to organise ConfigFiles yourself, just do it without the ConfigFileManager, like the KeyBinder does.
  • All getValue() functions have been split into getOrCreateValue() and getValue(), which is const
  • Removed obsolete config value management code in the Identifier (it still stores and destroys them and provides access to them)

All of that leads to one HUGE advantage:
"config OutputHandler softDebugLevelInGameConsole"
works now :D (any further implications are up to the reader…)
(it didn't work before because the actual config value container is in the InGameConsole singleton)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gamestate/src/libraries/core/Identifier.h

    r6417 r6432  
    200200            inline bool hasConfigValues() const { return this->bHasConfigValues_; }
    201201
    202             /** @brief Returns the map that stores all config values. @return The const_iterator */
    203             inline const std::map<std::string, ConfigValueContainer*>& getConfigValueMap() const { return this->configValues_; }
    204             /** @brief Returns a const_iterator to the beginning of the map that stores all config values. @return The const_iterator */
    205             inline std::map<std::string, ConfigValueContainer*>::const_iterator getConfigValueMapBegin() const { return this->configValues_.begin(); }
    206             /** @brief Returns a const_iterator to the end of the map that stores all config values. @return The const_iterator */
    207             inline std::map<std::string, ConfigValueContainer*>::const_iterator getConfigValueMapEnd() const { return this->configValues_.end(); }
    208 
    209             /** @brief Returns the map that stores all config values with their names in lowercase. @return The const_iterator */
    210             inline const std::map<std::string, ConfigValueContainer*>& getLowercaseConfigValueMap() const { return this->configValues_LC_; }
    211             /** @brief Returns a const_iterator to the beginning of the map that stores all config values with their names in lowercase. @return The const_iterator */
    212             inline std::map<std::string, ConfigValueContainer*>::const_iterator getLowercaseConfigValueMapBegin() const { return this->configValues_LC_.begin(); }
    213             /** @brief Returns a const_iterator to the end of the map that stores all config values with their names in lowercase. @return The const_iterator */
    214             inline std::map<std::string, ConfigValueContainer*>::const_iterator getLowercaseConfigValueMapEnd() const { return this->configValues_LC_.end(); }
    215 
    216202            void addConfigValueContainer(const std::string& varname, ConfigValueContainer* container);
    217203            ConfigValueContainer* getConfigValueContainer(const std::string& varname);
    218             ConfigValueContainer* getLowercaseConfigValueContainer(const std::string& varname);
    219204
    220205
     
    320305            bool bHasConfigValues_;                                        //!< True if this class has at least one assigned config value
    321306            std::map<std::string, ConfigValueContainer*> configValues_;    //!< A map to link the string of configurable variables with their ConfigValueContainer
    322             std::map<std::string, ConfigValueContainer*> configValues_LC_; //!< A map to link the string of configurable variables with their ConfigValueContainer
    323307
    324308            bool bHasConsoleCommands_;                                     //!< True if this class has at least one assigned console command
Note: See TracChangeset for help on using the changeset viewer.