Book a Demo

Author Topic: C++ comment string start/end  (Read 3632 times)

thn

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
C++ comment string start/end
« on: May 18, 2004, 02:52:30 pm »
I updated my corporate version of EA to the 726 build.  My main reason for updating, from 3.5.???,  was to get improved C++ code generation.  I've been searching and searching yet I can't find a way to get the latest version to produce a simple "//" comment.

The online help indicates the C++ Specifications dialog contain the comment string start/end specifiers, but this feature appears to have been removed.

The C++ Class Notes Code Template shows:
 $style = %genOptCPPCommentStyle%

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

I'm hoping these three options are not my only choices i.e. I don't want C, JavaDoc, nor XML style comments.

Our coding standard mandates "//" style comments, so how do I get the new version to do what the old version did?

Any assistance would be greatly appreciated!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: C++ comment string start/end
« Reply #1 on: May 18, 2004, 06:31:21 pm »
Hi,

I've found a work around for you that you'll need to put in each of the templates that produce comments.  Unfortunately, I've needed to make a code change to get it to work and you'll need to wait for build 728 for the change.

What you want to do is replace the entire block of template that you showed, or just the %CSTYLE_COMMENT($wrapLen)% with the following.

$comment = %CSTYLE_COMMENT($wrapLen)%
$comment = %REPLACE($comment, " * ", "// ")%
$comment = %REPLACE($comment, "/**\n", "")%
%REPLACE($comment, "\n */", "")%

In the current build you'll have to remove the newline from the replace for the first line of comment and you'll still have the newline there.

Hope that helps.

Simon

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: C++ comment string start/end
« Reply #2 on: May 19, 2004, 07:44:13 pm »
Pardon my previous long winded approach.  This should work too.

WRAP_COMMENT(classNotes, $wrapLen, "", "// ")

Then you'll need to change classNotes to whatever is appropriate at each point.

For what these are you can look in the help file.

http://www.sparxsystems.com.au/EAUserGuide/fieldsubstitutionmacros.htm

thn

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: C++ comment string start/end
« Reply #3 on: May 20, 2004, 07:45:58 am »
I'm definitely impressed with the response time and content.  Two workable solutions in as many days - well done!

I tried the first solution and it worked well.  I'll try the other, less long-winded, approach now.

Again, thanks for the quick and useful response!