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