Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 More flexible method documentation snipplet

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
magmy Posted - Jun 17 2009 : 06:08:51 AM
Thanks for a good product!

In our company uses C++ we document methods along the following lines.

1) Documentation follows the method header. This removes the need for repeating the method name in the documentation. (Reducancy is bad in code).
2) Arguments are grouped into two groups, In and Out.
3) The first and the following lines of the In and the Out sections, repectively, are formatted differently.

The documentation snipplet does not allow for any of the above options.


As a solution to 1 I suggest that you introduce a macro called $SIGNATURE$. In our case, we would write the documentation snipplet like this:
$SIGNATURE$
/* ... */

If not specified, $SIGNATURE$ is assumed at the end of the snipplet, like this:
/* ... */
$SIGNATURE$

The above would be the same as writing just the following:
/* ... */



A solution to 2 is that you introduce the following new macros:
$INPUTARG$
$OUTPUTARG$

A documentation snipplet can then be written like this:
/* In:   $INPUTARG$
   Out:  $OUTPUTARG$
*/

In C++ you can use heuristics to group arguments into input and outputs. Below are some examples:
int A -> input (pass by value)
int &B -> output (reference to modifiable data)
int const &C -> input (reference to constant data)
int const *pE -> input (pointer to constant data)
int *pD -> output (pointer to modifiable data)



A solution to 3 is that you introduce the following new macros:
$INPUTARG1$
$INPUTARGN$
$OUTPUTARG1$
$OUTPUTARGN$

A documentation snipplet can then be written like this:
$SIGNATURE$
/* In:      $INPUTARG1$
            $INPUTARGN$
   Out:     $OUTPUTARG1$
            $OUTPUTARGN$
   Return:  
*/

Here is an example:
int SafeDivide(int A, int B, bool &Ok)
/* Purpose:   
   In:        A - 
              B - 
   Out:       Ok - 
   Return:    
*/ {
   Ok = B != 0;
   return B ? A/B : 0;
} // SafeDivide

Here is the finished declaration, after some additinal manual input:
Here is an example to illustrate:
int SafeDivide(int A, int B, bool &Ok)
/* Purpose:   Divde two numbers.
   In:        A - Numerator
              B - Denumerator
   Out:       Ok - Able to divide?
   Return:    0 if B is zero. A/B otherwise.
*/ {
   Ok = B != 0;
   return B ? A/B : 0;
} // SafeDivide


Best regards,
Magne
1   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jun 17 2009 : 12:31:51 PM
It is quite unlikely we will try to do all of this, since this is quite a lot of work for a very specific situation. I have put in a feature request to have Document Method place the comment after the signature, since I can see this being more widely used:

case=28417

If you want something very particular you might want to look into writing an IDE macro to create / modify the comment block.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000