1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and / or modify it
6 // under the terms of the GNU Lesser General Public 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.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #include <RWHeaderSection_RWFileName.ixx>
15 #include <Interface_HArray1OfHAsciiString.hxx>
18 RWHeaderSection_RWFileName::RWHeaderSection_RWFileName () {}
20 void RWHeaderSection_RWFileName::ReadStep
21 (const Handle(StepData_StepReaderData)& data,
22 const Standard_Integer num,
23 Handle(Interface_Check)& ach,
24 const Handle(HeaderSection_FileName)& ent) const
28 // --- Number of Parameter Control ---
30 if (!data->CheckNbParams(num,7,ach,"file_name has not 7 parameter(s)")) return;
32 // --- own field : name ---
34 Handle(TCollection_HAsciiString) aName;
35 data->ReadString (num,1,"name",ach,aName);
37 // --- own field : timeStamp ---
39 Handle(TCollection_HAsciiString) aTimeStamp;
40 data->ReadString (num,2,"time_stamp",ach,aTimeStamp);
42 // --- own field : author ---
44 Handle(Interface_HArray1OfHAsciiString) aAuthor;
45 Handle(TCollection_HAsciiString) aAuthorItem;
46 Standard_Integer nsub3;
47 nsub3 = data->SubListNumber(num, 3, Standard_False);
49 Standard_Integer nb3 = data->NbParams(nsub3);
50 aAuthor = new Interface_HArray1OfHAsciiString (1, nb3);
51 for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) {
52 Standard_Boolean stat3 = data->ReadString
53 (nsub3,i3,"author",ach,aAuthorItem);
54 if (stat3) aAuthor->SetValue(i3,aAuthorItem);
58 ach->AddFail("Parameter #3 (author) is not a LIST");
61 // --- own field : organization ---
63 Handle(Interface_HArray1OfHAsciiString) aOrganization;
64 Handle(TCollection_HAsciiString) aOrganizationItem;
65 Standard_Integer nsub4;
66 nsub4 = data->SubListNumber(num, 4, Standard_False);
68 Standard_Integer nb4 = data->NbParams(nsub4);
69 aOrganization = new Interface_HArray1OfHAsciiString (1, nb4);
70 for (Standard_Integer i4 = 1; i4 <= nb4; i4 ++) {
71 Standard_Boolean stat4 = data->ReadString
72 (nsub4,i4,"organization",ach,aOrganizationItem);
73 if (stat4) aOrganization->SetValue(i4,aOrganizationItem);
77 ach->AddFail("Parameter #4 (organization) is not a LIST");
80 // --- own field : preprocessorVersion ---
82 Handle(TCollection_HAsciiString) aPreprocessorVersion;
83 data->ReadString (num,5,"preprocessor_version",ach,aPreprocessorVersion);
85 // --- own field : originatingSystem ---
87 Handle(TCollection_HAsciiString) aOriginatingSystem;
88 data->ReadString (num,6,"originating_system",ach,aOriginatingSystem);
90 // --- own field : authorisation ---
92 Handle(TCollection_HAsciiString) aAuthorisation;
93 data->ReadString (num,7,"authorisation",ach,aAuthorisation);
95 //--- Initialisation of the read entity ---
98 if (!ach->HasFailed()) ent->Init(aName, aTimeStamp, aAuthor, aOrganization, aPreprocessorVersion, aOriginatingSystem, aAuthorisation);
102 void RWHeaderSection_RWFileName::WriteStep
103 (StepData_StepWriter& SW,
104 const Handle(HeaderSection_FileName)& ent) const
107 // --- own field : name ---
109 SW.Send(ent->Name());
111 // --- own field : timeStamp ---
113 SW.Send(ent->TimeStamp());
115 // --- own field : author ---
118 for (Standard_Integer i3 = 1; i3 <= ent->NbAuthor(); i3 ++) {
119 SW.Send(ent->AuthorValue(i3));
123 // --- own field : organization ---
126 for (Standard_Integer i4 = 1; i4 <= ent->NbOrganization(); i4 ++) {
127 SW.Send(ent->OrganizationValue(i4));
131 // --- own field : preprocessorVersion ---
133 SW.Send(ent->PreprocessorVersion());
135 // --- own field : originatingSystem ---
137 SW.Send(ent->OriginatingSystem());
139 // --- own field : authorisation ---
141 SW.Send(ent->Authorisation());