doxygen comment multiple variables at once

2019-04-04 05:12发布

问题:

If I have the following:

/**
 * @brief (x,y,z) points for block
 */
int x, y, z;

It will only generate that documentation for x, is it possible in doxygen to get it to comment all x, y and z with one comment?

EDIT Following the suggestions of envu I now have the following (based off http://www.doxygen.nl/manual/grouping.html#memgroup)

//@{
/** some documentation here */
int x, y, z;
//@}

or

//@{
/**
 * @brief some documentation here
 */
int x, y, z;
//@}

However both of these still only document x. Trying it with different forms I have yet to get the same documentation string to span multiple variables

回答1:

I would use member groups http://www.doxygen.nl/manual/grouping.html#memgroup for this. The syntax and output is a little bit different to what you want to achieve, but I think that shouldn't hurt.



回答2:

Been banging my head on this one for a while. Turns out you have to set DISTRIBUTE_GROUP_DOC = YES in the configuration.



回答3:

I realize this is an old question, but I've been having a similar problem and found a workaround that doesn't exactly solve the problem but might be an acceptable substitute in certain cases.

By putting a comment above the member group block and prefixing it with the \name decorator, you get a description that shows up above all of the variables in the member group in the attributes list of the Doxygen page. I believe this is intended to be a short description, but you can put arbitrarily long descriptions here if you wish.

This doesn't have the effect of putting the same comments in the detail field for each of the variables in the member group (the detail fields will be empty, or if you put a comment inside the member group block it will still only apply to the first variable), but it does have the effect of documenting a related group of variables together, which seems like what the original intent of the question was.

Example:

/*! \name This will be the description for the following group of variables
          It can be arbitrarily long, but the first line will show up in bold,
          and any subsequent lines will show up like a description under it
*/
//@{
int relatedVariable1;
int relatedVariable2;
char* relatedVariable3;
//@}


回答4:

I've set the option "DISTRIBUTE_GROUP_DOC" in the "Expert" tab. Them all the members of the group received the same comment.

//@{
/** same comment for all members */
char aaa;
char bbb;
int ccc;
//@}