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 Standard_Boolean stat1;
36 stat1 = data->ReadString (num,1,"name",ach,aName);
38 // --- own field : timeStamp ---
40 Handle(TCollection_HAsciiString) aTimeStamp;
41 Standard_Boolean stat2;
42 stat2 = data->ReadString (num,2,"time_stamp",ach,aTimeStamp);
44 // --- own field : author ---
46 Handle(Interface_HArray1OfHAsciiString) aAuthor;
47 Handle(TCollection_HAsciiString) aAuthorItem;
48 Standard_Integer nsub3;
49 nsub3 = data->SubListNumber(num, 3, Standard_False);
51 Standard_Integer nb3 = data->NbParams(nsub3);
52 aAuthor = new Interface_HArray1OfHAsciiString (1, nb3);
53 for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) {
54 Standard_Boolean stat3 = data->ReadString
55 (nsub3,i3,"author",ach,aAuthorItem);
56 if (stat3) aAuthor->SetValue(i3,aAuthorItem);
60 ach->AddFail("Parameter #3 (author) is not a LIST");
63 // --- own field : organization ---
65 Handle(Interface_HArray1OfHAsciiString) aOrganization;
66 Handle(TCollection_HAsciiString) aOrganizationItem;
67 Standard_Integer nsub4;
68 nsub4 = data->SubListNumber(num, 4, Standard_False);
70 Standard_Integer nb4 = data->NbParams(nsub4);
71 aOrganization = new Interface_HArray1OfHAsciiString (1, nb4);
72 for (Standard_Integer i4 = 1; i4 <= nb4; i4 ++) {
73 Standard_Boolean stat4 = data->ReadString
74 (nsub4,i4,"organization",ach,aOrganizationItem);
75 if (stat4) aOrganization->SetValue(i4,aOrganizationItem);
79 ach->AddFail("Parameter #4 (organization) is not a LIST");
82 // --- own field : preprocessorVersion ---
84 Handle(TCollection_HAsciiString) aPreprocessorVersion;
85 Standard_Boolean stat5;
86 stat5 = data->ReadString (num,5,"preprocessor_version",ach,aPreprocessorVersion);
88 // --- own field : originatingSystem ---
90 Handle(TCollection_HAsciiString) aOriginatingSystem;
91 Standard_Boolean stat6;
92 stat6 = data->ReadString (num,6,"originating_system",ach,aOriginatingSystem);
94 // --- own field : authorisation ---
96 Handle(TCollection_HAsciiString) aAuthorisation;
97 Standard_Boolean stat7;
98 stat7 = data->ReadString (num,7,"authorisation",ach,aAuthorisation);
100 //--- Initialisation of the read entity ---
103 if (!ach->HasFailed()) ent->Init(aName, aTimeStamp, aAuthor, aOrganization, aPreprocessorVersion, aOriginatingSystem, aAuthorisation);
107 void RWHeaderSection_RWFileName::WriteStep
108 (StepData_StepWriter& SW,
109 const Handle(HeaderSection_FileName)& ent) const
112 // --- own field : name ---
114 SW.Send(ent->Name());
116 // --- own field : timeStamp ---
118 SW.Send(ent->TimeStamp());
120 // --- own field : author ---
123 for (Standard_Integer i3 = 1; i3 <= ent->NbAuthor(); i3 ++) {
124 SW.Send(ent->AuthorValue(i3));
128 // --- own field : organization ---
131 for (Standard_Integer i4 = 1; i4 <= ent->NbOrganization(); i4 ++) {
132 SW.Send(ent->OrganizationValue(i4));
136 // --- own field : preprocessorVersion ---
138 SW.Send(ent->PreprocessorVersion());
140 // --- own field : originatingSystem ---
142 SW.Send(ent->OriginatingSystem());
144 // --- own field : authorisation ---
146 SW.Send(ent->Authorisation());