X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConfig%2FConfig_Common.cpp;h=2da152dccd3c9ea4271fb4066786e624f68c62af;hb=60e95a5502a6940c6c27ce5d561b3c684b0b0a4f;hp=634a4337ff73b7c0eb0c92d9eedf9581eece9798;hpb=1e331e45cee661c73461f09a8114aaba62c8d9b4;p=modules%2Fshaper.git diff --git a/src/Config/Config_Common.cpp b/src/Config/Config_Common.cpp index 634a4337f..2da152dcc 100644 --- a/src/Config/Config_Common.cpp +++ b/src/Config/Config_Common.cpp @@ -130,8 +130,7 @@ std::string getProperty(xmlNodePtr theNode, const char* thePropName) bool getBooleanAttribute(xmlNodePtr theNode, const char* theAttributeName, bool theDefault) { - std::string prop = getProperty(theNode, theAttributeName); - std::transform(prop.begin(), prop.end(), prop.begin(), ::tolower); + std::string prop = normalize(getProperty(theNode, theAttributeName)); bool result = theDefault; if (prop == "true" || prop == "1") { result = true; @@ -140,3 +139,17 @@ bool getBooleanAttribute(xmlNodePtr theNode, const char* theAttributeName, bool } return result; } + +CONFIG_EXPORT std::string normalize(const char* theString) +{ + if (!theString) + return std::string(); + return normalize(std::string(theString)); +} + +CONFIG_EXPORT std::string normalize(const std::string& theString) +{ + std::string result = theString; + std::transform(result.begin(), result.end(), result.begin(), ::tolower); + return result; +}