Integration of OCCT 6.5.0 from SVN
[occt.git] / src / RWHeaderSection / RWHeaderSection_RWFileDescription.cxx
1
2 #include <RWHeaderSection_RWFileDescription.ixx>
3 #include <Interface_HArray1OfHAsciiString.hxx>
4
5
6 RWHeaderSection_RWFileDescription::RWHeaderSection_RWFileDescription () {}
7
8 void RWHeaderSection_RWFileDescription::ReadStep
9         (const Handle(StepData_StepReaderData)& data,
10          const Standard_Integer num,
11          Handle(Interface_Check)& ach,
12          const Handle(HeaderSection_FileDescription)& ent) const
13 {
14
15
16         // --- Number of Parameter Control ---
17
18         if (!data->CheckNbParams(num,2,ach,"file_description has not 2 parameter(s)")) return;
19
20         // --- own field : description ---
21
22         Handle(Interface_HArray1OfHAsciiString) aDescription;
23         Handle(TCollection_HAsciiString) aDescriptionItem;
24         Standard_Integer nsub1;
25         nsub1 = data->SubListNumber(num, 1, Standard_False);
26         if (nsub1 !=0) {
27           Standard_Integer nb1 = data->NbParams(nsub1);
28           aDescription = new Interface_HArray1OfHAsciiString (1, nb1);
29           for (Standard_Integer i1 = 1; i1 <= nb1; i1 ++) {
30             Standard_Boolean stat1 = data->ReadString
31                  (nsub1,i1,"description",ach,aDescriptionItem);
32             if (stat1) aDescription->SetValue(i1,aDescriptionItem);
33           }
34         }
35         else {
36           ach->AddFail("Parameter #1 (description) is not a LIST");
37         }
38
39         // --- own field : implementationLevel ---
40
41         Handle(TCollection_HAsciiString) aImplementationLevel;
42         Standard_Boolean stat2;
43         stat2 = data->ReadString (num,2,"implementation_level",ach,aImplementationLevel);
44
45         //--- Initialisation of the read entity ---
46
47
48         if (!ach->HasFailed()) ent->Init(aDescription, aImplementationLevel);
49 }
50
51
52 void RWHeaderSection_RWFileDescription::WriteStep
53         (StepData_StepWriter& SW,
54          const Handle(HeaderSection_FileDescription)& ent) const
55 {
56
57         // --- own field : description ---
58
59         SW.OpenSub();
60         for (Standard_Integer i1 = 1;  i1 <= ent->NbDescription();  i1 ++) {
61           SW.Send(ent->DescriptionValue(i1));
62         }
63         SW.CloseSub();
64
65         // --- own field : implementationLevel ---
66
67         SW.Send(ent->ImplementationLevel());
68 }