OpenMW
components/settings/settings.hpp
Go to the documentation of this file.
00001 #ifndef _COMPONENTS_SETTINGS_H
00002 #define _COMPONENTS_SETTINGS_H
00003 
00004 #include <OgreConfigFile.h>
00005 
00006 namespace Settings
00007 {
00008     typedef std::pair < std::string, std::string > CategorySetting; 
00009     typedef std::vector< std::pair<std::string, std::string> > CategorySettingVector;
00010     typedef std::map < CategorySetting, std::string > CategorySettingValueMap;
00011 
00015     class Manager
00016     {
00017     public:
00018         static Ogre::ConfigFile mFile;
00019         static Ogre::ConfigFile mDefaultFile;
00020 
00021         static CategorySettingVector mChangedSettings;
00023 
00024         static CategorySettingValueMap mNewSettings;
00026 
00027         void loadDefault (const std::string& file);
00029 
00030         void loadUser (const std::string& file);
00032 
00033         void saveUser (const std::string& file);
00035 
00036         static const CategorySettingVector apply();
00038 
00039         static const int getInt (const std::string& setting, const std::string& category);
00040         static const float getFloat (const std::string& setting, const std::string& category);
00041         static const std::string getString (const std::string& setting, const std::string& category);
00042         static const bool getBool (const std::string& setting, const std::string& category);
00043 
00044         static void setInt (const std::string& setting, const std::string& category, const int value);
00045         static void setFloat (const std::string& setting, const std::string& category, const float value);
00046         static void setString (const std::string& setting, const std::string& category, const std::string& value);
00047         static void setBool (const std::string& setting, const std::string& category, const bool value);
00048     };
00049 
00050 }
00051 
00052 #endif // _COMPONENTS_SETTINGS_H