Increment OCCT version up to 7.4.0
[occt.git] / src / RWStepBasic / RWStepBasic_RWAddress.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <Interface_Check.hxx>
16 #include <RWStepBasic_RWAddress.hxx>
17 #include <StepBasic_Address.hxx>
18 #include <StepData_StepReaderData.hxx>
19 #include <StepData_StepWriter.hxx>
20
21 RWStepBasic_RWAddress::RWStepBasic_RWAddress () {}
22
23 void RWStepBasic_RWAddress::ReadStep
24         (const Handle(StepData_StepReaderData)& data,
25          const Standard_Integer num,
26          Handle(Interface_Check)& ach,
27          const Handle(StepBasic_Address)& ent) const
28 {
29
30
31         // --- Number of Parameter Control ---
32
33         if (!data->CheckNbParams(num,12,ach,"address")) return;
34         // --- own field : internalLocation ---
35
36         Handle(TCollection_HAsciiString) aInternalLocation;
37         Standard_Boolean hasAinternalLocation = Standard_True;
38         if (data->IsParamDefined(num,1)) {
39           //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
40           data->ReadString (num,1,"internal_location",ach,aInternalLocation);
41         }
42         else {
43           hasAinternalLocation = Standard_False;
44           aInternalLocation.Nullify();
45         }
46
47         // --- own field : streetNumber ---
48
49         Handle(TCollection_HAsciiString) aStreetNumber;
50         Standard_Boolean hasAstreetNumber = Standard_True;
51         if (data->IsParamDefined(num,2)) {
52           //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
53           data->ReadString (num,2,"street_number",ach,aStreetNumber);
54         }
55         else {
56           hasAstreetNumber = Standard_False;
57           aStreetNumber.Nullify();
58         }
59
60         // --- own field : street ---
61
62         Handle(TCollection_HAsciiString) aStreet;
63         Standard_Boolean hasAstreet = Standard_True;
64         if (data->IsParamDefined(num,3)) {
65           //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
66           data->ReadString (num,3,"street",ach,aStreet);
67         }
68         else {
69           hasAstreet = Standard_False;
70           aStreet.Nullify();
71         }
72
73         // --- own field : postalBox ---
74
75         Handle(TCollection_HAsciiString) aPostalBox;
76         Standard_Boolean hasApostalBox = Standard_True;
77         if (data->IsParamDefined(num,4)) {
78           //szv#4:S4163:12Mar99 `Standard_Boolean stat4 =` not needed
79           data->ReadString (num,4,"postal_box",ach,aPostalBox);
80         }
81         else {
82           hasApostalBox = Standard_False;
83           aPostalBox.Nullify();
84         }
85
86         // --- own field : town ---
87
88         Handle(TCollection_HAsciiString) aTown;
89         Standard_Boolean hasAtown = Standard_True;
90         if (data->IsParamDefined(num,5)) {
91           //szv#4:S4163:12Mar99 `Standard_Boolean stat5 =` not needed
92           data->ReadString (num,5,"town",ach,aTown);
93         }
94         else {
95           hasAtown = Standard_False;
96           aTown.Nullify();
97         }
98
99         // --- own field : region ---
100
101         Handle(TCollection_HAsciiString) aRegion;
102         Standard_Boolean hasAregion = Standard_True;
103         if (data->IsParamDefined(num,6)) {
104           //szv#4:S4163:12Mar99 `Standard_Boolean stat6 =` not needed
105           data->ReadString (num,6,"region",ach,aRegion);
106         }
107         else {
108           hasAregion = Standard_False;
109           aRegion.Nullify();
110         }
111
112         // --- own field : postalCode ---
113
114         Handle(TCollection_HAsciiString) aPostalCode;
115         Standard_Boolean hasApostalCode = Standard_True;
116         if (data->IsParamDefined(num,7)) {
117           //szv#4:S4163:12Mar99 `Standard_Boolean stat7 =` not needed
118           data->ReadString (num,7,"postal_code",ach,aPostalCode);
119         }
120         else {
121           hasApostalCode = Standard_False;
122           aPostalCode.Nullify();
123         }
124
125         // --- own field : country ---
126
127         Handle(TCollection_HAsciiString) aCountry;
128         Standard_Boolean hasAcountry = Standard_True;
129         if (data->IsParamDefined(num,8)) {
130           //szv#4:S4163:12Mar99 `Standard_Boolean stat8 =` not needed
131           data->ReadString (num,8,"country",ach,aCountry);
132         }
133         else {
134           hasAcountry = Standard_False;
135           aCountry.Nullify();
136         }
137
138         // --- own field : facsimileNumber ---
139
140         Handle(TCollection_HAsciiString) aFacsimileNumber;
141         Standard_Boolean hasAfacsimileNumber = Standard_True;
142         if (data->IsParamDefined(num,9)) {
143           //szv#4:S4163:12Mar99 `Standard_Boolean stat9 =` not needed
144           data->ReadString (num,9,"facsimile_number",ach,aFacsimileNumber);
145         }
146         else {
147           hasAfacsimileNumber = Standard_False;
148           aFacsimileNumber.Nullify();
149         }
150
151         // --- own field : telephoneNumber ---
152
153         Handle(TCollection_HAsciiString) aTelephoneNumber;
154         Standard_Boolean hasAtelephoneNumber = Standard_True;
155         if (data->IsParamDefined(num,10)) {
156           //szv#4:S4163:12Mar99 `Standard_Boolean stat10 =` not needed
157           data->ReadString (num,10,"telephone_number",ach,aTelephoneNumber);
158         }
159         else {
160           hasAtelephoneNumber = Standard_False;
161           aTelephoneNumber.Nullify();
162         }
163
164         // --- own field : electronicMailAddress ---
165
166         Handle(TCollection_HAsciiString) aElectronicMailAddress;
167         Standard_Boolean hasAelectronicMailAddress = Standard_True;
168         if (data->IsParamDefined(num,11)) {
169           //szv#4:S4163:12Mar99 `Standard_Boolean stat11 =` not needed
170           data->ReadString (num,11,"electronic_mail_address",ach,aElectronicMailAddress);
171         }
172         else {
173           hasAelectronicMailAddress = Standard_False;
174           aElectronicMailAddress.Nullify();
175         }
176
177         // --- own field : telexNumber ---
178
179         Handle(TCollection_HAsciiString) aTelexNumber;
180         Standard_Boolean hasAtelexNumber = Standard_True;
181         if (data->IsParamDefined(num,12)) {
182           //szv#4:S4163:12Mar99 `Standard_Boolean stat12 =` not needed
183           data->ReadString (num,12,"telex_number",ach,aTelexNumber);
184         }
185         else {
186           hasAtelexNumber = Standard_False;
187           aTelexNumber.Nullify();
188         }
189
190         //--- Initialisation of the read entity ---
191
192
193         ent->Init(hasAinternalLocation, aInternalLocation, hasAstreetNumber, aStreetNumber, hasAstreet, aStreet, hasApostalBox, aPostalBox, hasAtown, aTown, hasAregion, aRegion, hasApostalCode, aPostalCode, hasAcountry, aCountry, hasAfacsimileNumber, aFacsimileNumber, hasAtelephoneNumber, aTelephoneNumber, hasAelectronicMailAddress, aElectronicMailAddress, hasAtelexNumber, aTelexNumber);
194 }
195
196
197 void RWStepBasic_RWAddress::WriteStep
198         (StepData_StepWriter& SW,
199          const Handle(StepBasic_Address)& ent) const
200 {
201
202         // --- own field : internalLocation ---
203
204         Standard_Boolean hasAinternalLocation = ent->HasInternalLocation();
205         if (hasAinternalLocation) {
206           SW.Send(ent->InternalLocation());
207         }
208         else {
209           SW.SendUndef();
210         }
211
212         // --- own field : streetNumber ---
213
214         Standard_Boolean hasAstreetNumber = ent->HasStreetNumber();
215         if (hasAstreetNumber) {
216           SW.Send(ent->StreetNumber());
217         }
218         else {
219           SW.SendUndef();
220         }
221
222         // --- own field : street ---
223
224         Standard_Boolean hasAstreet = ent->HasStreet();
225         if (hasAstreet) {
226           SW.Send(ent->Street());
227         }
228         else {
229           SW.SendUndef();
230         }
231
232         // --- own field : postalBox ---
233
234         Standard_Boolean hasApostalBox = ent->HasPostalBox();
235         if (hasApostalBox) {
236           SW.Send(ent->PostalBox());
237         }
238         else {
239           SW.SendUndef();
240         }
241
242         // --- own field : town ---
243
244         Standard_Boolean hasAtown = ent->HasTown();
245         if (hasAtown) {
246           SW.Send(ent->Town());
247         }
248         else {
249           SW.SendUndef();
250         }
251
252         // --- own field : region ---
253
254         Standard_Boolean hasAregion = ent->HasRegion();
255         if (hasAregion) {
256           SW.Send(ent->Region());
257         }
258         else {
259           SW.SendUndef();
260         }
261
262         // --- own field : postalCode ---
263
264         Standard_Boolean hasApostalCode = ent->HasPostalCode();
265         if (hasApostalCode) {
266           SW.Send(ent->PostalCode());
267         }
268         else {
269           SW.SendUndef();
270         }
271
272         // --- own field : country ---
273
274         Standard_Boolean hasAcountry = ent->HasCountry();
275         if (hasAcountry) {
276           SW.Send(ent->Country());
277         }
278         else {
279           SW.SendUndef();
280         }
281
282         // --- own field : facsimileNumber ---
283
284         Standard_Boolean hasAfacsimileNumber = ent->HasFacsimileNumber();
285         if (hasAfacsimileNumber) {
286           SW.Send(ent->FacsimileNumber());
287         }
288         else {
289           SW.SendUndef();
290         }
291
292         // --- own field : telephoneNumber ---
293
294         Standard_Boolean hasAtelephoneNumber = ent->HasTelephoneNumber();
295         if (hasAtelephoneNumber) {
296           SW.Send(ent->TelephoneNumber());
297         }
298         else {
299           SW.SendUndef();
300         }
301
302         // --- own field : electronicMailAddress ---
303
304         Standard_Boolean hasAelectronicMailAddress = ent->HasElectronicMailAddress();
305         if (hasAelectronicMailAddress) {
306           SW.Send(ent->ElectronicMailAddress());
307         }
308         else {
309           SW.SendUndef();
310         }
311
312         // --- own field : telexNumber ---
313
314         Standard_Boolean hasAtelexNumber = ent->HasTelexNumber();
315         if (hasAtelexNumber) {
316           SW.Send(ent->TelexNumber());
317         }
318         else {
319           SW.SendUndef();
320         }
321 }