Skip to content

Commit

Permalink
Add info to error message
Browse files Browse the repository at this point in the history
  • Loading branch information
HomesGH committed Oct 25, 2023
1 parent 981cddf commit 78db2ee
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/utils/xmlfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,20 +590,20 @@ template<> bool XMLfile::Node::getValue<bool>(bool& value) const
std::string v;
bool found=getValue(v);
if (found) {
// Remove white spaces
v.erase(std::remove_if(v.begin(), v.end(), ::isspace), v.end());
// Convert to upper case letters
std::transform(v.begin(), v.end(), v.begin(), ::toupper);

if (v == "TRUE" || v == "YES" || v == "ON" || v == "1") {
value = true;
} else if (v == "FALSE" || v == "NO" || v == "OFF" || v == "0") {
value = false;
} else {
std::cerr << "ERROR parsing \"" << v << "\" from xml file to boolean" << std::endl;
Simulation::exit(1);
}
}
// Remove white spaces
v.erase(std::remove_if(v.begin(), v.end(), ::isspace), v.end());
// Convert to upper case letters
std::transform(v.begin(), v.end(), v.begin(), ::toupper);

if (v == "TRUE" || v == "YES" || v == "ON" || v == "1") {
value = true;
} else if (v == "FALSE" || v == "NO" || v == "OFF" || v == "0") {
value = false;
} else {
std::cerr << "ERROR parsing \"" << v << "\" to boolean from tag \"<" << name() << ">\" in xml file" << std::endl;
Simulation::exit(1);
}
}
return found;
}

Expand Down

0 comments on commit 78db2ee

Please sign in to comment.