@@ -187,28 +187,21 @@ public void writeHeaderFile(GeneratedClass aClass) {
187
187
// Write includes for any classes we may reference. this generates multiple #includes if we
188
188
// use a class multiple times, but that's innocuous. We could sort and do a unqiue to prevent
189
189
// this if so inclined.
190
- String namespace = languageProperties .getProperty ("namespace" );
191
- if (namespace == null ) {
192
- namespace = "" ;
193
- } else {
194
- namespace = namespace + "/" ;
195
- }
196
-
197
190
boolean hasVariableLengthList = false ;
198
191
199
192
for (int idx = 0 ; idx < aClass .getClassAttributes ().size (); idx ++) {
200
193
ClassAttribute anAttribute = (ClassAttribute ) aClass .getClassAttributes ().get (idx );
201
194
202
195
// If this attribute is a class, we need to do an import on that class
203
196
if (anAttribute .getAttributeKind () == ClassAttribute .ClassAttributeType .CLASSREF ) {
204
- pw .println ("#include <" + namespace + anAttribute .getType () + ".h>" );
197
+ pw .println ("#include <" + anAttribute .getType () + ".h>" );
205
198
}
206
199
207
200
// If this attribute is a list with class type, we also need to do an import on that class
208
201
if ((anAttribute .getAttributeKind () == ClassAttribute .ClassAttributeType .FIXED_LIST
209
202
|| anAttribute .getAttributeKind () == ClassAttribute .ClassAttributeType .VARIABLE_LIST )
210
203
&& !anAttribute .getUnderlyingTypeIsPrimitive ()) {
211
- pw .println ("#include <" + namespace + anAttribute .getType () + ".h>" );
204
+ pw .println ("#include <" + anAttribute .getType () + ".h>" );
212
205
}
213
206
214
207
// if this attribute is a variable-length list that holds a class, we need to
@@ -224,25 +217,25 @@ public void writeHeaderFile(GeneratedClass aClass) {
224
217
225
218
// if we inherit from another class we need to do an include on it
226
219
if (!(aClass .getParentClass ().equalsIgnoreCase ("root" ))) {
227
- pw .println ("#include <" + namespace + aClass .getParentClass () + ".h>" );
220
+ pw .println ("#include <" + aClass .getParentClass () + ".h>" );
228
221
}
229
222
230
223
// "the usual" includes.
231
- pw .println ("#include <" + namespace + " DataStream.h>" );
224
+ pw .println ("#include <utils/ DataStream.h>" );
232
225
233
226
// This is a macro file included only for microsoft compilers. set in the cpp properties tag.
234
- String msMacroFile = "msLibMacro" ;
227
+ String msMacroFile = "dis6/ msLibMacro" ;
235
228
236
229
if (msMacroFile != null ) {
237
- pw .println ("#include <" + namespace + msMacroFile + ".h>" );
230
+ pw .println ("#include <" + msMacroFile + ".h>" );
238
231
}
239
232
240
233
pw .println ();
241
234
242
235
pw .println ();
243
236
244
237
// Print out namespace, if any
245
- namespace = languageProperties .getProperty ("namespace" );
238
+ String namespace = languageProperties .getProperty ("namespace" );
246
239
if (namespace != null ) {
247
240
pw .println ("namespace " + namespace );
248
241
pw .println ("{" );
@@ -290,7 +283,7 @@ public void writeHeaderFile(GeneratedClass aClass) {
290
283
}
291
284
292
285
pw .println (
293
- " " + types .get (anAttribute .getType ()) + " " + IVAR_PREFIX + anAttribute .getName () + "; " );
286
+ " " + types .get (anAttribute .getType ()) + " " + IVAR_PREFIX + anAttribute .getName () + ";" );
294
287
pw .println ();
295
288
296
289
}
@@ -300,7 +293,7 @@ public void writeHeaderFile(GeneratedClass aClass) {
300
293
pw .println (" " + "/** " + anAttribute .getComment () + " */" );
301
294
}
302
295
303
- pw .println (" " + anAttribute .getType () + " " + IVAR_PREFIX + anAttribute .getName () + "; " );
296
+ pw .println (" " + anAttribute .getType () + " " + IVAR_PREFIX + anAttribute .getName () + ";" );
304
297
pw .println ();
305
298
}
306
299
@@ -311,10 +304,10 @@ public void writeHeaderFile(GeneratedClass aClass) {
311
304
312
305
if (anAttribute .getUnderlyingTypeIsPrimitive ())
313
306
pw .println (" " + types .get (anAttribute .getType ()) + " " + IVAR_PREFIX + anAttribute .getName ()
314
- + "[" + anAttribute .getListLength () + "]; " );
307
+ + "[" + anAttribute .getListLength () + "];" );
315
308
else
316
309
pw .println (" " + anAttribute .getType () + " " + IVAR_PREFIX + anAttribute .getName () + "["
317
- + anAttribute .getListLength () + "]; " );
310
+ + anAttribute .getListLength () + "];" );
318
311
pw .println ();
319
312
}
320
313
@@ -325,10 +318,10 @@ public void writeHeaderFile(GeneratedClass aClass) {
325
318
326
319
if (anAttribute .getUnderlyingTypeIsPrimitive ())
327
320
pw .println (" std::vector<" + types .get (anAttribute .getType ()) + "> " + IVAR_PREFIX
328
- + anAttribute .getName () + "; " );
321
+ + anAttribute .getName () + ";" );
329
322
else
330
323
pw .println (" std::vector<" + anAttribute .getType () + "> " + IVAR_PREFIX + anAttribute .getName ()
331
- + "; " );
324
+ + ";" );
332
325
pw .println ();
333
326
}
334
327
}
@@ -362,19 +355,19 @@ public void writeHeaderFile(GeneratedClass aClass) {
362
355
363
356
if (anAttribute .getAttributeKind () == ClassAttribute .ClassAttributeType .CLASSREF ) {
364
357
pw .println (" " + anAttribute .getType () + "& " + "get" + this .initialCap (anAttribute .getName ())
365
- + "(); " );
358
+ + "();" );
366
359
pw .println (" const " + anAttribute .getType () + "& get" + this .initialCap (anAttribute .getName ())
367
- + "() const; " );
360
+ + "() const;" );
368
361
pw .println (" void set" + this .initialCap (anAttribute .getName ()) + "(const "
369
362
+ anAttribute .getType () + " &pX);" );
370
363
}
371
364
372
365
if (anAttribute .getAttributeKind () == ClassAttribute .ClassAttributeType .FIXED_LIST ) {
373
366
// Sleaze. We need to figure out what type of array we are, and this is slightly complex.
374
367
String arrayType = this .getArrayType (anAttribute .getType ());
375
- pw .println (" " + arrayType + "* get" + this .initialCap (anAttribute .getName ()) + "(); " );
368
+ pw .println (" " + arrayType + "* get" + this .initialCap (anAttribute .getName ()) + "();" );
376
369
pw .println (" const " + arrayType + "* get" + this .initialCap (anAttribute .getName ())
377
- + "() const; " );
370
+ + "() const;" );
378
371
pw .println (" void set" + this .initialCap (anAttribute .getName ()) + "( const " + arrayType
379
372
+ "* pX);" );
380
373
if (anAttribute .getCouldBeString () == true ) {
@@ -392,9 +385,9 @@ public void writeHeaderFile(GeneratedClass aClass) {
392
385
attributeType = anAttribute .getType ();
393
386
}
394
387
pw .println (" std::vector<" + attributeType + ">& " + "get"
395
- + this .initialCap (anAttribute .getName ()) + "(); " );
388
+ + this .initialCap (anAttribute .getName ()) + "();" );
396
389
pw .println (" const std::vector<" + attributeType + ">& " + "get"
397
- + this .initialCap (anAttribute .getName ()) + "() const; " );
390
+ + this .initialCap (anAttribute .getName ()) + "() const;" );
398
391
pw .println (" void set" + this .initialCap (anAttribute .getName ()) + "(const std::vector<"
399
392
+ attributeType + ">& pX);" );
400
393
}
@@ -440,17 +433,10 @@ public void writeCppFile(GeneratedClass aClass) {
440
433
outputFile .createNewFile ();
441
434
PrintWriter pw = new PrintWriter (outputFile );
442
435
443
- String namespace = languageProperties .getProperty ("namespace" );
444
- if (namespace == null ) {
445
- namespace = "" ;
446
- } else {
447
- namespace = namespace + "/" ;
448
- }
449
-
450
- pw .println ("#include <" + namespace + aClass .getName () + ".h> " );
436
+ pw .println ("#include <" + aClass .getName () + ".h>" );
451
437
pw .println ();
452
438
453
- namespace = languageProperties .getProperty ("namespace" );
439
+ String namespace = languageProperties .getProperty ("namespace" );
454
440
if (namespace != null ) {
455
441
pw .println ("using namespace " + namespace + ";\n " );
456
442
}
0 commit comments