Add the persistent_by_default configuration option

fix #3293
This commit is contained in:
louiz’
2017-09-09 17:09:17 +02:00
parent 8d99374f1f
commit bfcf294517
9 changed files with 70 additions and 9 deletions
+8
View File
@@ -23,6 +23,14 @@ std::string Config::get(const std::string& option, const std::string& def)
return it->second;
}
bool Config::get_bool(const std::string& option, const bool def)
{
auto res = Config::get(option, "");
if (res.empty())
return def;
return res == "true";
}
int Config::get_int(const std::string& option, const int& def)
{
std::string res = Config::get(option, "");
+1
View File
@@ -44,6 +44,7 @@ public:
* the second argument as the default.
*/
static int get_int(const std::string&, const int&);
static bool get_bool(const std::string&, const bool);
/**
* Set a value for the given option. And write all the config
* in the file from which it was read if save is true.