SHAPER 9.16.0
Config_DataModelReader.h
1// Copyright (C) 2014-2026 CEA, EDF
2//
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.
7//
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.
12//
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
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef CONFIG_DATAMODELREADER_H_
21#define CONFIG_DATAMODELREADER_H_
22
23#include <Config_def.h>
24#include <Config_XMLReader.h>
25
26#include <vector>
27#include <string>
28
36{
37 public:
41 CONFIG_EXPORT Config_DataModelReader();
42 CONFIG_EXPORT virtual ~Config_DataModelReader();
43
44 // ROOT folders propertiues *****************
46 CONFIG_EXPORT std::string rootType() const { return myRootTypes; }
47
49 CONFIG_EXPORT size_t rootFoldersNumber() const { return myRootFolderNames.size(); }
50
53 CONFIG_EXPORT std::string rootFolderName(int theId) const { return myRootFolderNames[theId]; }
54
57 CONFIG_EXPORT std::string rootFolderType(int theId) const { return myRootFolderTypes[theId]; }
58
61 CONFIG_EXPORT std::string rootFolderIcon(int theId) const { return myRootFolderIcons[theId]; }
62
65 CONFIG_EXPORT int rootFolderId(std::string theType) const;
66
69 CONFIG_EXPORT bool rootShowEmpty(int theId) const { return myRootFolderShowEmpty[theId]; }
70
73 CONFIG_EXPORT std::string rootFolderFeatures(const std::string& theFolderName) const;
74
75
76 // SUB folders propertiues ********************
78 CONFIG_EXPORT std::string subType() const { return mySubTypes; }
79
81 CONFIG_EXPORT size_t subFoldersNumber() const { return mySubFolderNames.size(); }
82
85 CONFIG_EXPORT std::string subFolderName(int theId) const { return mySubFolderNames[theId]; }
86
89 CONFIG_EXPORT std::string subFolderType(int theId) const { return mySubFolderTypes[theId]; }
90
93 CONFIG_EXPORT std::string subFolderIcon(int theId) const { return mySubFolderIcons[theId]; }
94
97 CONFIG_EXPORT bool subShowEmpty(int theId) const { return mySubFolderShowEmpty[theId]; }
98
101 CONFIG_EXPORT int subFolderId(std::string theType) const;
102
105 CONFIG_EXPORT std::string subFolderFeatures(const std::string& theFolderName) const;
106
107
110 CONFIG_EXPORT bool isAttachToResult() const { return myIsResultLink; }
111
112protected:
114 virtual void processNode(xmlNodePtr theNode);
115
116private:
117 bool isRootReading;
118
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;
125
126 std::string myRootTypes;
127
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;
134
135 bool myIsResultLink;
136 std::string mySubTypes;
137};
138
139
140#endif
Class that reads data model definition XML for further processing in the XGUI_DataModel.
Definition: Config_DataModelReader.h:36
CONFIG_EXPORT std::string rootFolderIcon(int theId) const
Returns icon of a folder by its Id.
Definition: Config_DataModelReader.h:61
CONFIG_EXPORT std::string subType() const
Returns name of type of tree items in sub document.
Definition: Config_DataModelReader.h:78
CONFIG_EXPORT std::string rootFolderFeatures(const std::string &theFolderName) const
Returns list of features attached to folder with name theFolderName in sub-document.
Definition: Config_DataModelReader.cpp:130
CONFIG_EXPORT bool isAttachToResult() const
Returns true if the sub-document data tree has to be attached to Part Result node Otherwise it has to...
Definition: Config_DataModelReader.h:110
CONFIG_EXPORT bool subShowEmpty(int theId) const
Returns true if the folder can be shown without items.
Definition: Config_DataModelReader.h:97
CONFIG_EXPORT bool rootShowEmpty(int theId) const
Returns true if the folder can be shown without items.
Definition: Config_DataModelReader.h:69
virtual void processNode(xmlNodePtr theNode)
Overloaded method. Defines how to process each node.
Definition: Config_DataModelReader.cpp:39
CONFIG_EXPORT std::string subFolderType(int theId) const
Returns data type in the folder by its Id.
Definition: Config_DataModelReader.h:89
CONFIG_EXPORT int subFolderId(std::string theType) const
Returns id of a folder containing the given type.
Definition: Config_DataModelReader.cpp:93
CONFIG_EXPORT std::string subFolderName(int theId) const
Returns name of the folder by its Id.
Definition: Config_DataModelReader.h:85
CONFIG_EXPORT size_t subFoldersNumber() const
Returns number of folders under sub document.
Definition: Config_DataModelReader.h:81
CONFIG_EXPORT std::string rootFolderName(int theId) const
Returns name of the folder by its Id.
Definition: Config_DataModelReader.h:53
CONFIG_EXPORT std::string rootFolderType(int theId) const
Returns data type in the folder by its Id.
Definition: Config_DataModelReader.h:57
CONFIG_EXPORT std::string subFolderFeatures(const std::string &theFolderName) const
Returns list of features attached to folder with name theFolderName in sub-document.
Definition: Config_DataModelReader.cpp:123
CONFIG_EXPORT std::string subFolderIcon(int theId) const
Returns icon of a folder by its Id.
Definition: Config_DataModelReader.h:93
CONFIG_EXPORT Config_DataModelReader()
Definition: Config_DataModelReader.cpp:30
CONFIG_EXPORT std::string rootType() const
Returns name of type of tree items in root.
Definition: Config_DataModelReader.h:46
CONFIG_EXPORT int rootFolderId(std::string theType) const
Returns id of a folder containing the given type.
Definition: Config_DataModelReader.cpp:82
CONFIG_EXPORT size_t rootFoldersNumber() const
Returns number of folders under root.
Definition: Config_DataModelReader.h:49
Base class for all libxml readers. Provides high-level API for all xml operations.
Definition: Config_XMLReader.h:48