Book a Demo

Author Topic: templates  (Read 2768 times)

Martin Terreni

  • EA User
  • **
  • Posts: 672
  • Karma: +0/-0
  • Sorry, I can't write
    • View Profile
templates
« on: December 06, 2004, 05:34:00 am »
Hi
   I would like to make diferent note types for contrsuctors/distructors and normal methods.
  I tried doing it through operation notes templates but it didnt work. how can I know if the template was called for contrsuctors/distructors or normal methods?

I tried many things including the following but  it didnt work, I get more then one type...

$constructor = %className%+"::"+%className%
$destructor = %className%+"::~"+%className%
%if FIND(opName,$destructor) != -1%
//------------------------------ Constructor ------------------------------
//%OperationDeclarationImpl%
//
%elseIf FIND(opName,$destructor) != -1%
//------------------------------ Destructor ------------------------------
//%OperationDeclarationImpl%
//
%else%
//------------------------------ Method ------------------------------
//%OperationDeclarationImpl%
//
%endIf%
%if genOptGenComments != "T" or genOptCPPGenMethodNotesInBody != "T"%
// Notes:
//
%endTemplate%
// Notes:
// o  none
%PI=""%
$wrapLen = %genOptWrapComment%
$style = %genOptCPPCommentStyle%

%if $style == "XML.NET"%
%XML_COMMENT($wrapLen)%
%elseIf $style == "JavaDoc"%
%JAVADOC_COMMENT($wrapLen)%
%else%
%CSTYLE_COMMENT($wrapLen)%
%endIf%
//------------------------------------------------------------------------
Recursion definition:
If you don’t understand the definition read "Recursion definition".

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: templates
« Reply #1 on: December 06, 2004, 02:37:51 pm »
Hi Martin,

Firstly, you can't use function macros in conditions.  You'll need to assign the result to a variable and use that instead.

Also, the opName will never contain %className%+"::"+%className% instead try

Code: [Select]
$destructor="~"+%className%
%if opName==className%
...
%elseIf opName==$destructor%
...
%else%
...
%endIf%

Simon

Martin Terreni

  • EA User
  • **
  • Posts: 672
  • Karma: +0/-0
  • Sorry, I can't write
    • View Profile
Re: templates
« Reply #2 on: December 07, 2004, 12:38:33 am »
Thanks
Recursion definition:
If you don’t understand the definition read "Recursion definition".