1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
4 * Config_FeatureReader.h
6 * Created on: Mar 20, 2014
10 #ifndef CONFIG_FEATUREREADER_H_
11 #define CONFIG_FEATUREREADER_H_
13 #include <Config_def.h>
14 #include <Config_XMLReader.h>
21 class Config_FeatureMessage;
24 * \class Config_FeatureReader
26 * \brief Class to process feature's xml definition.
28 class Config_FeatureReader : public Config_XMLReader
32 Config_FeatureReader(const std::string& theXmlFile,
33 const std::string& theLibraryName,
34 const char* theEventGenerated = 0);
35 virtual ~Config_FeatureReader();
36 /// Returns list of all features defined in reader's file
37 std::list<std::string> features() const;
40 /// Overloaded method. Defines how to process each node
41 virtual void processNode(xmlNodePtr aNode);
43 /// Overloaded method. Clears attribute cache on extit from attribute's node
44 virtual void cleanup(xmlNodePtr aNode);
46 /// Overloaded method. Defines if the given node should be parsed recursively
47 virtual bool processChildren(xmlNodePtr aNode);
49 /// Fills feature message
50 void fillFeature(xmlNodePtr theRoot,
51 const std::shared_ptr<Config_FeatureMessage>& outFeatureMessage);
53 /// Stores an attribute in internal map for later use.
54 /// Key is "Node_Name:Node_Attribute" and value is getProperty(theNodeAttribute)
55 void storeAttribute(xmlNodePtr theNode, const char* theNodeAttribute);
56 /// Restores an attribute from internal map.
57 std::string restoreAttribute(xmlNodePtr theNode, const char* theNodeAttribute);
58 /// Restores an attribute from internal map.
59 std::string restoreAttribute(const char* theNodeName, const char* theNodeAttribute);
61 bool cleanupAttribute(xmlNodePtr theNode, const char* theNodeAttribute);
62 bool cleanupAttribute(const char* theNodeName, const char* theNodeAttribute);
65 /// A map to store all parent's attributes.
66 /// The key has from "Node_Name:Node_Attribute"
67 std::map<std::string, std::string> myParentAttributes;
68 std::string myLibraryName;
70 std::list<std::string> myFeatures;
71 /// event generated on feature data sending, by default it is Config_FeatureMessage::GUI_EVENT()
72 const char* myEventGenerated;
73 bool myIsProcessWidgets;
76 #endif /* CONFIG_FEATUREREADER_H_ */