1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
4 * Config_DataModelReader.h
6 * Created on: Jul 21, 2015
10 #ifndef CONFIG_DATAMODELREADER_H_
11 #define CONFIG_DATAMODELREADER_H_
13 #include <Config_def.h>
14 #include <Config_XMLReader.h>
20 * \class Config_DataModelReader
22 * \brief Class that reads data model definition XML for
23 * further processing in the XGUI_DataModel
25 class Config_DataModelReader : public Config_XMLReader
30 * \param theXmlFile - full path to the xml file which will be processed by the reader
32 CONFIG_EXPORT Config_DataModelReader();
33 CONFIG_EXPORT virtual ~Config_DataModelReader();
35 // ROOT folders propertiues *****************
36 /// Returns name of type of tree items in root
37 CONFIG_EXPORT std::string rootType() const { return myRootTypes; }
39 /// Returns number of folders under root
40 CONFIG_EXPORT int rootFoldersNumber() const { return myRootFolderNames.size(); }
42 /// Returns name of the folder by its Id
43 /// \param theId id of the folder
44 CONFIG_EXPORT std::string rootFolderName(int theId) const { return myRootFolderNames[theId]; }
46 /// Returns data type in the folder by its Id
47 /// \param theId id of the folder
48 CONFIG_EXPORT std::string rootFolderType(int theId) const { return myRootFolderTypes[theId]; }
50 /// Returns icon of a folder by its Id
51 /// \param theId id of the folder
52 CONFIG_EXPORT std::string rootFolderIcon(int theId) const { return myRootFolderIcons[theId]; }
54 /// Returns id of a folder containing the given type
55 /// \param theType type of objects in folder
56 CONFIG_EXPORT int rootFolderId(std::string theType) const;
58 /// Returns true if the folder can be shown without items
59 /// \param theId id of the folder
60 CONFIG_EXPORT bool rootShowEmpty(int theId) const { return myRootFolderShowEmpty[theId]; }
64 // SUB folders propertiues ********************
65 /// Returns name of type of tree items in sub document
66 CONFIG_EXPORT std::string subType() const { return mySubTypes; }
68 /// Returns number of folders under sub document
69 CONFIG_EXPORT int subFoldersNumber() const { return mySubFolderNames.size(); }
71 /// Returns name of the folder by its Id
72 /// \param theId id of the folder
73 CONFIG_EXPORT std::string subFolderName(int theId) const { return mySubFolderNames[theId]; }
75 /// Returns data type in the folder by its Id
76 /// \param theId id of the folder
77 CONFIG_EXPORT std::string subFolderType(int theId) const { return mySubFolderTypes[theId]; }
79 /// Returns icon of a folder by its Id
80 /// \param theId id of the folder
81 CONFIG_EXPORT std::string subFolderIcon(int theId) const { return mySubFolderIcons[theId]; }
83 /// Returns true if the folder can be shown without items
84 /// \param theId id of the folder
85 CONFIG_EXPORT bool subShowEmpty(int theId) const { return mySubFolderShowEmpty[theId]; }
87 /// Returns id of a folder containing the given type
88 /// \param theType type of objects in folder
89 CONFIG_EXPORT int subFolderId(std::string theType) const;
91 /// Returns true if the sub-document data tree has to be attached to Part Result node
92 /// Otherwise it has to be connected to Part feature node
93 CONFIG_EXPORT bool isAttachToResult() const { return myIsResultLink; }
96 /// Overloaded method. Defines how to process each node
97 virtual void processNode(xmlNodePtr theNode);
102 /// Root document data
103 std::vector<std::string> myRootFolderNames;
104 std::vector<std::string> myRootFolderTypes;
105 std::vector<std::string> myRootFolderIcons;
106 std::vector<bool> myRootFolderShowEmpty;
108 std::string myRootTypes;
110 /// Sub document data
111 std::vector<std::string> mySubFolderNames;
112 std::vector<std::string> mySubFolderTypes;
113 std::vector<std::string> mySubFolderIcons;
114 std::vector<bool> mySubFolderShowEmpty;
117 std::string mySubTypes;