1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef CONFIG_DATAMODELREADER_H_
21 #define CONFIG_DATAMODELREADER_H_
23 #include <Config_def.h>
24 #include <Config_XMLReader.h>
30 * \class Config_DataModelReader
32 * \brief Class that reads data model definition XML for
33 * further processing in the XGUI_DataModel
35 class Config_DataModelReader : public Config_XMLReader
41 CONFIG_EXPORT Config_DataModelReader();
42 CONFIG_EXPORT virtual ~Config_DataModelReader();
44 // ROOT folders propertiues *****************
45 /// Returns name of type of tree items in root
46 CONFIG_EXPORT std::string rootType() const { return myRootTypes; }
48 /// Returns number of folders under root
49 CONFIG_EXPORT size_t rootFoldersNumber() const { return myRootFolderNames.size(); }
51 /// Returns name of the folder by its Id
52 /// \param theId id of the folder
53 CONFIG_EXPORT std::string rootFolderName(int theId) const { return myRootFolderNames[theId]; }
55 /// Returns data type in the folder by its Id
56 /// \param theId id of the folder
57 CONFIG_EXPORT std::string rootFolderType(int theId) const { return myRootFolderTypes[theId]; }
59 /// Returns icon of a folder by its Id
60 /// \param theId id of the folder
61 CONFIG_EXPORT std::string rootFolderIcon(int theId) const { return myRootFolderIcons[theId]; }
63 /// Returns id of a folder containing the given type
64 /// \param theType type of objects in folder
65 CONFIG_EXPORT int rootFolderId(std::string theType) const;
67 /// Returns true if the folder can be shown without items
68 /// \param theId id of the folder
69 CONFIG_EXPORT bool rootShowEmpty(int theId) const { return myRootFolderShowEmpty[theId]; }
71 /// Returns list of features attached to folder with name theFolderName in sub-document
72 /// \param theFolderName a name of the folder
73 CONFIG_EXPORT std::string rootFolderFeatures(const std::string& theFolderName) const;
76 // SUB folders propertiues ********************
77 /// Returns name of type of tree items in sub document
78 CONFIG_EXPORT std::string subType() const { return mySubTypes; }
80 /// Returns number of folders under sub document
81 CONFIG_EXPORT size_t subFoldersNumber() const { return mySubFolderNames.size(); }
83 /// Returns name of the folder by its Id
84 /// \param theId id of the folder
85 CONFIG_EXPORT std::string subFolderName(int theId) const { return mySubFolderNames[theId]; }
87 /// Returns data type in the folder by its Id
88 /// \param theId id of the folder
89 CONFIG_EXPORT std::string subFolderType(int theId) const { return mySubFolderTypes[theId]; }
91 /// Returns icon of a folder by its Id
92 /// \param theId id of the folder
93 CONFIG_EXPORT std::string subFolderIcon(int theId) const { return mySubFolderIcons[theId]; }
95 /// Returns true if the folder can be shown without items
96 /// \param theId id of the folder
97 CONFIG_EXPORT bool subShowEmpty(int theId) const { return mySubFolderShowEmpty[theId]; }
99 /// Returns id of a folder containing the given type
100 /// \param theType type of objects in folder
101 CONFIG_EXPORT int subFolderId(std::string theType) const;
103 /// Returns list of features attached to folder with name theFolderName in sub-document
104 /// \param theFolderName a name of the folder
105 CONFIG_EXPORT std::string subFolderFeatures(const std::string& theFolderName) const;
108 /// Returns true if the sub-document data tree has to be attached to Part Result node
109 /// Otherwise it has to be connected to Part feature node
110 CONFIG_EXPORT bool isAttachToResult() const { return myIsResultLink; }
113 /// Overloaded method. Defines how to process each node
114 virtual void processNode(xmlNodePtr theNode);
119 /// Root document data
120 std::vector<std::string> myRootFolderNames;
121 std::vector<std::string> myRootFolderTypes;
122 std::vector<std::string> myRootFolderIcons;
123 std::vector<std::string> myRootFeaturesList;
124 std::vector<bool> myRootFolderShowEmpty;
126 std::string myRootTypes;
128 /// Sub document data
129 std::vector<std::string> mySubFolderNames;
130 std::vector<std::string> mySubFolderTypes;
131 std::vector<std::string> mySubFolderIcons;
132 std::vector<std::string> mySubFeaturesList;
133 std::vector<bool> mySubFolderShowEmpty;
136 std::string mySubTypes;