Book a Demo

Author Topic: code template for "operation notes"  (Read 4342 times)

Andreas_G

  • EA User
  • **
  • Posts: 125
  • Karma: +0/-0
  • And that's the way the cookie crumbles.
    • View Profile
code template for "operation notes"
« on: June 30, 2004, 04:39:45 am »
Hi there,

it's again me, and (again) with a code template problem. I know, it's very nerving  :-[

I try to alter my "Operation Notes" template that it produce something like that:

Code: [Select]

///////////////////////////////////////////////////
/// This is the function description
///
/// @return This is desc for return value
/// @param param1 this is param1 description
///
/// @author theAuthor


I know this is very similar to the origninal template with "JavaDoc" setting, the (main) difference is, that in my version single line comments ("// ") should be used.

does anybody know how to do that, or does anybody written a template like that?  ???
bye
Andreas

benc

  • EA Administrator
  • EA User
  • *****
  • Posts: 200
  • Karma: +0/-0
    • View Profile
Re: code template for "operation notes"
« Reply #1 on: July 01, 2004, 12:02:29 am »
Hello Andreas,

Have you tried manipulating the result from the built-in JavaDoc comment function ...

something like this:

$tmp = %JAVADOC_COMMENT(genOptWrapComment)%
$tmp = %REPLACE($tmp,"\n *", "\n///")%
$tmp

Trim the left and right edges a bit .. then it should be close?

If it can't be achieved, we'd like to hear about it.

I hope this helps.

Regards,
Ben



Andreas_G

  • EA User
  • **
  • Posts: 125
  • Karma: +0/-0
  • And that's the way the cookie crumbles.
    • View Profile
Re: code template for "operation notes"
« Reply #2 on: July 01, 2004, 02:50:45 am »
Hi Ben,

thanx for your help.

This will work fine for a first step. But I'm insatiably  ;)

Is there a way to get in the "Operation Notes" Template Informations about the parameter itself (Like %paramName%, %paramKind% and so on)

That will help to produce some output like

Code: [Select]
/// @param[out] myParam     This is the Description
(This is doxygen-compatible output)


p.s: Code Templates are realy cool  8)

Regards,
Andreas
bye
Andreas

benc

  • EA Administrator
  • EA User
  • *****
  • Posts: 200
  • Karma: +0/-0
    • View Profile
Re: code template for "operation notes"
« Reply #3 on: July 01, 2004, 06:54:27 pm »
Hello Andreas,

Ok, we're brushing against some limits of the current code template framework, but I can think of a couple of ways that might achieve what you are after.

1. (A quick hack)
In your Operation Notes templates try something like this:
%list="ParameterImpl" @separator="\n"%)

You'll override the ParameterImpl template to contain whatever parameter note info you wanted. Then process the result a bit back in the Operation Notes template. I have really tested this particular abuse of the templates, but you should be able to get away with it in java, since you probably don't need the implementation templates for anything else.

2. (A slightly more involved, more powerful hack)
There's an "undocumented" function macro called EXEC_ADD_IN.  It should be accessible with the 730 release, but comes with the following warnings :
- It's not documented
- It's subject to change
- It's not supported (yet)
- Use it at your own risk

Here's roughly how you might use it from your notes template:

$result = %EXEC_ADD_IN("MyAddIn","MyTest",opGUID)%

where
- "MyAddIn" is the name of an add-in you created and registered with EA (see help file)
- "MyTest" is the name of the add-in function you want to call
- opGUID is another undocumented macro, which returns the guid of the operation in scope. It also happens to be used above as the first parameter (in a variable parameter list) that got passed to the MyAddIn.MyTest function.


Ok here's roughly what a corresponding vb function (use whatever language you can) might look like to handle the call :

Function MyTest(Repository As EA.Repository, Args As Variant) As Variant
   Dim arg As String
   arg = Args(LBound(Args))
   MsgBox "The argument you supplied was:" + arg, vbCritical
End Function

(refer to help file for the interfaces required to be implemented by EA add-ins- I think the minimum is the EA_Connect() function)

Remember you have a handle to the Repository object in your add-in so you can access it and/or do plenty of damage as per use of the Automation Interface. So far I have found it useful enough for the code template to pass in the required info, get the add-in to process it a bit and return, without even accessing the repository object. But for your scenario, you might want to pull the out the parameter information and that's where I leave you :D

Regards,
Ben







Andreas_G

  • EA User
  • **
  • Posts: 125
  • Karma: +0/-0
  • And that's the way the cookie crumbles.
    • View Profile
Re: code template for "operation notes"
« Reply #4 on: July 02, 2004, 12:16:15 am »
Hi Ben,

ok, first way is not practicable for me. I work with C++ and use allready the ParameterImpl Makro.

But the second way may work. Even if it is a little bit hard to go. I think for starters the solution with the JAVADOC_COMMENT() version should work.  ;)

Regards,
Andreas
bye
Andreas