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 <RWHeaderSection_RWFileName.ixx>
20 #include <Interface_HArray1OfHAsciiString.hxx>
23 RWHeaderSection_RWFileName::RWHeaderSection_RWFileName () {}
25 void RWHeaderSection_RWFileName::ReadStep
26 (const Handle(StepData_StepReaderData)& data,
27 const Standard_Integer num,
28 Handle(Interface_Check)& ach,
29 const Handle(HeaderSection_FileName)& ent) const
33 // --- Number of Parameter Control ---
35 if (!data->CheckNbParams(num,7,ach,"file_name has not 7 parameter(s)")) return;
37 // --- own field : name ---
39 Handle(TCollection_HAsciiString) aName;
40 Standard_Boolean stat1;
41 stat1 = data->ReadString (num,1,"name",ach,aName);
43 // --- own field : timeStamp ---
45 Handle(TCollection_HAsciiString) aTimeStamp;
46 Standard_Boolean stat2;
47 stat2 = data->ReadString (num,2,"time_stamp",ach,aTimeStamp);
49 // --- own field : author ---
51 Handle(Interface_HArray1OfHAsciiString) aAuthor;
52 Handle(TCollection_HAsciiString) aAuthorItem;
53 Standard_Integer nsub3;
54 nsub3 = data->SubListNumber(num, 3, Standard_False);
56 Standard_Integer nb3 = data->NbParams(nsub3);
57 aAuthor = new Interface_HArray1OfHAsciiString (1, nb3);
58 for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) {
59 Standard_Boolean stat3 = data->ReadString
60 (nsub3,i3,"author",ach,aAuthorItem);
61 if (stat3) aAuthor->SetValue(i3,aAuthorItem);
65 ach->AddFail("Parameter #3 (author) is not a LIST");
68 // --- own field : organization ---
70 Handle(Interface_HArray1OfHAsciiString) aOrganization;
71 Handle(TCollection_HAsciiString) aOrganizationItem;
72 Standard_Integer nsub4;
73 nsub4 = data->SubListNumber(num, 4, Standard_False);
75 Standard_Integer nb4 = data->NbParams(nsub4);
76 aOrganization = new Interface_HArray1OfHAsciiString (1, nb4);
77 for (Standard_Integer i4 = 1; i4 <= nb4; i4 ++) {
78 Standard_Boolean stat4 = data->ReadString
79 (nsub4,i4,"organization",ach,aOrganizationItem);
80 if (stat4) aOrganization->SetValue(i4,aOrganizationItem);
84 ach->AddFail("Parameter #4 (organization) is not a LIST");
87 // --- own field : preprocessorVersion ---
89 Handle(TCollection_HAsciiString) aPreprocessorVersion;
90 Standard_Boolean stat5;
91 stat5 = data->ReadString (num,5,"preprocessor_version",ach,aPreprocessorVersion);
93 // --- own field : originatingSystem ---
95 Handle(TCollection_HAsciiString) aOriginatingSystem;
96 Standard_Boolean stat6;
97 stat6 = data->ReadString (num,6,"originating_system",ach,aOriginatingSystem);
99 // --- own field : authorisation ---
101 Handle(TCollection_HAsciiString) aAuthorisation;
102 Standard_Boolean stat7;
103 stat7 = data->ReadString (num,7,"authorisation",ach,aAuthorisation);
105 //--- Initialisation of the read entity ---
108 if (!ach->HasFailed()) ent->Init(aName, aTimeStamp, aAuthor, aOrganization, aPreprocessorVersion, aOriginatingSystem, aAuthorisation);
112 void RWHeaderSection_RWFileName::WriteStep
113 (StepData_StepWriter& SW,
114 const Handle(HeaderSection_FileName)& ent) const
117 // --- own field : name ---
119 SW.Send(ent->Name());
121 // --- own field : timeStamp ---
123 SW.Send(ent->TimeStamp());
125 // --- own field : author ---
128 for (Standard_Integer i3 = 1; i3 <= ent->NbAuthor(); i3 ++) {
129 SW.Send(ent->AuthorValue(i3));
133 // --- own field : organization ---
136 for (Standard_Integer i4 = 1; i4 <= ent->NbOrganization(); i4 ++) {
137 SW.Send(ent->OrganizationValue(i4));
141 // --- own field : preprocessorVersion ---
143 SW.Send(ent->PreprocessorVersion());
145 // --- own field : originatingSystem ---
147 SW.Send(ent->OriginatingSystem());
149 // --- own field : authorisation ---
151 SW.Send(ent->Authorisation());