1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef CONFIG_DATAMODELREADER_H_
22 #define CONFIG_DATAMODELREADER_H_
24 #include <Config_def.h>
25 #include <Config_XMLReader.h>
31 * \class Config_DataModelReader
33 * \brief Class that reads data model definition XML for
34 * further processing in the XGUI_DataModel
36 class Config_DataModelReader : public Config_XMLReader
42 CONFIG_EXPORT Config_DataModelReader();
43 CONFIG_EXPORT virtual ~Config_DataModelReader();
45 // ROOT folders propertiues *****************
46 /// Returns name of type of tree items in root
47 CONFIG_EXPORT std::string rootType() const { return myRootTypes; }
49 /// Returns number of folders under root
50 CONFIG_EXPORT size_t rootFoldersNumber() const { return myRootFolderNames.size(); }
52 /// Returns name of the folder by its Id
53 /// \param theId id of the folder
54 CONFIG_EXPORT std::string rootFolderName(int theId) const { return myRootFolderNames[theId]; }
56 /// Returns data type in the folder by its Id
57 /// \param theId id of the folder
58 CONFIG_EXPORT std::string rootFolderType(int theId) const { return myRootFolderTypes[theId]; }
60 /// Returns icon of a folder by its Id
61 /// \param theId id of the folder
62 CONFIG_EXPORT std::string rootFolderIcon(int theId) const { return myRootFolderIcons[theId]; }
64 /// Returns id of a folder containing the given type
65 /// \param theType type of objects in folder
66 CONFIG_EXPORT int rootFolderId(std::string theType) const;
68 /// Returns true if the folder can be shown without items
69 /// \param theId id of the folder
70 CONFIG_EXPORT bool rootShowEmpty(int theId) const { return myRootFolderShowEmpty[theId]; }
72 /// Returns list of features attached to folder with name theFolderName in sub-document
73 /// \param theFolderName a name of the folder
74 CONFIG_EXPORT std::string rootFolderFeatures(const std::string& theFolderName) const;
77 // SUB folders propertiues ********************
78 /// Returns name of type of tree items in sub document
79 CONFIG_EXPORT std::string subType() const { return mySubTypes; }
81 /// Returns number of folders under sub document
82 CONFIG_EXPORT size_t subFoldersNumber() const { return mySubFolderNames.size(); }
84 /// Returns name of the folder by its Id
85 /// \param theId id of the folder
86 CONFIG_EXPORT std::string subFolderName(int theId) const { return mySubFolderNames[theId]; }
88 /// Returns data type in the folder by its Id
89 /// \param theId id of the folder
90 CONFIG_EXPORT std::string subFolderType(int theId) const { return mySubFolderTypes[theId]; }
92 /// Returns icon of a folder by its Id
93 /// \param theId id of the folder
94 CONFIG_EXPORT std::string subFolderIcon(int theId) const { return mySubFolderIcons[theId]; }
96 /// Returns true if the folder can be shown without items
97 /// \param theId id of the folder
98 CONFIG_EXPORT bool subShowEmpty(int theId) const { return mySubFolderShowEmpty[theId]; }
100 /// Returns id of a folder containing the given type
101 /// \param theType type of objects in folder
102 CONFIG_EXPORT int subFolderId(std::string theType) const;
104 /// Returns list of features attached to folder with name theFolderName in sub-document
105 /// \param theFolderName a name of the folder
106 CONFIG_EXPORT std::string subFolderFeatures(const std::string& theFolderName) const;
109 /// Returns true if the sub-document data tree has to be attached to Part Result node
110 /// Otherwise it has to be connected to Part feature node
111 CONFIG_EXPORT bool isAttachToResult() const { return myIsResultLink; }
114 /// Overloaded method. Defines how to process each node
115 virtual void processNode(xmlNodePtr theNode);
120 /// Root document data
121 std::vector<std::string> myRootFolderNames;
122 std::vector<std::string> myRootFolderTypes;
123 std::vector<std::string> myRootFolderIcons;
124 std::vector<std::string> myRootFeaturesList;
125 std::vector<bool> myRootFolderShowEmpty;
127 std::string myRootTypes;
129 /// Sub document data
130 std::vector<std::string> mySubFolderNames;
131 std::vector<std::string> mySubFolderTypes;
132 std::vector<std::string> mySubFolderIcons;
133 std::vector<std::string> mySubFeaturesList;
134 std::vector<bool> mySubFolderShowEmpty;
137 std::string mySubTypes;