Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / Config / Config_WidgetReader.cpp
1 /*
2  * Config_WidgetReader.cpp
3  *
4  *  Created on: Apr 2, 2014
5  *      Author: sbh
6  */
7
8 #include <Config_WidgetReader.h>
9 #include <Config_Keywords.h>
10
11 #include <libxml/parser.h>
12 #include <libxml/tree.h>
13 #include <libxml/xpath.h>
14 #include <libxml/xmlstring.h>
15
16 #ifdef _DEBUG
17 #include <iostream>
18 #endif
19
20
21 Config_WidgetReader::Config_WidgetReader(const std::string& theXmlFile)
22     : Config_XMLReader(theXmlFile)
23
24 {
25 }
26
27 Config_WidgetReader::~Config_WidgetReader()
28 {
29 }
30
31 std::string Config_WidgetReader::featureWidgetCfg(std::string theFeatureName)
32 {
33   return myWidgetCache[theFeatureName];
34 }
35
36 void Config_WidgetReader::processNode(xmlNodePtr theNode)
37 {
38   if (isNode(theNode, NODE_FEATURE, NULL)) {
39     std::string result = "";
40     std::string aNodeName = getProperty(theNode, _ID);
41     if (hasChild(theNode)) {
42       xmlBufferPtr buffer = xmlBufferCreate();
43       int size = xmlNodeDump(buffer, theNode->doc, theNode, 0, 1);
44       result = std::string((char*) buffer->content);
45     }
46     myWidgetCache[aNodeName] = result;
47   }
48 }
49
50 bool Config_WidgetReader::processChildren(xmlNodePtr theNode)
51 {
52   return isNode(theNode, NODE_WORKBENCH, NODE_GROUP, NULL);
53 }