X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConfig%2FConfig_Common.cpp;h=9c4df7f57c539174f1496979685e7d8b48c113e9;hb=22df2f3d52b661c4cffef91085300cffc02dfa65;hp=634a4337ff73b7c0eb0c92d9eedf9581eece9798;hpb=7ba8e2b57ff8965ae644b538c167b7b301e6e41b;p=modules%2Fshaper.git diff --git a/src/Config/Config_Common.cpp b/src/Config/Config_Common.cpp index 634a4337f..9c4df7f57 100644 --- a/src/Config/Config_Common.cpp +++ b/src/Config/Config_Common.cpp @@ -128,10 +128,14 @@ std::string getProperty(xmlNodePtr theNode, const char* thePropName) return result; } +std::string getNormalizedProperty(xmlNodePtr theNode, const char* thePropName) +{ + return normalize(getProperty(theNode, 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 +144,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; +}