16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 02:29:17 +02:00

fix for loading boolean settings from .fiz files

This commit is contained in:
tmj-fstate
2017-04-01 14:56:26 +02:00
parent 96b01c6205
commit b5b282f06e
2 changed files with 42 additions and 18 deletions

View File

@@ -7912,3 +7912,23 @@ double TMoverParameters::ShowCurrentP(int AmpN)
return current;
}
}
template <>
bool
extract_value( bool &Variable, std::string const &Key, std::string const &Input, std::string const &Default ) {
auto value = extract_value( Key, Input );
if( false == value.empty() ) {
// set the specified variable to retrieved value
Variable = ( value == "Yes" );
return true; // located the variable
}
else {
// set the variable to provided default value
if( false == Default.empty() ) {
// (provided there's one)
Variable = ( Default == "Yes" );
}
return false; // couldn't locate the variable in provided input
}
}