Warnings on vc14 were eliminated
[occt.git] / src / RWHeaderSection / RWHeaderSection_GeneralModule.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 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
973c2be1 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.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
b311480e 13
7fd59977 14
15#include <HeaderSection.hxx>
7fd59977 16#include <HeaderSection_FileDescription.hxx>
42cf5bc1 17#include <HeaderSection_FileName.hxx>
7fd59977 18#include <HeaderSection_FileSchema.hxx>
c04c30b3 19#include <HeaderSection_Protocol.hxx>
42cf5bc1 20#include <Interface_Check.hxx>
21#include <Interface_CopyTool.hxx>
22#include <Interface_EntityIterator.hxx>
23#include <Interface_GeneralLib.hxx>
24#include <Interface_HArray1OfHAsciiString.hxx>
7fd59977 25#include <Interface_Macros.hxx>
42cf5bc1 26#include <Interface_ShareTool.hxx>
27#include <RWHeaderSection.hxx>
28#include <RWHeaderSection_GeneralModule.hxx>
29#include <Standard_Transient.hxx>
30#include <Standard_Type.hxx>
31#include <StepData_UndefinedEntity.hxx>
32#include <TCollection_HAsciiString.hxx>
7fd59977 33
92efcf78 34IMPLEMENT_STANDARD_RTTIEXT(RWHeaderSection_GeneralModule,StepData_GeneralModule)
35
7fd59977 36RWHeaderSection_GeneralModule::RWHeaderSection_GeneralModule ()
c04c30b3 37{
38 Interface_GeneralLib::SetGlobal(this, HeaderSection::Protocol());
39}
7fd59977 40
41void RWHeaderSection_GeneralModule::FillSharedCase(const Standard_Integer CN, const Handle(Standard_Transient)& ent, Interface_EntityIterator& iter) const
42{
43 if (CN != 4) return;
44
45 DeclareAndCast(StepData_UndefinedEntity,undf,ent);
46 undf->FillShared (iter);
47
48}
49
50
35e08fe8 51void RWHeaderSection_GeneralModule::CheckCase(const Standard_Integer,
52 const Handle(Standard_Transient)&,
53 const Interface_ShareTool&,
54 Handle(Interface_Check)&) const
7fd59977 55{
56}
57
58
59void RWHeaderSection_GeneralModule::CopyCase(const Standard_Integer CN, const Handle(Standard_Transient)& entfrom, const Handle(Standard_Transient)& entto, Interface_CopyTool& TC) const
60{
61// ajout manuel
62 switch (CN) {
63
64 case 1 : {
65 Standard_Integer i;
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);
89 }
90 break;
91
92 case 2 : {
93 Standard_Integer i;
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);
104 }
105 break;
106
107 case 3 : {
108 Standard_Integer i;
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)) );
116 ento->Init (sche);
117 }
118 break;
119
120 case 4 : {
121 DeclareAndCast(StepData_UndefinedEntity,undfrom,entfrom);
122 DeclareAndCast(StepData_UndefinedEntity,undto,entto);
123 undto->GetFromAnother(undfrom,TC); // On pourrait rapatrier cela
124 }
125 break;
126
127 default : break;
128 }
129}
130 // --- Construction of empty class ---
131
132Standard_Boolean RWHeaderSection_GeneralModule::NewVoid
133 (const Standard_Integer CN, Handle(Standard_Transient)& ent) const
134{
135 if (CN == 0) return Standard_False;
136 switch (CN) {
137 case 1 :
138 ent = new HeaderSection_FileName;
139 break;
140 case 2 :
141 ent = new HeaderSection_FileDescription;
142 break;
143 case 3 :
144 ent = new HeaderSection_FileSchema;
145 break;
146 case 4 :
147 ent = new StepData_UndefinedEntity;
148 break;
149 default : return Standard_False;
150 }
151
152return Standard_True;
153}
154