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