doxygen comment multiple variables at once

11,347

Solution 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.

Solution 2

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

Solution 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;
//@}

Solution 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;
//@}
Share:
11,347

Related videos on Youtube

cjh
Author by

cjh

Hacker interested in programming language implementation & design, type theory, developer tooling, concurrency, and scale. By day I break all things Chrome for Google Sydney. By night I hack on various things https://github.com/chrisosaurus

Updated on May 30, 2022

Comments

  • cjh
    cjh about 2 years

    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

  • cjh
    cjh about 13 years
    Thanks for your post, I still cannot get it to work. Please see my updated post for what I tried.
  • evnu
    evnu about 13 years
    Yes, it will only document x. Unfortunately, writing int x; int y,z; also doesn't seem to work. Maybe file a bug?
  • cjh
    cjh about 13 years
    Accepted as nothing better came and it could be a bug with doxygen or its documentation.
  • Stefano Borini
    Stefano Borini over 11 years
    @cjh I am having the same issue with member functions groups. I think it's a bug.