0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[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//
d5f74e42 5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 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
7fd59977 14
42cf5bc1 15#include <HeaderSection_FileName.hxx>
16#include <Interface_Check.hxx>
17#include <Interface_HArray1OfHAsciiString.hxx>
18#include <RWHeaderSection_RWFileName.hxx>
19#include <StepData_StepReaderData.hxx>
20#include <StepData_StepWriter.hxx>
7fd59977 21
22RWHeaderSection_RWFileName::RWHeaderSection_RWFileName () {}
23
24void RWHeaderSection_RWFileName::ReadStep
25 (const Handle(StepData_StepReaderData)& data,
26 const Standard_Integer num,
27 Handle(Interface_Check)& ach,
28 const Handle(HeaderSection_FileName)& ent) const
29{
30
31
32 // --- Number of Parameter Control ---
33
34 if (!data->CheckNbParams(num,7,ach,"file_name has not 7 parameter(s)")) return;
35
36 // --- own field : name ---
37
38 Handle(TCollection_HAsciiString) aName;
96a95605 39 data->ReadString (num,1,"name",ach,aName);
7fd59977 40
41 // --- own field : timeStamp ---
42
43 Handle(TCollection_HAsciiString) aTimeStamp;
96a95605 44 data->ReadString (num,2,"time_stamp",ach,aTimeStamp);
7fd59977 45
46 // --- own field : author ---
47
48 Handle(Interface_HArray1OfHAsciiString) aAuthor;
49 Handle(TCollection_HAsciiString) aAuthorItem;
50 Standard_Integer nsub3;
51 nsub3 = data->SubListNumber(num, 3, Standard_False);
52 if (nsub3 !=0) {
53 Standard_Integer nb3 = data->NbParams(nsub3);
54 aAuthor = new Interface_HArray1OfHAsciiString (1, nb3);
55 for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) {
56 Standard_Boolean stat3 = data->ReadString
57 (nsub3,i3,"author",ach,aAuthorItem);
58 if (stat3) aAuthor->SetValue(i3,aAuthorItem);
59 }
60 }
61 else {
62 ach->AddFail("Parameter #3 (author) is not a LIST");
63 }
64
65 // --- own field : organization ---
66
67 Handle(Interface_HArray1OfHAsciiString) aOrganization;
68 Handle(TCollection_HAsciiString) aOrganizationItem;
69 Standard_Integer nsub4;
70 nsub4 = data->SubListNumber(num, 4, Standard_False);
71 if (nsub4 !=0) {
72 Standard_Integer nb4 = data->NbParams(nsub4);
73 aOrganization = new Interface_HArray1OfHAsciiString (1, nb4);
74 for (Standard_Integer i4 = 1; i4 <= nb4; i4 ++) {
75 Standard_Boolean stat4 = data->ReadString
76 (nsub4,i4,"organization",ach,aOrganizationItem);
77 if (stat4) aOrganization->SetValue(i4,aOrganizationItem);
78 }
79 }
80 else {
81 ach->AddFail("Parameter #4 (organization) is not a LIST");
82 }
83
84 // --- own field : preprocessorVersion ---
85
86 Handle(TCollection_HAsciiString) aPreprocessorVersion;
96a95605 87 data->ReadString (num,5,"preprocessor_version",ach,aPreprocessorVersion);
7fd59977 88
89 // --- own field : originatingSystem ---
90
91 Handle(TCollection_HAsciiString) aOriginatingSystem;
96a95605 92 data->ReadString (num,6,"originating_system",ach,aOriginatingSystem);
7fd59977 93
94 // --- own field : authorisation ---
95
96 Handle(TCollection_HAsciiString) aAuthorisation;
96a95605 97 data->ReadString (num,7,"authorisation",ach,aAuthorisation);
7fd59977 98
99 //--- Initialisation of the read entity ---
100
101
102 if (!ach->HasFailed()) ent->Init(aName, aTimeStamp, aAuthor, aOrganization, aPreprocessorVersion, aOriginatingSystem, aAuthorisation);
103}
104
105
106void RWHeaderSection_RWFileName::WriteStep
107 (StepData_StepWriter& SW,
108 const Handle(HeaderSection_FileName)& ent) const
109{
110
111 // --- own field : name ---
112
113 SW.Send(ent->Name());
114
115 // --- own field : timeStamp ---
116
117 SW.Send(ent->TimeStamp());
118
119 // --- own field : author ---
120
121 SW.OpenSub();
122 for (Standard_Integer i3 = 1; i3 <= ent->NbAuthor(); i3 ++) {
123 SW.Send(ent->AuthorValue(i3));
124 }
125 SW.CloseSub();
126
127 // --- own field : organization ---
128
129 SW.OpenSub();
130 for (Standard_Integer i4 = 1; i4 <= ent->NbOrganization(); i4 ++) {
131 SW.Send(ent->OrganizationValue(i4));
132 }
133 SW.CloseSub();
134
135 // --- own field : preprocessorVersion ---
136
137 SW.Send(ent->PreprocessorVersion());
138
139 // --- own field : originatingSystem ---
140
141 SW.Send(ent->OriginatingSystem());
142
143 // --- own field : authorisation ---
144
145 SW.Send(ent->Authorisation());
146}