Book a Demo

Author Topic: code generation templates: C++ style comments  (Read 4712 times)

M Maher

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
code generation templates: C++ style comments
« on: September 03, 2015, 09:00:18 pm »
Hi

Does anyone know if it is possible to setup "real" c++ comment, eg:

//-------------------------------------
//  blah blah blah...
//-------------------------------------

...in preference to the default C++ style comments which are C-style, eg:

/**
 * blah blah blah...
 */

cheers

Mat

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: code generation templates: C++ style comments
« Reply #1 on: September 14, 2015, 11:06:20 am »
You can change the templates, there are a couple of different functions you can use. Look for WRAP_LINES from memory.

Adding the dashes will cause problems for round-trip though as it can't be distinguished from the actual note.

M Maher

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: code generation templates: C++ style comments
« Reply #2 on: September 16, 2015, 02:01:27 am »
WRAP_LINES() is a good reference: thanks!

However, I have one more issue whilst implementing this: where exactly can you use this in place of CSTYLE_COMMENT(). Looking at ClassNotes/OperationNotes/etc:

%if genOptGenComments != "T" or genOptCPPGenMethodNotesInHeader != "T"%
%endTemplate%

%PI=""%
$wrapLen = %genOptWrapComment%
$style = %genOptCPPCommentStyle%

%if $style == "XML.NET"%
%XML_COMMENT($wrapLen)%
%elseIf $style == "JavaDoc"%
%JAVADOC_COMMENT($wrapLen)%
%else%
%CSTYLE_COMMENT($wrapLen)%
%endIf%

I can't see anywhere in here which actually extracts the notes: just seems to set the width.

Any ideas?

Mat

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: code generation templates: C++ style comments
« Reply #3 on: September 16, 2015, 08:18:01 am »
XML_COMMENT, JAVADOC_COMMENT and CSTYLE_COMMENT automatically use the notes of the current context.

WRAP_LINES is a little more flexible. Just pass it the value of classNotes, opNotes etc. depending on the template you are in.

jpapp

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-1
    • View Profile
Re: code generation templates: C++ style comments
« Reply #4 on: January 11, 2019, 08:21:45 pm »
Hello!
How can I set up what kind of comments are imported to EA as notes from source code?
Currently doxygen style comments from C++ are not imported for eg class fields/methods as notes.