0024511: Remove obsolete Image_PixelAddress.cxx
[occt.git] / src / RWHeaderSection / RWHeaderSection_RWFileName.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
973c2be1 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.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
7fd59977 13
14#include <RWHeaderSection_RWFileName.ixx>
15#include <Interface_HArray1OfHAsciiString.hxx>
16
17
18RWHeaderSection_RWFileName::RWHeaderSection_RWFileName () {}
19
20void 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
25{
26
27
28 // --- Number of Parameter Control ---
29
30 if (!data->CheckNbParams(num,7,ach,"file_name has not 7 parameter(s)")) return;
31
32 // --- own field : name ---
33
34 Handle(TCollection_HAsciiString) aName;
35 Standard_Boolean stat1;
36 stat1 = data->ReadString (num,1,"name",ach,aName);
37
38 // --- own field : timeStamp ---
39
40 Handle(TCollection_HAsciiString) aTimeStamp;
41 Standard_Boolean stat2;
42 stat2 = data->ReadString (num,2,"time_stamp",ach,aTimeStamp);
43
44 // --- own field : author ---
45
46 Handle(Interface_HArray1OfHAsciiString) aAuthor;
47 Handle(TCollection_HAsciiString) aAuthorItem;
48 Standard_Integer nsub3;
49 nsub3 = data->SubListNumber(num, 3, Standard_False);
50 if (nsub3 !=0) {
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);
57 }
58 }
59 else {
60 ach->AddFail("Parameter #3 (author) is not a LIST");
61 }
62
63 // --- own field : organization ---
64
65 Handle(Interface_HArray1OfHAsciiString) aOrganization;
66 Handle(TCollection_HAsciiString) aOrganizationItem;
67 Standard_Integer nsub4;
68 nsub4 = data->SubListNumber(num, 4, Standard_False);
69 if (nsub4 !=0) {
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);
76 }
77 }
78 else {
79 ach->AddFail("Parameter #4 (organization) is not a LIST");
80 }
81
82 // --- own field : preprocessorVersion ---
83
84 Handle(TCollection_HAsciiString) aPreprocessorVersion;
85 Standard_Boolean stat5;
86 stat5 = data->ReadString (num,5,"preprocessor_version",ach,aPreprocessorVersion);
87
88 // --- own field : originatingSystem ---
89
90 Handle(TCollection_HAsciiString) aOriginatingSystem;
91 Standard_Boolean stat6;
92 stat6 = data->ReadString (num,6,"originating_system",ach,aOriginatingSystem);
93
94 // --- own field : authorisation ---
95
96 Handle(TCollection_HAsciiString) aAuthorisation;
97 Standard_Boolean stat7;
98 stat7 = data->ReadString (num,7,"authorisation",ach,aAuthorisation);
99
100 //--- Initialisation of the read entity ---
101
102
103 if (!ach->HasFailed()) ent->Init(aName, aTimeStamp, aAuthor, aOrganization, aPreprocessorVersion, aOriginatingSystem, aAuthorisation);
104}
105
106
107void RWHeaderSection_RWFileName::WriteStep
108 (StepData_StepWriter& SW,
109 const Handle(HeaderSection_FileName)& ent) const
110{
111
112 // --- own field : name ---
113
114 SW.Send(ent->Name());
115
116 // --- own field : timeStamp ---
117
118 SW.Send(ent->TimeStamp());
119
120 // --- own field : author ---
121
122 SW.OpenSub();
123 for (Standard_Integer i3 = 1; i3 <= ent->NbAuthor(); i3 ++) {
124 SW.Send(ent->AuthorValue(i3));
125 }
126 SW.CloseSub();
127
128 // --- own field : organization ---
129
130 SW.OpenSub();
131 for (Standard_Integer i4 = 1; i4 <= ent->NbOrganization(); i4 ++) {
132 SW.Send(ent->OrganizationValue(i4));
133 }
134 SW.CloseSub();
135
136 // --- own field : preprocessorVersion ---
137
138 SW.Send(ent->PreprocessorVersion());
139
140 // --- own field : originatingSystem ---
141
142 SW.Send(ent->OriginatingSystem());
143
144 // --- own field : authorisation ---
145
146 SW.Send(ent->Authorisation());
147}