0023024: Update headers of OCCT files
[occt.git] / src / RWHeaderSection / RWHeaderSection_RWFileDescription.cxx
CommitLineData
b311480e 1// Copyright (c) 1999-2012 OPEN CASCADE SAS
2//
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.
7//
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.
10//
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.
17
7fd59977 18
19#include <RWHeaderSection_RWFileDescription.ixx>
20#include <Interface_HArray1OfHAsciiString.hxx>
21
22
23RWHeaderSection_RWFileDescription::RWHeaderSection_RWFileDescription () {}
24
25void RWHeaderSection_RWFileDescription::ReadStep
26 (const Handle(StepData_StepReaderData)& data,
27 const Standard_Integer num,
28 Handle(Interface_Check)& ach,
29 const Handle(HeaderSection_FileDescription)& ent) const
30{
31
32
33 // --- Number of Parameter Control ---
34
35 if (!data->CheckNbParams(num,2,ach,"file_description has not 2 parameter(s)")) return;
36
37 // --- own field : description ---
38
39 Handle(Interface_HArray1OfHAsciiString) aDescription;
40 Handle(TCollection_HAsciiString) aDescriptionItem;
41 Standard_Integer nsub1;
42 nsub1 = data->SubListNumber(num, 1, Standard_False);
43 if (nsub1 !=0) {
44 Standard_Integer nb1 = data->NbParams(nsub1);
45 aDescription = new Interface_HArray1OfHAsciiString (1, nb1);
46 for (Standard_Integer i1 = 1; i1 <= nb1; i1 ++) {
47 Standard_Boolean stat1 = data->ReadString
48 (nsub1,i1,"description",ach,aDescriptionItem);
49 if (stat1) aDescription->SetValue(i1,aDescriptionItem);
50 }
51 }
52 else {
53 ach->AddFail("Parameter #1 (description) is not a LIST");
54 }
55
56 // --- own field : implementationLevel ---
57
58 Handle(TCollection_HAsciiString) aImplementationLevel;
59 Standard_Boolean stat2;
60 stat2 = data->ReadString (num,2,"implementation_level",ach,aImplementationLevel);
61
62 //--- Initialisation of the read entity ---
63
64
65 if (!ach->HasFailed()) ent->Init(aDescription, aImplementationLevel);
66}
67
68
69void RWHeaderSection_RWFileDescription::WriteStep
70 (StepData_StepWriter& SW,
71 const Handle(HeaderSection_FileDescription)& ent) const
72{
73
74 // --- own field : description ---
75
76 SW.OpenSub();
77 for (Standard_Integer i1 = 1; i1 <= ent->NbDescription(); i1 ++) {
78 SW.Send(ent->DescriptionValue(i1));
79 }
80 SW.CloseSub();
81
82 // --- own field : implementationLevel ---
83
84 SW.Send(ent->ImplementationLevel());
85}