0024788: Foundation Classes - remove Dico_Dictionary
[occt.git] / src / IFSelect / IFSelect_BasicDumper.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
42cf5bc1 15#include <IFSelect_BasicDumper.hxx>
16#include <IFSelect_DispGlobal.hxx>
17#include <IFSelect_DispPerCount.hxx>
18#include <IFSelect_DispPerOne.hxx>
19#include <IFSelect_IntParam.hxx>
20#include <IFSelect_Modifier.hxx>
7fd59977 21#include <IFSelect_SelectDiff.hxx>
42cf5bc1 22#include <IFSelect_SelectEntityNumber.hxx>
7fd59977 23#include <IFSelect_SelectErrorEntities.hxx>
24#include <IFSelect_SelectIncorrectEntities.hxx>
42cf5bc1 25#include <IFSelect_SelectIntersection.hxx>
26#include <IFSelect_SelectModelEntities.hxx>
27#include <IFSelect_SelectModelRoots.hxx>
28#include <IFSelect_SelectPointed.hxx>
7fd59977 29#include <IFSelect_SelectRange.hxx>
42cf5bc1 30#include <IFSelect_SelectRootComps.hxx>
31#include <IFSelect_SelectRoots.hxx>
7fd59977 32#include <IFSelect_SelectShared.hxx>
33#include <IFSelect_SelectSharing.hxx>
42cf5bc1 34#include <IFSelect_SelectUnion.hxx>
35#include <IFSelect_SelectUnknownEntities.hxx>
36#include <IFSelect_SessionFile.hxx>
37#include <IFSelect_ShareOut.hxx>
7fd59977 38#include <IFSelect_TransformStandard.hxx>
42cf5bc1 39#include <IFSelect_WorkSession.hxx>
7fd59977 40#include <Interface_Macros.hxx>
42cf5bc1 41#include <Standard_Transient.hxx>
42#include <Standard_Type.hxx>
43#include <TCollection_AsciiString.hxx>
7fd59977 44
92efcf78 45IMPLEMENT_STANDARD_RTTIEXT(IFSelect_BasicDumper,IFSelect_SessionDumper)
46
42cf5bc1 47//#include <IFSelect_SelectTextType.hxx>
7fd59977 48#define FIRSTCHAR 1
49// Param litteral "own" sous la forme :"<val>" -> first = 3
50// A present, forme simplifiee : <val> directement -> first = 1
51
52
53
b311480e 54IFSelect_BasicDumper::IFSelect_BasicDumper () { }
7fd59977 55
56 Standard_Boolean IFSelect_BasicDumper::WriteOwn
57 (IFSelect_SessionFile& file, const Handle(Standard_Transient)& item) const
58{
59 Handle(Standard_Type) type = item->DynamicType();
60 if (type == STANDARD_TYPE(IFSelect_SelectModelRoots)) return Standard_True;
61 if (type == STANDARD_TYPE(IFSelect_SelectModelEntities)) return Standard_True;
62 if (type == STANDARD_TYPE(IFSelect_SelectEntityNumber)) {
63 DeclareAndCast(IFSelect_SelectEntityNumber,sen,item);
64 file.SendItem(sen->Number());
65 return Standard_True;
66 }
67 if (type == STANDARD_TYPE(IFSelect_SelectPointed)) return Standard_True;
68 if (type == STANDARD_TYPE(IFSelect_SelectUnion)) return Standard_True;
69 if (type == STANDARD_TYPE(IFSelect_SelectIntersection)) return Standard_True;
70 if (type == STANDARD_TYPE(IFSelect_SelectDiff)) return Standard_True;
71 if (type == STANDARD_TYPE(IFSelect_SelectUnknownEntities)) return Standard_True;
72 if (type == STANDARD_TYPE(IFSelect_SelectErrorEntities)) return Standard_True;
73 if (type == STANDARD_TYPE(IFSelect_SelectIncorrectEntities)) return Standard_True;
74 if (type == STANDARD_TYPE(IFSelect_SelectRoots)) return Standard_True;
75 if (type == STANDARD_TYPE(IFSelect_SelectRootComps)) return Standard_True;
76 if (type == STANDARD_TYPE(IFSelect_SelectRange)) {
77 DeclareAndCast(IFSelect_SelectRange,sra,item);
78 file.SendItem(sra->Lower());
79 file.SendItem(sra->Upper());
80 return Standard_True;
81 }
7fd59977 82 if (type == STANDARD_TYPE(IFSelect_SelectShared)) return Standard_True;
83 if (type == STANDARD_TYPE(IFSelect_SelectSharing)) return Standard_True;
84
85 if (type == STANDARD_TYPE(IFSelect_DispPerOne)) return Standard_True;
86 if (type == STANDARD_TYPE(IFSelect_DispGlobal)) return Standard_True;
87 if (type == STANDARD_TYPE(IFSelect_DispPerCount)) {
88 DeclareAndCast(IFSelect_DispPerCount,dpc,item);
89 file.SendItem(dpc->Count());
90 return Standard_True;
91 }
92
93 if (type == STANDARD_TYPE(IFSelect_TransformStandard)) {
94 DeclareAndCast(IFSelect_TransformStandard,trs,item);
95 if (trs->CopyOption()) file.SendText("copy");
96 else file.SendText("onthespot");
97 Standard_Integer nbm = trs->NbModifiers();
98 for (Standard_Integer i = 1; i <= nbm; i ++)
99 file.SendItem(trs->Modifier(i));
100 }
101
102 return Standard_False;
103}
104
105 Standard_Boolean IFSelect_BasicDumper::ReadOwn
106 (IFSelect_SessionFile& file, const TCollection_AsciiString& type,
107 Handle(Standard_Transient)& item) const
108{
109 if (type.IsEqual("IFSelect_SelectModelRoots"))
110 { item = new IFSelect_SelectModelRoots (); return Standard_True; }
111 if (type.IsEqual("IFSelect_SelectModelEntities"))
112 { item = new IFSelect_SelectModelEntities (); return Standard_True; }
113 if (type.IsEqual("IFSelect_SelectEntityNumber")) {
114 Handle(IFSelect_SelectEntityNumber) sen =
115 new IFSelect_SelectEntityNumber ();
116 sen->SetNumber (GetCasted(IFSelect_IntParam,file.ItemValue(1)));
117 item = sen;
118 return Standard_True;
119 }
120 if (type.IsEqual("IFSelect_SelectPointed"))
121 { item = new IFSelect_SelectPointed; return Standard_True; }
122 if (type.IsEqual("IFSelect_SelectUnion"))
123 { item = new IFSelect_SelectUnion; return Standard_True; }
124 if (type.IsEqual("IFSelect_SelectIntersection"))
125 { item = new IFSelect_SelectIntersection; return Standard_True; }
126 if (type.IsEqual("IFSelect_SelectDiff"))
127 { item = new IFSelect_SelectDiff; return Standard_True; }
128 if (type.IsEqual("IFSelect_SelectUnknownEntities"))
129 { item = new IFSelect_SelectUnknownEntities; return Standard_True; }
130 if (type.IsEqual("IFSelect_SelectErrorEntities"))
131 { item = new IFSelect_SelectErrorEntities; return Standard_True; }
132 if (type.IsEqual("IFSelect_SelectIncorrectEntities"))
133 { item = new IFSelect_SelectIncorrectEntities; return Standard_True; }
134 if (type.IsEqual("IFSelect_SelectRoots"))
135 { item = new IFSelect_SelectRoots; return Standard_True; }
136 if (type.IsEqual("IFSelect_SelectRootComps"))
137 { item = new IFSelect_SelectRootComps; return Standard_True; }
138 if (type.IsEqual("IFSelect_SelectRange")) {
139 Handle(IFSelect_SelectRange) sra = new IFSelect_SelectRange;
140 sra->SetRange (GetCasted(IFSelect_IntParam,file.ItemValue(1)),
141 GetCasted(IFSelect_IntParam,file.ItemValue(2)) );
142 item = sra;
143 return Standard_True;
144 }
145 if (type.IsEqual("IFSelect_SelectTextType")) {
7fd59977 146 const TCollection_AsciiString exname = file.ParamValue(1);
147 if (exname.Length() < FIRSTCHAR) return Standard_False;
96a95605
DB
148 if (exname.Value(FIRSTCHAR) == 'e') {}
149 else if (exname.Value(FIRSTCHAR) == 'c') {}
7fd59977 150 else return Standard_False;
151// item = new IFSelect_SelectTextType (file.TextValue(2).ToCString(),exact);
152// return Standard_True;
153 }
154 if (type.IsEqual("IFSelect_SelectShared"))
155 { item = new IFSelect_SelectShared; return Standard_True; }
156 if (type.IsEqual("IFSelect_SelectSharing"))
157 { item = new IFSelect_SelectSharing; return Standard_True; }
158
159 if (type.IsEqual("IFSelect_DispPerOne"))
160 { item = new IFSelect_DispPerOne; return Standard_True; }
161 if (type.IsEqual("IFSelect_DispGlobal"))
162 { item = new IFSelect_DispGlobal; return Standard_True; }
163 if (type.IsEqual("IFSelect_DispPerCount")) {
164 Handle(IFSelect_DispPerCount) dpc = new IFSelect_DispPerCount;
165 dpc->SetCount (GetCasted(IFSelect_IntParam,file.ItemValue(1)) );
166 item = dpc;
167 return Standard_True;
168 }
169
170 if (type.IsEqual("IFSelect_TransformStandard")) {
171 Standard_Boolean copyoption;
172 const TCollection_AsciiString copyname = file.ParamValue(1);
173 if (copyname.Length() < FIRSTCHAR) return Standard_False;
174 if (copyname.Value(FIRSTCHAR) == 'c') copyoption = Standard_True;
175 else if (copyname.Value(FIRSTCHAR) == 'o') copyoption = Standard_False;
176 else return Standard_False;
177 Handle(IFSelect_TransformStandard) trs = new IFSelect_TransformStandard;
178 trs->SetCopyOption(copyoption);
179 Standard_Integer nbp = file.NbParams();
180 for (Standard_Integer i = 2; i <= nbp; i ++) {
181 DeclareAndCast(IFSelect_Modifier,modif,file.ItemValue(i));
182 if (!modif.IsNull()) trs->AddModifier(modif);
183 }
184 item = trs;
185 return Standard_True;
186 }
187
188 return Standard_False;
189}