1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
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
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.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #include <RWHeaderSection_GeneralModule.ixx>
16 #include <Interface_Macros.hxx>
18 #include <Interface_GeneralLib.hxx>
20 #include <Interface_EntityIterator.hxx>
22 #include <HeaderSection.hxx>
24 #include <RWHeaderSection.hxx>
26 #include <Interface_HArray1OfHAsciiString.hxx>
27 #include <TCollection_HAsciiString.hxx>
30 #include <HeaderSection_FileName.hxx>
31 #include <HeaderSection_FileDescription.hxx>
32 #include <HeaderSection_FileSchema.hxx>
34 #include <StepData_UndefinedEntity.hxx>
35 #include <Interface_Macros.hxx>
38 RWHeaderSection_GeneralModule::RWHeaderSection_GeneralModule ()
39 { Interface_GeneralLib::SetGlobal(this, HeaderSection::Protocol()); }
41 void RWHeaderSection_GeneralModule::FillSharedCase(const Standard_Integer CN, const Handle(Standard_Transient)& ent, Interface_EntityIterator& iter) const
45 DeclareAndCast(StepData_UndefinedEntity,undf,ent);
46 undf->FillShared (iter);
51 void RWHeaderSection_GeneralModule::CheckCase(const Standard_Integer,
52 const Handle(Standard_Transient)&,
53 const Interface_ShareTool&,
54 Handle(Interface_Check)&) const
59 void RWHeaderSection_GeneralModule::CopyCase(const Standard_Integer CN, const Handle(Standard_Transient)& entfrom, const Handle(Standard_Transient)& entto, Interface_CopyTool& TC) const
66 DeclareAndCast(HeaderSection_FileName,enfr,entfrom);
67 DeclareAndCast(HeaderSection_FileName,ento,entto);
68 Handle(TCollection_HAsciiString) name =
69 new TCollection_HAsciiString (enfr->Name());
70 Handle(TCollection_HAsciiString) time =
71 new TCollection_HAsciiString (enfr->TimeStamp());
72 Standard_Integer nba = enfr->NbAuthor();
73 Handle(Interface_HArray1OfHAsciiString) auth =
74 new Interface_HArray1OfHAsciiString (1,nba);
75 for (i = 1; i <= nba; i ++) auth->SetValue
76 (i, new TCollection_HAsciiString (enfr->AuthorValue(i)) );
77 Standard_Integer nbo = enfr->NbOrganization();
78 Handle(Interface_HArray1OfHAsciiString) orga =
79 new Interface_HArray1OfHAsciiString (1,nbo);
80 for (i = 1; i <= nbo; i ++) orga->SetValue
81 (i, new TCollection_HAsciiString (enfr->OrganizationValue(i)) );
82 Handle(TCollection_HAsciiString) prep =
83 new TCollection_HAsciiString (enfr->PreprocessorVersion());
84 Handle(TCollection_HAsciiString) orig =
85 new TCollection_HAsciiString (enfr->OriginatingSystem());
86 Handle(TCollection_HAsciiString) autr =
87 new TCollection_HAsciiString (enfr->Authorisation());
88 ento->Init (name,time,auth,orga,prep,orig,autr);
94 DeclareAndCast(HeaderSection_FileDescription,enfr,entfrom);
95 DeclareAndCast(HeaderSection_FileDescription,ento,entto);
96 Standard_Integer nbd = enfr->NbDescription();
97 Handle(Interface_HArray1OfHAsciiString) desc =
98 new Interface_HArray1OfHAsciiString (1,nbd);
99 for (i = 1; i <= nbd; i ++) desc->SetValue
100 (i, new TCollection_HAsciiString (enfr->DescriptionValue(i)) );
101 Handle(TCollection_HAsciiString) impl =
102 new TCollection_HAsciiString (enfr->ImplementationLevel());
103 ento->Init (desc,impl);
109 DeclareAndCast(HeaderSection_FileSchema,enfr,entfrom);
110 DeclareAndCast(HeaderSection_FileSchema,ento,entto);
111 Standard_Integer nbs = enfr->NbSchemaIdentifiers();
112 Handle(Interface_HArray1OfHAsciiString) sche =
113 new Interface_HArray1OfHAsciiString (1,nbs);
114 for (i = 1; i <= nbs; i ++) sche->SetValue
115 (i, new TCollection_HAsciiString (enfr->SchemaIdentifiersValue(i)) );
121 DeclareAndCast(StepData_UndefinedEntity,undfrom,entfrom);
122 DeclareAndCast(StepData_UndefinedEntity,undto,entto);
123 undto->GetFromAnother(undfrom,TC); // On pourrait rapatrier cela
130 // --- Construction of empty class ---
132 Standard_Boolean RWHeaderSection_GeneralModule::NewVoid
133 (const Standard_Integer CN, Handle(Standard_Transient)& ent) const
135 if (CN == 0) return Standard_False;
138 ent = new HeaderSection_FileName;
141 ent = new HeaderSection_FileDescription;
144 ent = new HeaderSection_FileSchema;
147 ent = new StepData_UndefinedEntity;
149 default : return Standard_False;
152 return Standard_True;