Book a Demo

Author Topic: template  (Read 2650 times)

MREA

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
template
« on: November 15, 2012, 05:12:21 pm »
hi
is there a way to call the tagged value of an attr from the class template?

what i have

class body Impl:

Code: [Select]
$comment =" creating #ifdef"
$bodyFeatures = %list="Attribute__IfDef" @separator="\n" attScope=="Private" or linkAttAccess=="Private"%
$bodyFeatures = %REMOVE_DUPLICATES($bodyFeatures, "\n")%
$bodyFeatures = %TRIM($bodyFeatures, "\n")%
$bodyFeatures

own template:

Code: [Select]
$Comment ="this template generates the attr for the #ifdef package"


$comment="pass only if IfDef is set"
%if attTag:"IfDef" == ""%
%endTemplate%

#ifdef %attTag:"IfDef"%
$comment= "same like attr"
%if classStereotype == "enumeration"%
%PI=""%
%attName%
%attInitial ? " = " value%
%endTemplate%

rest like in attribute


at the end it should be something like that

#ifdef nameOfTag
attr
attr
#endif /*nameOfTag*/

#ifdef nameOfTag2
attr
attr
#endif /*nameOfTag2*/

#ifdef nameOfTag3
attr
attr
#endif /*nameOfTag3*/
Support- Languages: German, English, French

MREA

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: template
« Reply #1 on: November 15, 2012, 07:40:22 pm »
or could someone help me with a class stereotype of this?
because it do not work.

I declair a class as <<ifdef>> and than a copy all struct templates and do only some modifications like { } will be #ifdef #endif

but if I generate it do not work!

btw. the attributes are private
Support- Languages: German, English, French