b311480e |
1 | // Copyright (c) 1998-1999 Matra Datavision |
973c2be1 |
2 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
3 | // |
973c2be1 |
4 | // This file is part of Open CASCADE Technology software library. |
b311480e |
5 | // |
d5f74e42 |
6 | // This library is free software; you can redistribute it and/or modify it under |
7 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
8 | // by the Free Software Foundation, with special exception defined in the file |
9 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
10 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
11 | // |
973c2be1 |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
b311480e |
14 | |
42cf5bc1 |
15 | |
16 | #include <Standard_Persistent.hxx> |
17 | #include <Standard_Type.hxx> |
18 | #include <Storage_Data.hxx> |
19 | #include <Storage_HeaderData.hxx> |
20 | #include <Storage_InternalData.hxx> |
7fd59977 |
21 | #include <Storage_Root.hxx> |
42cf5bc1 |
22 | #include <Storage_RootData.hxx> |
23 | #include <Storage_Schema.hxx> |
24 | #include <Storage_TypeData.hxx> |
25 | #include <TCollection_AsciiString.hxx> |
26 | #include <TCollection_ExtendedString.hxx> |
7fd59977 |
27 | |
25e59720 |
28 | IMPLEMENT_STANDARD_RTTIEXT(Storage_Data,Standard_Transient) |
92efcf78 |
29 | |
7fd59977 |
30 | Storage_Data::Storage_Data() |
31 | { |
32 | myRootData = new Storage_RootData; |
33 | myTypeData = new Storage_TypeData; |
34 | myInternal = new Storage_InternalData; |
35 | myHeaderData = new Storage_HeaderData; |
36 | } |
37 | |
38 | void Storage_Data::AddRoot(const Handle(Standard_Persistent)& anObject) const |
39 | { |
40 | Handle(Storage_Root) aRoot = new Storage_Root(TCollection_AsciiString(myRootData->NumberOfRoots()+1),anObject); |
41 | myRootData->AddRoot(aRoot); |
42 | } |
43 | |
44 | void Storage_Data::AddRoot(const TCollection_AsciiString& aName, const Handle(Standard_Persistent)& anObject) const |
45 | { |
46 | Handle(Storage_Root) aRoot = new Storage_Root(aName,anObject); |
47 | myRootData->AddRoot(aRoot); |
48 | } |
49 | |
50 | void Storage_Data::RemoveRoot(const TCollection_AsciiString& anObject) |
51 | { |
52 | myRootData->RemoveRoot(anObject); |
53 | } |
54 | |
55 | Handle(Storage_Root) Storage_Data::Find(const TCollection_AsciiString& aName) const |
56 | { |
57 | return myRootData->Find(aName); |
58 | } |
59 | |
60 | Standard_Integer Storage_Data::NumberOfRoots() const |
61 | { |
62 | return myRootData->NumberOfRoots(); |
63 | } |
64 | |
65 | Standard_Boolean Storage_Data::IsRoot(const TCollection_AsciiString& aName) const |
66 | { |
67 | return myRootData->IsRoot(aName); |
68 | } |
69 | |
70 | Handle(Storage_HSeqOfRoot) Storage_Data::Roots() const |
71 | { |
72 | return myRootData->Roots(); |
73 | } |
74 | |
75 | Standard_Integer Storage_Data::NumberOfTypes() const |
76 | { |
77 | return myTypeData->NumberOfTypes(); |
78 | } |
79 | |
80 | Standard_Boolean Storage_Data::IsType(const TCollection_AsciiString& aName) const |
81 | { |
82 | return myTypeData->IsType(aName); |
83 | } |
84 | |
85 | Handle(TColStd_HSequenceOfAsciiString) Storage_Data::Types() const |
86 | { |
87 | return myTypeData->Types(); |
88 | } |
89 | |
90 | Handle(Storage_RootData) Storage_Data::RootData() const |
91 | { |
92 | return myRootData; |
93 | } |
94 | |
95 | Handle(Storage_TypeData) Storage_Data::TypeData() const |
96 | { |
97 | return myTypeData; |
98 | } |
99 | |
100 | Handle(Storage_InternalData) Storage_Data::InternalData() const |
101 | { |
102 | return myInternal; |
103 | } |
104 | |
105 | Handle(Storage_HeaderData) Storage_Data::HeaderData() const |
106 | { |
107 | return myHeaderData; |
108 | } |
109 | |
110 | void Storage_Data::Clear() const |
111 | { |
112 | myInternal->Clear(); |
113 | myTypeData->Clear(); |
114 | } |
115 | |
116 | // HEADER |
117 | |
118 | TCollection_AsciiString Storage_Data::CreationDate() const |
119 | { |
120 | return myHeaderData->CreationDate(); |
121 | } |
122 | |
123 | TCollection_AsciiString Storage_Data::SchemaVersion() const |
124 | { |
125 | return myHeaderData->SchemaVersion(); |
126 | } |
127 | |
128 | TCollection_AsciiString Storage_Data::SchemaName() const |
129 | { |
130 | return myHeaderData->SchemaName(); |
131 | } |
132 | |
133 | void Storage_Data::SetApplicationVersion(const TCollection_AsciiString& aVersion) |
134 | { |
135 | myHeaderData->SetApplicationVersion(aVersion); |
136 | } |
137 | |
138 | TCollection_AsciiString Storage_Data::ApplicationVersion() const |
139 | { |
140 | return myHeaderData->ApplicationVersion(); |
141 | } |
142 | |
143 | void Storage_Data::SetApplicationName(const TCollection_ExtendedString& aName) |
144 | { |
145 | myHeaderData->SetApplicationName(aName); |
146 | } |
147 | |
148 | TCollection_ExtendedString Storage_Data::ApplicationName() const |
149 | { |
150 | return myHeaderData->ApplicationName(); |
151 | } |
152 | |
153 | void Storage_Data::AddToUserInfo(const TCollection_AsciiString& theUserInfo) |
154 | { |
155 | myHeaderData->AddToUserInfo(theUserInfo); |
156 | } |
157 | |
158 | const TColStd_SequenceOfAsciiString& Storage_Data::UserInfo() const |
159 | { |
160 | return myHeaderData->UserInfo(); |
161 | } |
162 | |
163 | void Storage_Data::AddToComments(const TCollection_ExtendedString& theUserInfo) |
164 | { |
165 | myHeaderData->AddToComments(theUserInfo); |
166 | } |
167 | |
168 | const TColStd_SequenceOfExtendedString& Storage_Data::Comments() const |
169 | { |
170 | return myHeaderData->Comments(); |
171 | } |
172 | |
173 | Standard_Integer Storage_Data::NumberOfObjects() const |
174 | { |
175 | return myHeaderData->NumberOfObjects(); |
176 | } |
177 | |
178 | TCollection_AsciiString Storage_Data::StorageVersion() const |
179 | { |
180 | return myHeaderData->StorageVersion(); |
181 | } |
182 | |
183 | Storage_Error Storage_Data::ErrorStatus() const |
184 | { |
185 | return myErrorStatus; |
186 | } |
187 | |
188 | void Storage_Data::SetErrorStatus(const Storage_Error anError) |
189 | { |
190 | myErrorStatus = anError; |
191 | } |
192 | |
193 | void Storage_Data::ClearErrorStatus() |
194 | { |
195 | myErrorStatus = Storage_VSOk; |
196 | myErrorStatusExt.Clear(); |
197 | myHeaderData->ClearErrorStatus(); |
198 | myRootData->ClearErrorStatus(); |
199 | myTypeData->ClearErrorStatus(); |
200 | } |
201 | |
202 | void Storage_Data::SetDataType(const TCollection_ExtendedString& aName) |
203 | { |
204 | myHeaderData->SetDataType(aName); |
205 | } |
206 | |
207 | TCollection_ExtendedString Storage_Data::DataType() const |
208 | { |
209 | return myHeaderData->DataType(); |
210 | } |
211 | |
212 | TCollection_AsciiString Storage_Data::ErrorStatusExtension() const |
213 | { |
214 | return myErrorStatusExt; |
215 | } |
216 | |
217 | void Storage_Data::SetErrorStatusExtension(const TCollection_AsciiString& anErrorExt) |
218 | { |
219 | myErrorStatusExt = anErrorExt; |
220 | } |