added specialisation for get for strings
This commit is contained in:
parent
8230ca77ec
commit
b39c02d1ec
@ -26,3 +26,12 @@ std::string sc::config_file::path_for_file_name(const std::string& file_name) {
|
|||||||
bool sc::config_file::get(const std::string& key, bool default_value) const {
|
bool sc::config_file::get(const std::string& key, bool default_value) const {
|
||||||
return get<std::string>(key, default_value ? "yes" : "no") == "yes";
|
return get<std::string>(key, default_value ? "yes" : "no") == "yes";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string sc::config_file::get(const std::string& key,
|
||||||
|
const std::string& default_value) const {
|
||||||
|
auto it = _cfg.find(key);
|
||||||
|
if (it == _cfg.end()) {
|
||||||
|
return default_value;
|
||||||
|
}
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
@ -22,6 +22,8 @@ namespace sc {
|
|||||||
return sc::from_string<T>(it->second);
|
return sc::from_string<T>(it->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string get(const std::string& key,
|
||||||
|
const std::string& default_value) const;
|
||||||
bool get(const std::string& key, bool default_value) const;
|
bool get(const std::string& key, bool default_value) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user