Salome HOME
Issue #1369: Added "SubShapes" feature.
[modules/shaper.git] / src / Config / Config_WidgetReader.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 /*
4  * Config_WidgetReader.h
5  *
6  *  Created on: Apr 2, 2014
7  *      Author: sbh
8  */
9
10 #ifndef CONFIG_WIDGETREADER_H_
11 #define CONFIG_WIDGETREADER_H_
12
13 #include <Config_def.h>
14 #include <Config_XMLReader.h>
15
16 #include <map>
17 #include <string>
18
19 /*!
20  * \class Config_WidgetReader
21  * \ingroup Config
22  * \brief Class that dumps xml definitions of widgets for
23  * further processing in the WidgetFactory
24  */
25 class Config_WidgetReader : public Config_XMLReader
26 {
27  public:
28   /*!
29    * Constructor
30    * \param theXmlFile - full path to the xml file which will be processed by the reader
31    */
32   CONFIG_EXPORT Config_WidgetReader(const std::string& theXmlFile);
33   CONFIG_EXPORT virtual ~Config_WidgetReader();
34
35   /// Extract feature's widget configuration from local cache, stored on node processing
36   CONFIG_EXPORT std::string featureWidgetCfg(const std::string& theFeatureName);
37   /// Extract feature's description from local cache, stored on node processing
38   CONFIG_EXPORT std::string featureDescription(const std::string& theFeatureName);
39
40  protected:
41   /// Overloaded method. Defines how to process each node
42   void processNode(xmlNodePtr theNode);
43   /// Overloaded method. Defines if the given node should be parsed recursively
44   bool processChildren(xmlNodePtr theNode);
45   /// Extracts xml definition of the given node and it's children
46   std::string dumpNode(xmlNodePtr theNode);
47   /// Replace all "source" nodes with their content (used before dumping nodes)
48   void resolveSourceNodes(xmlNodePtr theNode);
49
50  private:
51   std::map<std::string, std::string> myWidgetCache;
52   std::map<std::string, std::string> myDescriptionCache;
53
54 };
55
56 #endif /* CONFIG_WIDGETREADER_H_ */