Salome HOME
Merge branch 'Dev_0.6.1' of newgeom:newgeom into Dev_0.6.1
[modules/shaper.git] / src / Config / Config_FeatureReader.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 /*
4  * Config_FeatureReader.h
5  *
6  *  Created on: Mar 20, 2014
7  *      Author: sbh
8  */
9
10 #ifndef CONFIG_FEATUREREADER_H_
11 #define CONFIG_FEATUREREADER_H_
12
13 #include <Config_def.h>
14 #include <Config_XMLReader.h>
15 #include <memory>
16
17 #include <string>
18 #include <list>
19 #include <map>
20
21 class Config_FeatureMessage;
22
23 class Config_FeatureReader : public Config_XMLReader
24 {
25  public:
26   Config_FeatureReader(const std::string& theXmlFile, const std::string& theLibraryName,
27                        const char* theEventGenerated = 0);
28   virtual ~Config_FeatureReader();
29
30   std::list<std::string> features() const;
31
32  protected:
33   void processNode(xmlNodePtr aNode);
34   bool processChildren(xmlNodePtr aNode);
35
36   void fillFeature(xmlNodePtr theRoot, 
37                    const std::shared_ptr<Config_FeatureMessage>& outFeatureMessage);
38
39   void storeAttribute(xmlNodePtr theNode, const char* theNodeAttribute);
40   std::string restoreAttribute(xmlNodePtr theNode, const char* theNodeAttribute);
41   std::string restoreAttribute(const char* theNodeName, const char* theNodeAttribute);
42
43  private:
44   /// A map to store all parent's attributes.
45   /// The key has from "Node_Name:Node_Attribute"
46   std::map<std::string, std::string> myParentAttributes;
47   std::string myLibraryName;
48
49   std::list<std::string> myFeatures;
50   /// event generated on feature data sending, by default it is Config_FeatureMessage::GUI_EVENT()
51   const char* myEventGenerated;
52   bool myIsProcessWidgets;
53 };
54
55 #endif /* CONFIG_FEATUREREADER_H_ */