Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 More flexible method documentation snipplet
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

magmy
Starting Member

Norway
1 Posts

Posted - Jun 17 2009 :  06:08:51 AM  Show Profile  Reply with Quote
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

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Jun 17 2009 :  12:31:51 PM  Show Profile  Reply with Quote
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.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000