X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConfig%2FConfig_DataModelReader.h;h=4ba610e4d4b991954d248f6b285a679fd287f118;hb=d7144bf137b2ea4f8c7bfbc6b678e1a762e98653;hp=67455d9a8cd982a1a7e1ddff83f7b6c9b1498aee;hpb=8678933843f3bc0dd10ffa6ae6953e94d9e7a44c;p=modules%2Fshaper.git diff --git a/src/Config/Config_DataModelReader.h b/src/Config/Config_DataModelReader.h index 67455d9a8..4ba610e4d 100644 --- a/src/Config/Config_DataModelReader.h +++ b/src/Config/Config_DataModelReader.h @@ -1,11 +1,21 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -/* - * Config_DataModelReader.h - * - * Created on: Jul 21, 2015 - * Author: vsv - */ +// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// #ifndef CONFIG_DATAMODELREADER_H_ #define CONFIG_DATAMODELREADER_H_ @@ -27,16 +37,16 @@ class Config_DataModelReader : public Config_XMLReader public: /*! * Constructor - * \param theXmlFile - full path to the xml file which will be processed by the reader */ CONFIG_EXPORT Config_DataModelReader(); CONFIG_EXPORT virtual ~Config_DataModelReader(); + // ROOT folders propertiues ***************** /// Returns name of type of tree items in root CONFIG_EXPORT std::string rootType() const { return myRootTypes; } - /// Returns number of folders under root - CONFIG_EXPORT int rootFoldersNumber() const { return myRootFolderNames.size(); } + /// Returns number of folders under root + CONFIG_EXPORT size_t rootFoldersNumber() const { return myRootFolderNames.size(); } /// Returns name of the folder by its Id /// \param theId id of the folder @@ -54,17 +64,77 @@ class Config_DataModelReader : public Config_XMLReader /// \param theType type of objects in folder CONFIG_EXPORT int rootFolderId(std::string theType) const; - protected: + /// Returns true if the folder can be shown without items + /// \param theId id of the folder + CONFIG_EXPORT bool rootShowEmpty(int theId) const { return myRootFolderShowEmpty[theId]; } + + /// Returns list of features attached to folder with name theFolderName in sub-document + /// \param theFolderName a name of the folder + CONFIG_EXPORT std::string rootFolderFeatures(const std::string& theFolderName) const; + + + // SUB folders propertiues ******************** + /// Returns name of type of tree items in sub document + CONFIG_EXPORT std::string subType() const { return mySubTypes; } + + /// Returns number of folders under sub document + CONFIG_EXPORT size_t subFoldersNumber() const { return mySubFolderNames.size(); } + + /// Returns name of the folder by its Id + /// \param theId id of the folder + CONFIG_EXPORT std::string subFolderName(int theId) const { return mySubFolderNames[theId]; } + + /// Returns data type in the folder by its Id + /// \param theId id of the folder + CONFIG_EXPORT std::string subFolderType(int theId) const { return mySubFolderTypes[theId]; } + + /// Returns icon of a folder by its Id + /// \param theId id of the folder + CONFIG_EXPORT std::string subFolderIcon(int theId) const { return mySubFolderIcons[theId]; } + + /// Returns true if the folder can be shown without items + /// \param theId id of the folder + CONFIG_EXPORT bool subShowEmpty(int theId) const { return mySubFolderShowEmpty[theId]; } + + /// Returns id of a folder containing the given type + /// \param theType type of objects in folder + CONFIG_EXPORT int subFolderId(std::string theType) const; + + /// Returns list of features attached to folder with name theFolderName in sub-document + /// \param theFolderName a name of the folder + CONFIG_EXPORT std::string subFolderFeatures(const std::string& theFolderName) const; + + + /// Returns true if the sub-document data tree has to be attached to Part Result node + /// Otherwise it has to be connected to Part feature node + CONFIG_EXPORT bool isAttachToResult() const { return myIsResultLink; } + +protected: /// Overloaded method. Defines how to process each node virtual void processNode(xmlNodePtr theNode); private: + bool isRootReading; + + /// Root document data std::vector myRootFolderNames; std::vector myRootFolderTypes; std::vector myRootFolderIcons; + std::vector myRootFeaturesList; + std::vector myRootFolderShowEmpty; std::string myRootTypes; + + /// Sub document data + std::vector mySubFolderNames; + std::vector mySubFolderTypes; + std::vector mySubFolderIcons; + std::vector mySubFeaturesList; + std::vector mySubFolderShowEmpty; + + bool myIsResultLink; + std::string mySubTypes; }; -#endif \ No newline at end of file +#endif