0023024: Update headers of OCCT files
[occt.git] / src / RWHeaderSection / RWHeaderSection_RWFileSchema.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_RWFileSchema.ixx>
20#include <Interface_HArray1OfHAsciiString.hxx>
21
22
23RWHeaderSection_RWFileSchema::RWHeaderSection_RWFileSchema () {}
24
25void RWHeaderSection_RWFileSchema::ReadStep
26 (const Handle(StepData_StepReaderData)& data,
27 const Standard_Integer num,
28 Handle(Interface_Check)& ach,
29 const Handle(HeaderSection_FileSchema)& ent) const
30{
31
32
33 // --- Number of Parameter Control ---
34
35 if (!data->CheckNbParams(num,1,ach,"file_schema has not 1 parameter(s)")) return;
36
37 // --- own field : schemaIdentifiers ---
38
39 Handle(Interface_HArray1OfHAsciiString) aSchemaIdentifiers;
40 Handle(TCollection_HAsciiString) aSchemaIdentifiersItem;
41 Standard_Integer nsub1;
42 nsub1 = data->SubListNumber(num, 1, Standard_False);
43 if (nsub1 !=0) {
44 Standard_Integer nb1 = data->NbParams(nsub1);
45 aSchemaIdentifiers = new Interface_HArray1OfHAsciiString (1, nb1);
46 for (Standard_Integer i1 = 1; i1 <= nb1; i1 ++) {
47 Standard_Boolean stat1 = data->ReadString
48 (nsub1,i1,"schema_identifiers",ach,aSchemaIdentifiersItem);
49 if (stat1) aSchemaIdentifiers->SetValue(i1,aSchemaIdentifiersItem);
50 }
51 }
52 else {
53 ach->AddFail("Parameter #1 (schema_identifiers) is not a LIST");
54 }
55
56 //--- Initialisation of the read entity ---
57
58
59 if (!ach->HasFailed()) ent->Init(aSchemaIdentifiers);
60}
61
62
63void RWHeaderSection_RWFileSchema::WriteStep
64 (StepData_StepWriter& SW,
65 const Handle(HeaderSection_FileSchema)& ent) const
66{
67
68 // --- own field : schemaIdentifiers ---
69
70 SW.OpenSub();
71 for (Standard_Integer i1 = 1; i1 <= ent->NbSchemaIdentifiers(); i1 ++) {
72 SW.Send(ent->SchemaIdentifiersValue(i1));
73 }
74 SW.CloseSub();
75}