A few cleanups, and make a few things more modern

This commit is contained in:
Florent Le Coz
2015-12-23 11:05:55 +01:00
parent 9167cdf126
commit 9ac0d3a576
5 changed files with 23 additions and 22 deletions
+6 -12
View File
@@ -7,7 +7,7 @@
* If you want to exit if the file does not exist when it is open for
* reading, set Config::file_must_exist = true.
*
* Config::get() can the be used to access the values in the conf.
* Config::get() can then be used to access the values in the conf.
*
* Use Config::close() when you're done getting/setting value. This will
* save the config into the file.
@@ -33,35 +33,29 @@ public:
/**
* returns a value from the config. If it doesn’t exist, use
* the second argument as the default.
* @param option The option we want
* @param def The default value in case the option does not exist
*/
static std::string get(const std::string&, const std::string&);
/**
* returns a value from the config. If it doesn’t exist, use
* the second argument as the default.
* @param option The option we want
* @param def The default value in case the option does not exist
*/
static int get_int(const std::string&, const int&);
/**
* Set a value for the given option. And write all the config
* in the file from which it was read if boolean is set.
* @param option The option to set
* @param value The value to use
* @param save if true, save the config file
* in the file from which it was read if save is true.
*/
static void set(const std::string&, const std::string&, bool save = false);
/**
* Adds a function to a list. This function will be called whenever a
* configuration change occurs.
* configuration change occurs (when set() is called, or when the initial
* conf is read)
*/
static void connect(t_config_changed_callback);
/**
* Close the config file, saving it to the file is save == true.
* Destroy the instance, forcing it to be recreated (with potentially
* different parameters) the next time it’s needed.
*/
static void close();
/**
* Set the value of the filename to use, before calling any method.
*/