1 // Copyright (C) 2013 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.
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
26 ///! Kinds of automatic actions, accessible for SIMAN file
27 enum AutomaticProcessing {
32 ///! Possible states of the SIMAN file
37 ///! Action document data
39 std::string url; ///< document url in SIMAN
40 bool result; ///< if true, document is result, the source otherwise
41 AutomaticProcessing proc; ///< processing kind
42 FileState state; ///< state of the document
43 int id; ///< identifier of the file
47 * \brief Class for storage and store CFG file document information.
49 class SimanIO_Document {
50 std::string myName; ///< name of the document
51 typedef std::list<SimanIO_File> DocumentFiles;
52 DocumentFiles myFiles; ///< files of the document
55 * Creates the empty, default document.
60 * Defines the document name.
61 * \param theName name of the document
63 void SetName(const char* theName);
66 * Returns the name of the document.
68 const char* Name() const;
71 * Appends the file to this document.
72 * \param isResult if it is true, the document is resulting document, if false - the input document for the activity
73 * \param theURL path to the file
74 * \param theProc automatic processing kind
75 * \param theState file state
77 void AddFile(const bool isResult, const char* theURL,
78 const AutomaticProcessing theProc, const FileState theState);
81 * Appends the file to this document.
82 * \param theFile file with all fields filled
84 void AddFile(const SimanIO_File& theFile);
87 * Returns stored file or empty file.
88 * \param theId identifier of the file
89 * \returns reference to the file, located in the document
91 const SimanIO_File& File(const int theId) const;
93 //! Iterator for activity documents browsing
95 DocumentFiles::iterator myIter; ///< iterator by the file of the document
96 DocumentFiles::const_iterator myEnd; ///< end iteration indicator
98 ///! Launches the iterator
99 FilesIterator(/*const*/ SimanIO_Document& theDocument);
100 ///! Iterates to the next file of the document.
102 ///! Returns tru if the current file exists.
104 ///! Returns true if the current file is resulting document.
105 const bool IsResult();
106 ///! Returns the current file URL.
108 ///! Set the new URL of the file.
109 void SetURL(const char* theURL);
110 ///! Returns the processing kind
111 const AutomaticProcessing GetProcessing();
112 ///! Returns the file state
113 const FileState GetState();
114 ///! Returns the file Id