1 // Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
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 SIMANIO_DOCUMENT_H
21 #define SIMANIO_DOCUMENT_H
23 #include "SimanIO.hxx"
28 ///! Kinds of automatic actions, accessible for SIMAN file
29 enum AutomaticProcessing {
34 ///! Possible states of the SIMAN file
39 ///! Action document data
41 std::string url; ///< document url in SIMAN
42 bool result; ///< if true, document is result, the source otherwise
43 AutomaticProcessing proc; ///< processing kind
44 FileState state; ///< state of the document
45 int id; ///< identifier of the file
49 * \brief Class for storage and store CFG file document information.
51 class SIMANIO_EXPORT SimanIO_Document {
52 std::string myName; ///< name of the document
53 typedef std::list<SimanIO_File> DocumentFiles;
54 DocumentFiles myFiles; ///< files of the document
57 * Creates the empty, default document.
62 * Defines the document name.
63 * \param theName name of the document
65 void SetName(const char* theName);
68 * Returns the name of the document.
70 const char* Name() const;
73 * Appends the file to this document.
74 * \param isResult if it is true, the document is resulting document, if false - the input document for the activity
75 * \param theURL path to the file
76 * \param theProc automatic processing kind
77 * \param theState file state
79 void AddFile(const bool isResult, const char* theURL,
80 const AutomaticProcessing theProc, const FileState theState);
83 * Appends the file to this document.
84 * \param theFile file with all fields filled
86 void AddFile(const SimanIO_File& theFile);
89 * Returns stored file or empty file.
90 * \param theId identifier of the file
91 * \returns reference to the file, located in the document
93 const SimanIO_File& File(const int theId) const;
95 //! Iterator for activity documents browsing
96 class SIMANIO_EXPORT FilesIterator {
97 DocumentFiles::iterator myIter; ///< iterator by the file of the document
98 DocumentFiles::const_iterator myEnd; ///< end iteration indicator
100 ///! Launches the iterator
101 FilesIterator(/*const*/ SimanIO_Document& theDocument);
102 ///! Iterates to the next file of the document.
104 ///! Returns tru if the current file exists.
106 ///! Returns true if the current file is resulting document.
107 const bool IsResult();
108 ///! Returns the current file URL.
110 ///! Set the new URL of the file.
111 void SetURL(const char* theURL);
112 ///! Returns the processing kind
113 const AutomaticProcessing GetProcessing();
114 ///! Returns the file state
115 const FileState GetState();
116 ///! Returns the file Id