Version: 9.12.0
DF_Document.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
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 DFDOCUMENT_HXX
21 #define DFDOCUMENT_HXX
22 
23 #include "DF_definitions.hxx"
24 #include "DF_Label.hxx"
25 
26 #include <string>
27 
28 class DF_Application;
29 
30 //Class DF_Document is container for user's data stored as a tree of Labels
31 //with assigned Attributes
32 class DF_Document {
33 public:
34  //Constructor
35  Standard_EXPORT DF_Document(const std::string& theDocumentType);
36 
37  Standard_EXPORT virtual ~DF_Document();
38 
40 
41  //Returns a Label of this Document with entry "0:1"
43 
44  //Returns a root Label with entry "0:"
46 
47  //Returns an ID of this
48  Standard_EXPORT int GetDocumentID() const;
49 
50  //Returns a type of the Document
51  Standard_EXPORT std::string GetDocumentType();
52 
53  //Clears the content of this Document
54  Standard_EXPORT void Clear();
55 
56  //Returns true if this document is empty
57  Standard_EXPORT bool IsEmpty();
58 
59  //Returns true if this document is modified
61 
62  //Returns true if this document is modified
63  Standard_EXPORT void SetModified(bool isModified);
64 
65  //########### Load/Save virtual methods ##
66 
67  //Restores a content of the Document from the std::string theData
68  Standard_EXPORT virtual void Load(const std::string& theData);
69 
70  //Converts a content of the Document into the std::string
71  Standard_EXPORT virtual std::string Save();
72 
73  friend class DF_Application;
74 
75 private:
78  std::string _type;
79  int _id;
80  bool _modified;
82 };
83 
84 #endif
#define Standard_EXPORT
Definition: DF_definitions.hxx:53
Definition: DF_Application.hxx:29
Definition: DF_Document.hxx:32
std::string GetDocumentType()
Definition: DF_Document.cxx:81
bool IsModified()
Definition: DF_Document.cxx:120
DF_Application * _appli
Definition: DF_Document.hxx:81
bool IsEmpty()
Definition: DF_Document.cxx:106
int _id
Definition: DF_Document.hxx:79
virtual void Load(const std::string &theData)
Definition: DF_Document.cxx:133
std::string _type
Definition: DF_Document.hxx:78
void Clear()
Definition: DF_Document.cxx:87
DF_Document(const std::string &theDocumentType)
Definition: DF_Document.cxx:28
int GetDocumentID() const
Definition: DF_Document.cxx:75
void SetModified(bool isModified)
Definition: DF_Document.cxx:126
bool _modified
Definition: DF_Document.hxx:80
DF_Application * GetApplication()
Definition: DF_Document.cxx:40
DF_Label _root
Definition: DF_Document.hxx:77
DF_Label Main()
Definition: DF_Document.cxx:46
virtual std::string Save()
Definition: DF_Document.cxx:139
virtual ~DF_Document()
Definition: DF_Document.cxx:35
DF_Label _main
Definition: DF_Document.hxx:76
DF_Label Root()
Definition: DF_Document.cxx:61
Definition: DF_Label.hxx:65