Salome HOME
Issue #355 Delete: elements of sketch and constraints
[modules/shaper.git] / src / Config / Config_Common.cpp
index 634a4337ff73b7c0eb0c92d9eedf9581eece9798..9c4df7f57c539174f1496979685e7d8b48c113e9 100644 (file)
@@ -128,10 +128,14 @@ std::string getProperty(xmlNodePtr theNode, const char* thePropName)
   return result;\r
 }\r
 \r
+std::string getNormalizedProperty(xmlNodePtr theNode, const char* thePropName)\r
+{\r
+  return normalize(getProperty(theNode, thePropName));\r
+}\r
+\r
 bool getBooleanAttribute(xmlNodePtr theNode, const char* theAttributeName, bool theDefault)\r
 {\r
-  std::string prop = getProperty(theNode, theAttributeName);\r
-  std::transform(prop.begin(), prop.end(), prop.begin(), ::tolower);\r
+  std::string prop = normalize(getProperty(theNode, theAttributeName));\r
   bool result = theDefault;\r
   if (prop == "true" || prop == "1") {\r
     result = true;\r
@@ -140,3 +144,17 @@ bool getBooleanAttribute(xmlNodePtr theNode, const char* theAttributeName, bool
   }\r
   return result;\r
 }\r
+\r
+CONFIG_EXPORT std::string normalize(const char* theString)\r
+{\r
+  if (!theString)\r
+    return std::string();\r
+  return normalize(std::string(theString));\r
+}\r
+\r
+CONFIG_EXPORT std::string normalize(const std::string& theString)\r
+{\r
+  std::string result = theString;\r
+  std::transform(result.begin(), result.end(), result.begin(), ::tolower);\r
+  return result;\r
+}\r