1
0
Fork 0
mirror of https://github.com/cosmo-sims/monofonIC.git synced 2024-09-19 17:03:45 +02:00

Merged in develop (pull request #18)

allow also uppercase letters in 'true' 'false' parameters in config files
This commit is contained in:
Oliver Hahn 2020-12-10 14:38:24 +00:00
commit d314f63d37

View file

@ -362,9 +362,10 @@ inline bool config_file::get_value_safe<bool>(std::string const &strSection,
std::string r1;
try {
r1 = get_value_basic<std::string>(strSection, strEntry);
if (r1 == "true" || r1 == "yes" || r1 == "on" || r1 == "1")
std::transform(r1.begin(), r1.end(),r1.begin(), ::toupper);
if (r1 == "YAY" || r1 == "TRUE" || r1 == "YES" || r1 == "ON" || r1 == "1")
return true;
if (r1 == "false" || r1 == "no" || r1 == "off" || r1 == "0")
if (r1 == "NAY" || r1 == "FALSE" || r1 == "NO" || r1 == "OFF" || r1 == "0")
return false;
} catch (except_item_not_found&) {
return defaultValue;