Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / Config / Config_XMLReader.h
1 /*
2  * Config_XMLReader.h
3  *
4  *  Created on: Mar 14, 2014
5  *      Author: sbh
6  */
7
8 #ifndef CONFIG_XMLREADER_H_
9 #define CONFIG_XMLREADER_H_
10
11 #include "Config.h"
12 #include "Config_FeatureMessage.h"
13
14 #include <string>
15 #include <cstdarg>
16
17 //Forward declaration for xmlNodePtr.
18 typedef struct _xmlNode xmlNode;
19 typedef xmlNode *xmlNodePtr;
20 struct _xmlNode;
21
22 class CONFIG_EXPORT Config_XMLReader
23 {
24 public:
25   Config_XMLReader(const std::string& theXmlFile);
26   virtual ~Config_XMLReader();
27
28   void readAll();
29
30 protected:
31   virtual void processNode(xmlNodePtr aNode);
32   virtual bool processChildren(xmlNodePtr aNode);
33
34   xmlNodePtr findRoot();
35   void readRecursively(xmlNodePtr theParent);
36
37   xmlNodePtr node(void* theNode);
38   std::string getProperty(xmlNodePtr theNode, const char* property);
39   /*
40    * Please note that this function should be called with NULL last argument. 
41    * In example: isNode(aNode, "type1", ["type2", ...], NULL);
42    * ", NULL" is required to use unlimited number of arguments.
43    * TODO(sbh): find a way to simplify calling this method.
44    */
45   bool isNode(xmlNodePtr theNode, const char* name, ...);
46
47 private:
48   std::string myDocumentPath;
49 };
50
51 #endif /* CONFIG_XMLREADER_H_ */