Linux multi-monitor fullscreen support
[ryzomcore.git] / ryzom / tools / client / client_config_qt / src / config.h
blob05f82c83a41841f94e125083a5668494da635395
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef CONFIG_H
18 #define CONFIG_H
20 #include <nel/misc/config_file.h>
22 /**
23 @brief Wrapper for a Ryzom config file, allows setting and querying values.
25 class CConfig
27 public:
28 CConfig();
29 ~CConfig();
31 /**
32 @brief Create a config file.
33 @param fileName - The config file to create
34 @param defaultFileName - The default config file to use
35 @return Returns true on success, returns false on failure.
37 bool create(const std::string &fileName, const std::string &defaultFileName);
39 /**
40 @brief Loads a config file.
41 @param fileName - The file to load
42 @return Returns true on success, returns false on failure.
44 bool load(const std::string &fileName);
46 /**
47 @brief Reloads the contents of the config file
48 @return Return true on success, returns false on failure.
50 bool reload();
52 /**
53 @brief Reverts the config file to the default
54 @details Reverts the config file to the default if possible.
55 If there is no default config, it reverts the current changes only.
57 void revertToDefault();
59 /**
60 @brief Saves the configuration to the config file.
61 @return Returns true on success, returns false on failure.
63 bool save();
65 /**
66 @brief Queries the value for the specified key.
67 @param key - The key we are interested in
68 @return Returns the value as a bool, returns false if the key doesn't exist.
70 bool getBool( const char *key );
72 /**
73 @brief Queries the value for the specified key.
74 @param key - The key we are interested in
75 @return Returns the value as an integer, returns 0 if the key doesn't exist.
77 sint32 getInt( const char *key );
79 /**
80 @brief Queries the value for the specified key.
81 @param key - The key we are interested in
82 @return Returns the value as a float, returns 0.0f if the key doesn't exist.
84 float getFloat( const char *key );
86 /**
87 @brief Queries the value for the specified key.
88 @param key - The key we are interested in
89 @return Returns the value as a std::string, returns an empty string if the key doesn't exist.
91 std::string getString( const char *key );
93 /**
94 @brief Sets the specified key to the specified value.
95 @param key - the key we want to alter
96 @param value - the value we want to set
98 void setBool( const char *key, bool value );
101 @brief Sets the specified key to the specified value.
102 @param key - the key we want to alter
103 @param value - the value we want to set
105 void setInt( const char *key, sint32 value );
108 @brief Sets the specified key to the specified value.
109 @param key - the key we want to alter
110 @param value - the value we want to set
112 void setFloat( const char *key, float value );
115 @brief Sets the specified key to the specified value.
116 @param key - the key we want to alter
117 @param value - the value we want to set
119 void setString( const char *key, const std::string &value );
121 private:
122 // config file
123 NLMISC::CConfigFile cf;
124 // default config file
125 NLMISC::CConfigFile dcf;
128 #endif