root/branches/Carsten_PtrWork2/Tools/fcdProcess/FCBaseTemplate_cpp.h

Revision 440, 40.5 kB (checked in by cneumann, 2 years ago)

changed: emit documentation in FooBase?.cpp and a comment in

comment in Foo.cpp where to find the doc.
This should produce now code equivalent to what
fcd2code emits.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 /* This is a template file for fcdEdit.
2  * To create it from sample source,  cut'n'paste the source and apply the following
3  * substitutions:
4  * s|\|\\|g
5  * s|"|\"|g
6  * s|^|"|
7  * s|$|",|
8  */
9
10 char *FCBaseTemplate_cpp[]={
11 "/*---------------------------------------------------------------------------*\\",
12 " *                                OpenSG                                     *",
13 " *                                                                           *",
14 " *                                                                           *",
15 " *               Copyright (C) 2000-2006 by the OpenSG Forum                 *",
16 " *                                                                           *",
17 " *                            www.opensg.org                                 *",
18 " *                                                                           *",
19 " *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *",
20 " *                                                                           *",
21 "\\*---------------------------------------------------------------------------*/",
22 "/*---------------------------------------------------------------------------*\\",
23 " *                                License                                    *",
24 " *                                                                           *",
25 " * This library is free software; you can redistribute it and/or modify it   *",
26 " * under the terms of the GNU Library General Public License as published    *",
27 " * by the Free Software Foundation, version 2.                               *",
28 " *                                                                           *",
29 " * This library is distributed in the hope that it will be useful, but       *",
30 " * WITHOUT ANY WARRANTY; without even the implied warranty of                *",
31 " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *",
32 " * Library General Public License for more details.                          *",
33 " *                                                                           *",
34 " * You should have received a copy of the GNU Library General Public         *",
35 " * License along with this library; if not, write to the Free Software       *",
36 " * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *",
37 " *                                                                           *",
38 "\\*---------------------------------------------------------------------------*/",
39 "/*---------------------------------------------------------------------------*\\",
40 " *                                Changes                                    *",
41 " *                                                                           *",
42 " *                                                                           *",
43 " *                                                                           *",
44 " *                                                                           *",
45 " *                                                                           *",
46 " *                                                                           *",
47 "\\*---------------------------------------------------------------------------*/",
48 "",
49 "/*****************************************************************************\\",
50 " *****************************************************************************",
51 " **                                                                         **",
52 " **                  This file is automatically generated.                  **",
53 " **                                                                         **",
54 " **          Any changes made to this file WILL be lost when it is          **",
55 " **           regenerated, which can become necessary at any time.          **",
56 " **                                                                         **",
57 " **     Do not change this file, changes should be done in the derived      **",
58 " **     class @!Classname!@!",
59 " **                                                                         **",
60 " *****************************************************************************",
61 "\\*****************************************************************************/",
62 "",
63 "",
64 "#define OSG_COMPILE@!CLASSNAME!@INST",
65 "",
66 "#include <stdlib.h>",
67 "#include <stdio.h>",
68 "#include <boost/assign/list_of.hpp>",
69 "",
70 "#include <@!HeaderPrefix!@OSGConfig.h>",
71 "",
72 ""@@AdditionalIncludes@@",
73 "",
74 "@@BeginFieldLoop@@",
75 "@@if hasDefaultHeader",
76 "#include @!FieldDefaultHeader:30!@   // @!Fieldname!@ default header",
77 "@@endif",
78 "@@EndFieldLoop@@",
79 "",
80 "@@BeginFieldLoop@@",
81 "@@if isPtrField",
82 "@@if needClassInclude",
83 "#include <@!FieldClassInclude!@> // @!Fieldname!@ Class",
84 "@@endif",
85 "@@endif",
86 "@@EndFieldLoop@@",
87 "",
88 "#include \"OSG@!Classname!@Base.h\"",
89 "#include \"OSG@!Classname!@.h\"",
90 "",
91 "OSG_BEGIN_NAMESPACE",
92 "",
93 "/***************************************************************************\\",
94 " *                            Description                                  *",
95 "\\***************************************************************************/",
96 "",
97 "/*! \class OSG::@!Classname!@",
98 "    @!Description!@",
99 " */",
100 "",
101 "@@if hasFields",
102 "/***************************************************************************\\",
103 " *                         Field Description                               *",
104 "\\***************************************************************************/",
105 "",
106 "@@if Decorator",
107 "/*! \\var @!Parent!@Ptr @!Classname!@Base::_sfDecoratee",
108 "    The object being decorated",
109 "*/",
110 "@@else",
111 "@@BeginFieldLoop@@",
112 "/*! \\var @!Fieldtype:15!@ @!Classname!@Base::_@!fieldname!@",
113 "    @!Fielddescription!@",
114 "*/",
115 "@@EndFieldLoop@@",
116 "@@endif",
117 "",
118 "void @!Classname!@Base::classDescInserter(TypeObject &oType)",
119 "{",
120 "@@if hasFields",
121 "    FieldDescriptionBase *pDesc = NULL; ",
122 "",
123 "@@endif",
124 "@@if Decorator",
125 "    pDesc = new SF@!Parent!@Ptr::Description(",
126 "        SF@!Parent!@Ptr::getClassType(), ",
127 "        \"decoratee\",",
128 "        \"undocumented decoratee\",",
129 "        DecorateeFieldId, DecorateeFieldMask,",
130 "        true,",
131 "        @!decorateeFieldFlags!@,",
132 "        static_cast     <FieldEditMethodSig>(&@!Classname!@Base::invalidEditField),",
133 "        reinterpret_cast<FieldGetMethodSig >(&@!Classname!@Base::getSFDecoratee));",
134 "",
135 "    oType.addInitialDesc(pDesc);",
136 "@@else",
137 "@@BeginFieldLoop@@",
138 "@@if CompatOneSix",
139 "@@if !isPtrField",
140 "",
141 "#ifdef OSG_1_COMPAT",
142 "    typedef const @!CARDINALITY!@@!CapsFieldtypeClean!@ *(@!Classname!@Base::*Get@!CARDINALITY!@@!Fieldname!@F)(void) const;",
143 "",
144 "    Get@!CARDINALITY!@@!Fieldname!@F Get@!CARDINALITY!@@!Fieldname!@ = &@!Classname!@Base::get@!CARDINALITY!@@!Fieldname!@;",
145 "#endif",
146 "@@endif",
147 "@@endif",
148 "",
149 "    pDesc = new @!FieldNamespace!@@!CARDINALITY!@@!CapsFieldtypeClean!@::Description(",
150 "        @!FieldNamespace!@@!CARDINALITY!@@!CapsFieldtypeClean!@::getClassType(), ",
151 "        \"@!fieldnameDesc!@\", ",
152 "        \"@!SafeFielddescription!@\",",
153 "        @!Fieldname!@FieldId, @!Fieldname!@FieldMask,",
154 "        @!fieldvisibility!@,",
155 "        @!fieldFlags!@,",
156 "@@if isPtrField",
157 "        static_cast     <FieldEditMethodSig>(&@!Classname!@Base::invalidEditField),",
158 "@@else",
159 "        reinterpret_cast<FieldEditMethodSig>(&@!Classname!@Base::edit@!CARDINALITY!@@!Fieldname!@),",
160 "@@endif",
161 "@@if !isPtrField",
162 "@@if CompatOneSix",
163 "#ifdef OSG_1_COMPAT",
164 "        reinterpret_cast<FieldGetMethodSig >(Get@!CARDINALITY!@@!Fieldname!@));",
165 "#else",
166 "        reinterpret_cast<FieldGetMethodSig >(&@!Classname!@Base::get@!CARDINALITY!@@!Fieldname!@));",
167 "#endif",
168 "@@else",
169 "        reinterpret_cast<FieldGetMethodSig >(&@!Classname!@Base::get@!CARDINALITY!@@!Fieldname!@));",
170 "@@endif",
171 "@@else",
172 "        reinterpret_cast<FieldGetMethodSig >(&@!Classname!@Base::get@!CARDINALITY!@@!Fieldname!@));",
173 "@@endif",
174 "",
175 "    oType.addInitialDesc(pDesc);",
176 "@@EndFieldLoop@@",
177 "@@endif",
178 "}",
179 "",
180 "@@endif",
181 "",
182 "@!Classname!@Base::TypeObject @!Classname!@Base::_type(true,",
183 "    @!Classname!@Base::getClassname(),",
184 "    Inherited::getClassname(),",
185 "    \"@!Group!@\",",
186 "    @!Namespace!@,",
187 "@@if abstract",
188 "    NULL, ",
189 "@@else",
190 "    (PrototypeCreateF) &@!Classname!@Base::createEmpty,",
191 "@@endif",
192 "    @!Classname!@::initMethod,",
193 "@@if hasFields",
194 "    (InitalInsertDescFunc) &@!Classname!@Base::classDescInserter,",
195 "@@else",
196 "    NULL,",
197 "@@endif",
198 "    false,",
199 "    @!Fcdxml!@,",
200 "    \"@!SafeDescription!@\" ",
201 "    );",
202 "",
203 "/*------------------------------ get -----------------------------------*/",
204 "",
205 "FieldContainerType &@!Classname!@Base::getType(void) ",
206 "{",
207 "    return _type; ",
208 "} ",
209 "",
210 "const FieldContainerType &@!Classname!@Base::getType(void) const ",
211 "{",
212 "    return _type;",
213 "} ",
214 "",
215 "UInt32 @!Classname!@Base::getContainerSize(void) const ",
216 "{ ",
217 "    return sizeof(@!Classname!@); ",
218 "}",
219 "",
220 "/*------------------------- decorator get ------------------------------*/",
221 "",
222 "@@if Decorator",
223 "const SF@!Parent!@Ptr *@!Classname!@Base::getSFDecoratee(void) const",
224 "{",
225 "    return &_sfDecoratee;",
226 "}",
227 "",
228 "@@BeginFieldLoop@@",
229 "@@if isPtrField",
230 "//! Get the @!Classname!@::_@!fieldname!@ field.",
231 "const @!FieldNamespace!@@!CARDINALITY!@@!CapsFieldtypeClean!@ *@!Classname!@Base::get@!CARDINALITY!@@!Fieldname!@(void) const",
232 "{",
233 "    if(_sfDecoratee.getValue() != NullFC)",
234 "    {",
235 "        return getDecoratee()->get@!CARDINALITY!@@!Fieldname!@();",
236 "    }",
237 "    else",
238 "    {",
239 "        return NULL;",
240 "    }",
241 "}",
242 "@@else",
243 "@!FieldNamespace!@@!CARDINALITY!@@!CapsFieldtypeClean!@ *@!Classname!@Base::edit@!CARDINALITY!@@!Fieldname!@(void)",
244 "{",
245 "    if(_sfDecoratee.getValue() != NullFC)",
246 "    {",
247 "        return getDecoratee()->edit@!CARDINALITY!@@!Fieldname!@();",
248 "    }",
249 "    else",
250 "    {",
251 "        return NULL;",
252 "    }",
253 "}",
254 "",
255 "const @!FieldNamespace!@@!CARDINALITY!@@!CapsFieldtypeClean!@ *@!Classname!@Base::get@!CARDINALITY!@@!Fieldname!@(void) const",
256 "{",
257 "    if(_sfDecoratee.getValue() != NullFC)",
258 "    {",
259 "        return getDecoratee()->get@!CARDINALITY!@@!Fieldname!@();",
260 "    }",
261 "    else",
262 "    {",
263 "        return NULL;",
264 "    }",
265 "}",
266 "@@if CompatOneSix",
267 "#ifdef OSG_1_COMPAT",
268 "@!FieldNamespace!@@!CARDINALITY!@@!CapsFieldtypeClean:17!@ *@!Classname!@Base::get@!CARDINALITY!@@!Fieldname:15!@(void)",
269 "{",
270 "    return this->edit@!CARDINALITY!@@!Fieldname:15!@();",
271 "}",
272 "#endif",
273 "@@endif",
274 "@@endif",
275 "",
276 "@@EndFieldLoop@@",
277 "@@endif",
278 "",
279 "@@if !Decorator",
280 "@@BeginFieldLoop@@",
281 "@@if isPtrField",
282 "//! Get the @!Classname!@::_@!fieldname!@ field.",
283 "const @!FieldNamespace!@@!CARDINALITY!@@!CapsFieldtypeClean!@ *@!Classname!@Base::get@!CARDINALITY!@@!Fieldname!@(void) const",
284 "{",
285 "    return &_@!fieldname!@;",
286 "}",
287 "@@else",
288 "@!FieldNamespace!@@!CARDINALITY!@@!CapsFieldtypeClean!@ *@!Classname!@Base::edit@!CARDINALITY!@@!Fieldname!@(void)",
289 "{",
290 "@@if isMField",
291 "    editMField(@!Fieldname!@FieldMask, _@!fieldname!@);",
292 "@@else",
293 "    editSField(@!Fieldname!@FieldMask);",
294 "@@endif",
295 "",
296 "    return &_@!fieldname!@;",
297 "}",
298 "",
299 "const @!FieldNamespace!@@!CARDINALITY!@@!CapsFieldtypeClean!@ *@!Classname!@Base::get@!CARDINALITY!@@!Fieldname!@(void) const",
300 "{",
301 "    return &_@!fieldname!@;",
302 "}",
303 "",
304 "@@if CompatOneSix",
305 "#ifdef OSG_1_COMPAT",
306 "@!FieldNamespace!@@!CARDINALITY!@@!CapsFieldtypeClean:17!@ *@!Classname!@Base::get@!CARDINALITY!@@!Fieldname:15!@(void)",
307 "{",
308 "    return this->edit@!CARDINALITY!@@!Fieldname:15!@();",
309 "}",
310 "#endif",
311 "@@endif",
312 "@@endif",
313 "",
314 "@@EndFieldLoop@@",
315 "@@endif",
316 "",
317 "@@if hasPtrFields"
318 "void @!Classname!@Base::pushToField(      FieldContainerPtrConstArg pNewElement,",
319 "                                    const UInt32                    uiFieldId  )",
320 "{",
321 "    Inherited::pushToField(pNewElement, uiFieldId);",
322 "",
323 "@@BeginFieldLoop@@",
324 "@@if isPtrField",
325 "@@if isSField",
326 "    if(uiFieldId == @!Fieldname!@FieldId)",
327 "    {",
328 "        static_cast<@!Classname!@ *>(this)->set@!Fieldname!@(",
329 "            cast_dynamic<@!Fieldtype!@>(pNewElement));",
330 "    }",
331 "@@else",
332 "    if(uiFieldId == @!Fieldname!@FieldId)",
333 "    {",
334 "        static_cast<@!Classname!@ *>(this)->@!pushToField!@(",
335 "            cast_dynamic<@!Fieldtype!@>(pNewElement));",
336 "    }",
337 "@@endif",
338 "@@endif",
339 "@@EndFieldLoop@@",
340 "}",
341 "",
342 "void @!Classname!@Base::insertIntoMField(const UInt32                    uiIndex,",
343 "                                               FieldContainerPtrConstArg pNewElement,",
344 "                                         const UInt32                    uiFieldId  )",
345 "{",
346 "    Inherited::insertIntoMField(uiIndex, pNewElement, uiFieldId);",
347 "",
348 "@@BeginMFFieldLoop@@",
349 "@@if isPtrField",
350 "    if(uiFieldId == @!Fieldname!@FieldId)",
351 "    {",
352 "        static_cast<@!Classname!@ *>(this)->@!insertIntoMField!@(",
353 "            uiIndex,",
354 "            cast_dynamic<@!Fieldtype!@>(pNewElement));",
355 "    }",
356 "@@endif",
357 "@@EndMFFieldLoop@@",
358 "}",
359 "",
360 "void @!Classname!@Base::replaceInMField (const UInt32                    uiIndex,",
361 "                                               FieldContainerPtrConstArg pNewElement,",
362 "                                         const UInt32                    uiFieldId)",
363 "{",
364 "    Inherited::replaceInMField(uiIndex, pNewElement, uiFieldId);",
365 "",
366 "@@BeginMFFieldLoop@@",
367 "@@if isPtrField",
368 "    if(uiFieldId == @!Fieldname!@FieldId)",
369 "    {",
370 "        static_cast<@!Classname!@ *>(this)->@!replaceInMFieldIndex!@(",
371 "            uiIndex,",
372 "            cast_dynamic<@!Fieldtype!@>(pNewElement));",
373 "    }",
374 "@@endif",
375 "@@EndMFFieldLoop@@",
376 "}",
377 "",
378 "void @!Classname!@Base::replaceInMField (      FieldContainerPtrConstArg pOldElement,",
379 "                                               FieldContainerPtrConstArg pNewElement,",
380 "                                         const UInt32                    uiFieldId  )",
381 "{",
382 "    Inherited::replaceInMField(pOldElement, pNewElement, uiFieldId);",
383 "",
384 "@@BeginMFFieldLoop@@",
385 "@@if isPtrField",
386 "    if(uiFieldId == @!Fieldname!@FieldId)",
387 "    {",
388 "        static_cast<@!Classname!@ *>(this)->@!replaceInMFieldObject!@(",
389 "            cast_dynamic<@!Fieldtype!@>(pOldElement),",
390 "            cast_dynamic<@!Fieldtype!@>(pNewElement));",
391 "    }",
392 "@@endif",
393 "@@EndMFFieldLoop@@",
394 "}",
395 "",
396 "void @!Classname!@Base::removeFromMField(const UInt32 uiIndex,",
397 "                                         const UInt32 uiFieldId)",
398 "{",
399 "    Inherited::removeFromMField(uiIndex, uiFieldId);",
400 "",
401 "@@BeginMFFieldLoop@@",
402 "@@if isPtrField",
403 "    if(uiFieldId == @!Fieldname!@FieldId)",
404 "    {",
405 "        static_cast<@!Classname!@ *>(this)->@!removeFromMFieldIndex!@(",
406 "            uiIndex);",
407 "    }",
408 "@@endif",
409 "@@EndMFFieldLoop@@",
410 "}",
411 "",
412 "void @!Classname!@Base::removeFromMField(      FieldContainerPtrConstArg pElement,",
413 "                                         const UInt32                    uiFieldId)",
414 "{",
415 "    Inherited::removeFromMField(pElement, uiFieldId);",
416 "",
417 "@@BeginMFFieldLoop@@",
418 "@@if isPtrField",
419 "    if(uiFieldId == @!Fieldname!@FieldId)",
420 "    {",
421 "        static_cast<@!Classname!@ *>(this)->@!removeFromMFieldObject!@(",
422 "            cast_dynamic<@!Fieldtype!@>(pElement));",
423 "    }",
424 "@@endif",
425 "@@EndMFFieldLoop@@",
426 "}",
427 "",
428 "void @!Classname!@Base::clearField(const UInt32 uiFieldId)",
429 "{",
430 "    Inherited::clearField(uiFieldId);",
431 "",
432 "@@BeginFieldLoop@@",
433 "@@if isPtrField",
434 "@@if isSField",
435 "    if(uiFieldId == @!Fieldname!@FieldId)",
436 "    {",
437 "        static_cast<@!Classname!@ *>(this)->set@!Fieldname!@(NullFC);",
438 "    }",
439 "@@else",
440 "    if(uiFieldId == @!Fieldname!@FieldId)",
441 "    {",
442 "        static_cast<@!Classname!@ *>(this)->@!clearField!@();",
443 "    }",
444 "@@endif",
445 "@@endif",
446 "@@EndFieldLoop@@",
447 "}",
448 "",
449 "@@BeginMFFieldLoop@@",
450 "@@if isPtrField",
451 "@@if writePushToField",
452 "void @!Classname!@Base::@!pushToField!@(@!Fieldtype!@ConstArg value)",
453 "{",
454 "@@if checkNilPtr",
455 "    if(value == NullFC)",
456 "        return;",
457 "",
458 "@@endif",
459 "    editMField(@!Fieldname!@FieldMask, _@!fieldname!@);",
460 "",
461 "    addRef(value);",
462 "",   
463 "    _mf@!Fieldname!@.push_back(value);",
464 "@@if !checkNilPtr",
465 "",
466 "    if(value == NullFC)",
467 "        return;",
468 "@@endif",
469 "@@if linkMParent",
470 "",
471 "    @!Classname!@Ptr thisP = Inherited::constructPtr<@!Classname!@>(",
472 "        static_cast<@!Classname!@ *>(this));",
473 "",
474 "    value->addParent(thisP, @!Fieldname!@FieldMask);",
475 "@@endif",
476 "@@if linkSParent",
477 "",
478 "    @!Classname!@Ptr thisP = Inherited::constructPtr<@!Classname!@>(",
479 "        static_cast<@!Classname!@ *>(this));",
480 "",
481 "    value->setParent(thisP, @!Fieldname!@FieldMask);",
482 "@@endif",
483 "}",
484 "",
485 "@@endif",
486 "@@if writeInsertIntoMField",
487 "void @!Classname!@Base::@!insertIntoMField!@(UInt32                uiIndex,",
488 "                                             @!Fieldtype!@ConstArg value   )",
489 "{",
490 "@@if checkNilPtr",
491 "    if(value == NullFC)",
492 "        return;",
493 "",
494 "@@endif",
495 "    editMField(@!Fieldname!@FieldMask, _@!fieldname!@);",
496 "",
497 "    MF@!CapsFieldtypeClean!@::iterator fieldIt = _mf@!Fieldname!@.begin();",
498 "",
499 "    addRef(value);",
500 "",
501 "    fieldIt += uiIndex;",
502 "",
503 "    _mf@!Fieldname!@.insert(fieldIt, value);",
504 "@@if !checkNilPtr",
505 "",
506 "    if(value == NullFC)",
507 "        return;",
508 "@@endif",
509 "@@if linkMParent",
510 "",
511 "    @!Classname!@Ptr thisP = Inherited::constructPtr<@!Classname!@>(",
512 "        static_cast<@!Classname!@ *>(this));",
513 "",
514 "    value->addParent(thisP, @!Fieldname!@FieldMask);",
515 "@@endif",
516 "@@if linkSParent",
517 "",
518 "    @!Classname!@Ptr thisP = Inherited::constructPtr<@!Classname!@>(",
519 "        static_cast<@!Classname!@ *>(this));",
520 "",
521 "    value->setParent(thisP, @!Fieldname!@FieldMask);",
522 "@@endif",
523 "}",
524 "",
525 "@@endif",
526 "@@if writeReplaceInMFieldIndex",
527 "void @!Classname!@Base::@!replaceInMFieldIndex!@(UInt32                uiIndex,",
528 "                                                 @!Fieldtype!@ConstArg value   )",
529 "{",
530 "@@if checkNilPtr",
531 "    if(value == NullFC)",
532 "        return;",
533 "",
534 "@@endif",
535 "    if(uiIndex >= _mf@!Fieldname!@.size())",
536 "        return;",
537 "",
538 "    editMField(@!Fieldname!@FieldMask, _@!fieldname!@);",
539 "",
540 "    addRef(value);",
541 "@@if linkMParent",
542 "",
543 "    @!Classname!@Ptr thisP = Inherited::constructPtr<@!Classname!@>(",
544 "        static_cast<@!Classname!@ *>(this));",
545 "",
546 "    if(_mf@!Fieldname!@[uiIndex] != NullFC)",
547 "    {",
548 "        _mf@!Fieldname!@[uiIndex]->subParent(thisP);",
549 "    }",
550 "@@endif",
551 "@@if linkSParent",
552 "",
553 "    @!Classname!@Ptr thisP = Inherited::constructPtr<@!Classname!@>(",
554 "        static_cast<@!Classname!@ *>(this));",
555 "",
556 "    if(_mf@!Fieldname!@[uiIndex] != NullFC)",
557 "    {",
558 "        _mf@!Fieldname!@[uiIndex]->setParent(thisP, @!Fieldname!@FieldMask);",
559 "    }",
560 "@@endif",
561 "",
562 "    subRef(_mf@!Fieldname!@[uiIndex]);",
563 "",
564 "    _mf@!Fieldname!@[uiIndex] = value;",
565 "@@if !checkNilPtr",
566 "",
567 "    if(value == NullFC)",
568 "        return;",
569 "@@endif",
570 "@@if linkMParent",
571 "",
572 "    value->addParent(thisP, @!Fieldname!@FieldMask);",
573 "@@endif",
574 "@@if linkSParent",
575 "",
576 "    value->setParent(thisP, @!Fieldname!@FieldMask);",
577 "@@endif",
578 "}",
579 "",
580 "@@endif",
581 "@@if writeReplaceInMFieldObject",
582 "void @!Classname!@Base::@!replaceInMFieldObject!@(@!Fieldtype!@ConstArg pOldElem,",
583 "                                                  @!Fieldtype!@ConstArg pNewElem)",
584 "{",
585 "@@if checkNilPtr",
586 "    if(pNewElem == NullFC)",
587 "        return;",
588 "",
589 "@@endif",
590 "    Int32  elemIdx = _mf@!Fieldname!@.findIndex(pOldElem);",
591 "",
592 "    if(elemIdx != -1)",
593 "    {",
594 "        editMField(@!Fieldname!@FieldMask, _@!fieldname!@);",
595 "",
596 "        MF@!CapsFieldtypeClean!@::iterator fieldIt = _mf@!Fieldname!@.begin();",
597 "",
598 "        fieldIt += elemIdx;",
599 "",
600 "@@if linkMParent",
601 "        @!Classname!@Ptr thisP = Inherited::constructPtr<@!Classname!@>(",
602 "            static_cast<@!Classname!@ *>(this));",
603 "",
604 "        if(pOldElem != NullFC)",
605 "        {",
606 "            pOldElem->subParent(thisP);",
607 "        }",
608 "",
609 "@@if !checkNilPtr",
610 "        if(pNewElem != NullFC)",
611 "        {",
612 "            pNewElem->addParent(thisP, @!Fieldname!@FieldMask);",
613 "        }",
614 "@@else",
615 "        pNewElem->addParent(thisP, @!Fieldname!@FieldMask);",
616 "@@endif",
617 "",
618 "@@endif",
619 "@@if linkSParent",
620 "        @!Classname!@Ptr thisP = Inherited::constructPtr<@!Classname!@>(",
621 "            static_cast<@!Classname!@ *>(this));",
622 "",
623 "        if(pOldElem != NullFC)",
624 "        {",
625 "            pOldElem->setParent(NullFC, @!Fieldname!@FieldMask);",
626 "        }",
627 "",
628 "        if(pNewElem != NullFC)",
629 "        {",
630 "            pNewElem->setParent(thisP, @!Fieldname!@FieldMask);",
631 "        }",
632 "",
633 "@@endif",
634 "        addRef(pNewElem);",
635 "        subRef(pOldElem);",
636 "",
637 "        (*fieldIt) = pNewElem;",
638 "    }",
639 "}",
640 "",
641 "@@endif",
642 "@@if writeRemoveFromMFieldIndex",
643 "void @!Classname!@Base::@!removeFromMFieldIndex!@(UInt32 uiIndex)",
644 "{",
645 "    if(uiIndex < _mf@!Fieldname!@.size())",
646 "    {",
647 "        editMField(@!Fieldname!@FieldMask, _@!fieldname!@);",
648 "",
649 "        MF@!CapsFieldtypeClean!@::iterator fieldIt = _mf@!Fieldname!@.begin();",
650 "",
651 "        fieldIt += uiIndex;",
652 "",
653 "@@if linkMParent",
654 "        @!Classname!@Ptr thisP = Inherited::constructPtr<@!Classname!@>(",
655 "            static_cast<@!Classname!@ *>(this));",
656 "",
657 "        if(*fieldIt != NullFC)",
658 "        {",
659 "            (*fieldIt)->subParent(thisP);",
660 "        }",
661 "",
662 "@@endif",
663 "@@if linkSParent",
664 "        if(*fieldIt != NullFC)",
665 "        {",
666 "            (*fieldIt)->setParent(NullFC, @!Fieldname!@FieldMask);",
667 "        }",
668 "",
669 "@@endif",
670 "        subRef(*fieldIt);",
671 "",
672 "@@if removeToSet",
673 "        *fieldIt = @!removeTo!@;",
674 "@@else",
675 "        _mf@!Fieldname!@.erase(fieldIt);",
676 "@@endif",
677 "    }",
678 "}",
679 "",
680 "@@endif",
681 "@@if writeRemoveFromMFieldObject",
682 "void @!Classname!@Base::@!removeFromMFieldObject!@(@!Fieldtype!@ConstArg value)",
683 "{",
684 "    Int32 iElemIdx = _mf@!Fieldname!@.findIndex(value);",
685 "",
686 "    if(iElemIdx != -1)",
687 "    {",
688 "        editMField(@!Fieldname!@FieldMask, _@!fieldname!@);",
689 "",
690 "        MF@!CapsFieldtypeClean!@::iterator fieldIt = _mf@!Fieldname!@.begin();",
691 "",
692 "        fieldIt += iElemIdx;",
693 "",
694 "@@if linkMParent",
695 "        @!Classname!@Ptr thisP = Inherited::constructPtr<@!Classname!@>(",
696 "            static_cast<@!Classname!@ *>(this));",
697 "",
698 "        if(*fieldIt != NullFC)",
699 "        {",
700 "            (*fieldIt)->subParent(thisP);",
701 "        }",
702 "",
703 "@@endif",
704 "@@if linkSParent",
705 "        if(*fieldIt != NullFC)",
706 "        {",
707 "            (*fieldIt)->setParent(NullFC, @!Fieldname!@FieldMask);",
708 "        }",
709 "",
710 "@@endif",
711 "        subRef(*fieldIt);",
712 "",
713 "@@if removeToSet",
714 "        *fieldIt = @!removeTo!@;",
715 "@@else",
716 "        _mf@!Fieldname!@.erase(fieldIt);",
717 "@@endif",
718 "    }",
719 "}",
720 "@@endif",
721 "@@if writeClearField",
722 "void @!Classname!@Base::@!clearField!@(void)",
723 "{",
724 "    editMField(@!Fieldname!@FieldMask, _@!fieldname!@);",
725 "",
726 "    MF@!CapsFieldtypeClean!@::iterator       fieldIt  = _mf@!Fieldname!@.begin();",
727 "    MF@!CapsFieldtypeClean!@::const_iterator fieldEnd = _mf@!Fieldname!@.end  ();",
728 "",
729 "    while(fieldIt != fieldEnd)",
730 "    {",
731 "@@if linkMParent",
732 "        @!Classname!@Ptr thisP = Inherited::constructPtr<@!Classname!@>(",
733 "            static_cast<@!Classname!@ *>(this));",
734 "",
735 "        if(*fieldIt != NullFC)",
736 "        {",
737 "            (*fieldIt)->subParent(thisP);",
738 "        }",
739 "",
740 "@@endif",
741 "@@if linkSParent",
742 "        if(*fieldIt != NullFC)",
743 "        {",
744 "            (*fieldIt)->setParent(NullFC, @!Fieldname!@FieldMask);",
745 "        }",
746 "",
747 "@@endif",
748 "        subRef(*fieldIt);",
749 "",
750 "@@if removeToSet",
751 "        *fieldIt = @!removeTo!@;",
752 "",
753 "@@endif",
754 "        ++fieldIt;",
755 "    }",
756 "@@if clearMField",
757 "",
758 "    _mf@!Fieldname!@.clear();",
759 "@@endif",
760 "}",
761 "@@endif",
762
763 "@@else",
764 "/*********************************** Non-ptr code ********************************/
765 "@@if writePushToField",
766 "void @!Classname!@Base::@!pushToField!@(const @!Fieldtype!@& value)",
767 "{",
768 "    editMField(@!Fieldname!@FieldMask, _@!fieldname!@);",
769 "    _mf@!Fieldname!@.push_back(value);",
770 "}",
771 "",
772 "@@endif",
773 "@@if writeInsertIntoMField",
774 "void @!Classname!@Base::@!insertIntoMField!@(UInt32                uiIndex,",
775 "                                             const @!Fieldtype!@& value   )",
776 "{",