1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
19 #include <RWStepBasic_RWPerson.ixx>
20 #include <Interface_HArray1OfHAsciiString.hxx>
23 RWStepBasic_RWPerson::RWStepBasic_RWPerson () {}
25 void RWStepBasic_RWPerson::ReadStep
26 (const Handle(StepData_StepReaderData)& data,
27 const Standard_Integer num,
28 Handle(Interface_Check)& ach,
29 const Handle(StepBasic_Person)& ent) const
33 // --- Number of Parameter Control ---
35 if (!data->CheckNbParams(num,6,ach,"person")) return;
37 // --- own field : id ---
39 Handle(TCollection_HAsciiString) aId;
40 //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
41 data->ReadString (num,1,"id",ach,aId);
43 // --- own field : lastName ---
45 Handle(TCollection_HAsciiString) aLastName;
46 Standard_Boolean hasAlastName = Standard_True;
47 if (data->IsParamDefined(num,2)) {
48 //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
49 data->ReadString (num,2,"last_name",ach,aLastName);
52 hasAlastName = Standard_False;
56 // --- own field : firstName ---
58 Handle(TCollection_HAsciiString) aFirstName;
59 Standard_Boolean hasAfirstName = Standard_True;
60 if (data->IsParamDefined(num,3)) {
61 //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
62 data->ReadString (num,3,"first_name",ach,aFirstName);
65 hasAfirstName = Standard_False;
69 // --- own field : middleNames ---
71 Handle(Interface_HArray1OfHAsciiString) aMiddleNames;
72 Standard_Boolean hasAmiddleNames = Standard_True;
73 if (data->IsParamDefined(num,4)) {
74 Handle(TCollection_HAsciiString) aMiddleNamesItem;
75 Standard_Integer nsub4;
76 if (data->ReadSubList (num,4,"middle_names",ach,nsub4)) {
77 Standard_Integer nb4 = data->NbParams(nsub4);
78 aMiddleNames = new Interface_HArray1OfHAsciiString (1, nb4);
79 for (Standard_Integer i4 = 1; i4 <= nb4; i4 ++) {
80 //szv#4:S4163:12Mar99 `Standard_Boolean stat4 =` not needed
81 if (data->ReadString (nsub4,i4,"middle_names",ach,aMiddleNamesItem))
82 aMiddleNames->SetValue(i4,aMiddleNamesItem);
87 hasAmiddleNames = Standard_False;
88 aMiddleNames.Nullify();
91 // --- own field : prefixTitles ---
93 Handle(Interface_HArray1OfHAsciiString) aPrefixTitles;
94 Standard_Boolean hasAprefixTitles = Standard_True;
95 if (data->IsParamDefined(num,5)) {
96 Handle(TCollection_HAsciiString) aPrefixTitlesItem;
97 Standard_Integer nsub5;
98 if (data->ReadSubList (num,5,"prefix_titles",ach,nsub5)) {
99 Standard_Integer nb5 = data->NbParams(nsub5);
100 aPrefixTitles = new Interface_HArray1OfHAsciiString (1, nb5);
101 for (Standard_Integer i5 = 1; i5 <= nb5; i5 ++) {
102 //szv#4:S4163:12Mar99 `Standard_Boolean stat5 =` not needed
103 if (data->ReadString (nsub5,i5,"prefix_titles",ach,aPrefixTitlesItem))
104 aPrefixTitles->SetValue(i5,aPrefixTitlesItem);
109 hasAprefixTitles = Standard_False;
110 aPrefixTitles.Nullify();
113 // --- own field : suffixTitles ---
115 Handle(Interface_HArray1OfHAsciiString) aSuffixTitles;
116 Standard_Boolean hasAsuffixTitles = Standard_True;
117 if (data->IsParamDefined(num,6)) {
118 Handle(TCollection_HAsciiString) aSuffixTitlesItem;
119 Standard_Integer nsub6;
120 if (data->ReadSubList (num,6,"suffix_titles",ach,nsub6)) {
121 Standard_Integer nb6 = data->NbParams(nsub6);
122 aSuffixTitles = new Interface_HArray1OfHAsciiString (1, nb6);
123 for (Standard_Integer i6 = 1; i6 <= nb6; i6 ++) {
124 //szv#4:S4163:12Mar99 `Standard_Boolean stat6 =` not needed
125 if (data->ReadString (nsub6,i6,"suffix_titles",ach,aSuffixTitlesItem))
126 aSuffixTitles->SetValue(i6,aSuffixTitlesItem);
131 hasAsuffixTitles = Standard_False;
132 aSuffixTitles.Nullify();
135 //--- Initialisation of the read entity ---
138 ent->Init(aId, hasAlastName, aLastName, hasAfirstName, aFirstName, hasAmiddleNames, aMiddleNames, hasAprefixTitles, aPrefixTitles, hasAsuffixTitles, aSuffixTitles);
142 void RWStepBasic_RWPerson::WriteStep
143 (StepData_StepWriter& SW,
144 const Handle(StepBasic_Person)& ent) const
147 // --- own field : id ---
151 // --- own field : lastName ---
153 Standard_Boolean hasAlastName = ent->HasLastName();
155 SW.Send(ent->LastName());
161 // --- own field : firstName ---
163 Standard_Boolean hasAfirstName = ent->HasFirstName();
165 SW.Send(ent->FirstName());
171 // --- own field : middleNames ---
173 Standard_Boolean hasAmiddleNames = ent->HasMiddleNames();
174 if (hasAmiddleNames) {
176 for (Standard_Integer i4 = 1; i4 <= ent->NbMiddleNames(); i4 ++) {
177 SW.Send(ent->MiddleNamesValue(i4));
185 // --- own field : prefixTitles ---
187 Standard_Boolean hasAprefixTitles = ent->HasPrefixTitles();
188 if (hasAprefixTitles) {
190 for (Standard_Integer i5 = 1; i5 <= ent->NbPrefixTitles(); i5 ++) {
191 SW.Send(ent->PrefixTitlesValue(i5));
199 // --- own field : suffixTitles ---
201 Standard_Boolean hasAsuffixTitles = ent->HasSuffixTitles();
202 if (hasAsuffixTitles) {
204 for (Standard_Integer i6 = 1; i6 <= ent->NbSuffixTitles(); i6 ++) {
205 SW.Send(ent->SuffixTitlesValue(i6));