0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / CDF / CDF_Store.hxx
CommitLineData
42cf5bc1 1// Created on: 1995-11-13
2// Created by: Jean-Louis Frenkel
3// Copyright (c) 1995-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _CDF_Store_HeaderFile
18#define _CDF_Store_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Boolean.hxx>
25#include <TCollection_ExtendedString.hxx>
26#include <PCDM_StoreStatus.hxx>
27#include <CDF_TryStoreStatus.hxx>
28#include <Standard_ExtString.hxx>
29#include <CDF_StoreSetNameStatus.hxx>
30#include <CDF_SubComponentStatus.hxx>
31class CDF_StoreList;
32class CDM_Document;
33class TCollection_ExtendedString;
34
35
36
37class CDF_Store
38{
39public:
40
41 DEFINE_STANDARD_ALLOC
42
43
44 //! creates a store list from the document of the current selection.
45 Standard_EXPORT CDF_Store(const Handle(CDM_Document)& aDocument);
46
47 //! Checks will make the following control. Check must be used before
48 //! using Create method. Check will not be done twice by Create.
49 //!
50 //! 1) controls whether there is one document in the current selection.
51 //! 2) controls whether there is a storage driver for the document.
52 //! 3) controls whether the applicationdatatype associated with the driver
53 //! exists as metadata in the metadata manager (Design Manager for example).
54 //! 4) controls whether there is a storage driver for each subcomponents
55 //! of the document if there are. If the control fails for a subcomponent,
56 //! the control stops and name and type of this subcomponent can be get
57 //! with LastName method
58 //! 5) controls whether the applicationdatatype associated with the driver of
59 //! each subcomponent exists as metadata in the metadata manager
60 //! (Design Manager for example). If the control fails for a subcomponent,
61 //! the control stops and name and type of this subcomponent can be get
62 //! with LastName method
63 Standard_EXPORT CDF_TryStoreStatus Check();
64
65 //! in the case of a subcomponent for which no storage driver exists,
66 //! returns the name of the subcomponent if there is one.
67 Standard_EXPORT Standard_ExtString LastName() const;
68
69 //! returns the folder in which the current document will be stored.
70 Standard_EXPORT Standard_ExtString Folder() const;
71
72 //! returns the name under which the current document will be stored
73 Standard_EXPORT Standard_ExtString Name() const;
74
75 //! returns true if the current document is already stored
76 Standard_EXPORT Standard_Boolean IsStored() const;
77
78 Standard_EXPORT Standard_Boolean IsModified() const;
79
80 Standard_EXPORT Standard_Boolean CurrentIsConsistent() const;
81
82 Standard_EXPORT Standard_Boolean IsConsistent() const;
83
84 Standard_EXPORT Standard_Boolean HasAPreviousVersion() const;
85
86 Standard_EXPORT Standard_ExtString PreviousVersion() const;
87
88 //! returns true if the currentdocument is the main one, ie the document
89 //! of the current selection.
90 Standard_EXPORT Standard_Boolean IsMainDocument() const;
91
92 //! defines the folder in which the document should be
93 //! stored. returns Standard_True if the Folder exists,
94 //! Standard_False otherwise.
95 Standard_EXPORT Standard_Boolean SetFolder (const TCollection_ExtendedString& aFolder);
96
97 //! defines the name under which the document should be stored.
98 Standard_EXPORT CDF_StoreSetNameStatus SetName (const Standard_ExtString aName);
99
100 Standard_EXPORT void SetComment (const Standard_ExtString aComment);
101
102 Standard_EXPORT Standard_ExtString Comment() const;
103
104 //! defines the name under which the document should be stored.
105 //! uses for example after modification of the folder.
106 Standard_EXPORT CDF_StoreSetNameStatus RecheckName();
107
108 Standard_EXPORT Standard_Boolean SetPreviousVersion (const Standard_ExtString aPreviousVersion);
109
110 Standard_EXPORT void Realize();
111
112 //! returns the complete path of the created meta-data.
113 Standard_EXPORT Standard_ExtString Path() const;
114
115 //! returns the path of the previous store is the object
116 //! is already stored, otherwise an empty string;
117 Standard_EXPORT Standard_ExtString MetaDataPath() const;
118
119 //! returns the description of the format of the main object.
120 Standard_EXPORT Standard_ExtString Description() const;
121
122 //! Allows to Start a new Iteration from beginning
123 Standard_EXPORT void InitComponent();
124
125 //! Returns True if there are more entries to return
126 Standard_EXPORT Standard_Boolean MoreComponent() const;
127
128 //! Go to the next entry
129 //! (if there is not, Value will raise an exception)
130 Standard_EXPORT void NextComponent();
131
132 Standard_EXPORT void SetCurrent();
133
134 //! Returns item value of current entry
135 Standard_EXPORT Standard_ExtString Component() const;
136
137 Standard_EXPORT Standard_Boolean HasSubComponents() const;
138
139 Standard_EXPORT CDF_SubComponentStatus SubComponentStatus (const Standard_ExtString aPresentation) const;
140
141 Standard_EXPORT void SetCurrent (const Standard_ExtString aPresentation);
142
143 //! the two following methods can
144 //! be used just after Realize or Import -- method to know if
145 //! thes methods worked correctly, and if not why.
146 Standard_EXPORT void SetMain();
147
148 Standard_EXPORT PCDM_StoreStatus StoreStatus() const;
149
150 Standard_EXPORT Standard_ExtString AssociatedStatusText() const;
151
152 //! defines the name under which the document should be stored.
153 Standard_EXPORT CDF_StoreSetNameStatus SetName (const TCollection_ExtendedString& aName);
154
155 //! defines the folder in which the document should be
156 //! stored. returns Standard_True if the Folder exists,
157 //! Standard_False otherwise.
158 Standard_EXPORT Standard_Boolean SetFolder (const Standard_ExtString aFolder);
159
160
161
162
163protected:
164
165
166
167
168
169private:
170
171
172 Standard_EXPORT CDF_Store();
173
174 Standard_EXPORT void FindDefault();
175
176 Standard_EXPORT void Init();
177
178
179 Handle(CDF_StoreList) myList;
180 Handle(CDM_Document) myMainDocument;
181 Handle(CDM_Document) myCurrentDocument;
182 Standard_Boolean myHasSubComponents;
183 Standard_Boolean myIsMainDocument;
184 TCollection_ExtendedString myLastName;
185 TCollection_ExtendedString myPath;
186 TCollection_ExtendedString myText;
187 PCDM_StoreStatus myStatus;
188
189
190};
191
192
193
194
195
196
197
198#endif // _CDF_Store_HeaderFile