Salome HOME
pre-design of XML based tree model
[modules/shaper.git] / src / Config / Config_DataModelReader.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 /*
4  * Config_DataModelReader.h
5  *
6  *  Created on: Jul 21, 2015
7  *      Author: vsv
8  */
9
10 #ifndef CONFIG_DATAMODELREADER_H_
11 #define CONFIG_DATAMODELREADER_H_
12
13 #include <Config_def.h>
14 #include <Config_XMLReader.h>
15
16 #include <vector>
17 #include <string>
18
19 /*!
20  * \class Config_DataModelReader
21  * \ingroup Config
22  * \brief Class that reads data model definition XML for
23  * further processing in the XGUI_DataModel
24  */
25 class Config_DataModelReader : 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_DataModelReader();
33   CONFIG_EXPORT virtual ~Config_DataModelReader();
34
35   /// Returns name of type of tree items in root
36   CONFIG_EXPORT std::string rootType() const { return myRootTypes; }
37
38   /// Returns number of folders under root 
39   CONFIG_EXPORT int rootFoldersNumber() const { return myRootFolderNames.size(); }
40
41   /// Returns name of the folder by its Id
42   /// \param theId id of the folder
43   CONFIG_EXPORT std::string rootFolderName(int theId) const { return myRootFolderNames[theId]; }
44
45   /// Returns data type in the folder by its Id
46   /// \param theId id of the folder
47   CONFIG_EXPORT std::string rootFolderType(int theId) const { return myRootFolderTypes[theId]; }
48
49   /// Returns icon of a folder by its Id
50   /// \param theId id of the folder
51   CONFIG_EXPORT std::string rootFolderIcon(int theId) const { return myRootFolderIcons[theId]; }
52
53   /// Returns id of a folder containing the given type
54   /// \param theType type of objects in folder
55   CONFIG_EXPORT int rootFolderId(std::string theType) const;
56
57  protected:
58   /// Overloaded method. Defines how to process each node
59   virtual void processNode(xmlNodePtr theNode);
60
61 private:
62   std::vector<std::string> myRootFolderNames;
63   std::vector<std::string> myRootFolderTypes;
64   std::vector<std::string> myRootFolderIcons;
65
66   std::string myRootTypes;
67 };
68
69
70 #endif