]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/Config/Config_DataModelReader.cpp
Salome HOME
Parameters manager implementation
[modules/shaper.git] / src / Config / Config_DataModelReader.cpp
index e9113e85e9bb99c1058a6f122b578814714d8b61..b02ae823c92bbfda2cb7be86ab79f224d2a11a90 100644 (file)
@@ -33,6 +33,7 @@ void Config_DataModelReader::processNode(xmlNodePtr theNode)
    
     std::string aIcon = getProperty(theNode, NODE_ICON);
     std::string aEmpty = getProperty(theNode, SHOW_EMPTY);
+    std::string aFeatures = getProperty(theNode, FOLDER_FEATURES);
     std::string::iterator aIt;
     for (aIt = aEmpty.begin(); aIt != aEmpty.end(); aIt++) {
       (*aIt) = toupper(*aIt);
@@ -44,11 +45,13 @@ void Config_DataModelReader::processNode(xmlNodePtr theNode)
       myRootFolderTypes.push_back(aGroupType);
       myRootFolderIcons.push_back(aIcon);
       myRootFolderShowEmpty.push_back(aIsEmpty);
+      myRootFeaturesList.push_back(aFeatures);
    } else {
       mySubFolderNames.push_back(aName);
       mySubFolderTypes.push_back(aGroupType);
       mySubFolderIcons.push_back(aIcon);
       mySubFolderShowEmpty.push_back(aIsEmpty);
+      mySubFeaturesList.push_back(aFeatures);
    }
   } else if  (isNode(theNode, ROOT_DOCUMENT, NULL)) {
     isRootReading = true;
@@ -86,3 +89,35 @@ int Config_DataModelReader::subFolderId(std::string theType) const
   }
   return -1;
 }
+
+std::string getFolderFeatures(const std::string& theFolderName, 
+                    const std::vector<std::string>& theNames,
+                    const std::vector<std::string>& theFeatures)
+{
+  int aId;
+  bool aFound = false;
+  std::vector<std::string>::const_iterator aIt;
+  for(aIt = theNames.cbegin(), aId = 0; aIt != theNames.cend(); ++aIt, ++aId) {
+    if ((*aIt) == theFolderName) {
+      aFound = true;
+      break;
+    }
+  }
+  if (aFound)
+    return theFeatures.at(aId);
+  return std::string();
+}
+
+std::string Config_DataModelReader::
+  subFolderFeatures(const std::string& theFolderName) const
+{
+  return getFolderFeatures(theFolderName, mySubFolderNames, mySubFeaturesList);
+}
+
+
+std::string Config_DataModelReader::
+  rootFolderFeatures(const std::string& theFolderName) const
+{
+  return getFolderFeatures(theFolderName, myRootFolderNames, myRootFeaturesList);
+}
+