Salome HOME
Merge branch 'master' into Dev_1.1.0
[modules/shaper.git] / src / Config / Config_XMLReader.cpp
index ab15f3621e1a43ea35caf6a4a9e9ad298a3f85c4..c0a0a2ee0a0e4beac70cd5f8fec2f7ea4d2e8004 100644 (file)
@@ -80,6 +80,11 @@ void Config_XMLReader::processNode(xmlNodePtr theNode)
   }
 }
 
+void Config_XMLReader::cleanup(xmlNodePtr)
+{
+  // do nothing;
+}
+
 bool Config_XMLReader::processChildren(xmlNodePtr aNode)
 {
   return true;
@@ -120,6 +125,7 @@ void Config_XMLReader::readRecursively(xmlNodePtr theParent)
     if (processChildren(aNode)) {
       readRecursively(aNode);
     }
+    cleanup(aNode);
   }
 }
 
@@ -161,3 +167,20 @@ std::string Config_XMLReader::restoreAttribute(const char* theNodeName, const ch
   }
   return result;
 }
+
+bool Config_XMLReader::cleanupAttribute(xmlNodePtr theNode, const char* theNodeAttribute)
+{
+  return cleanupAttribute(getNodeName(theNode).c_str(), theNodeAttribute);
+}
+
+bool Config_XMLReader::cleanupAttribute(const char* theNodeName, const char* theNodeAttribute)
+{
+  std::string aKey = std::string(theNodeName) + ":" + std::string(theNodeAttribute);
+  bool result = false;
+  std::map<std::string, std::string>::iterator anEntry = myCachedAttributes.find(aKey);
+  if( anEntry != myCachedAttributes.end()) {
+    myCachedAttributes.erase(anEntry);
+    result = true;
+  }
+  return result;
+}