dr_pepper
dr_pepper

Reputation: 1587

How to add documentation to the class description from a comment within a function in doxygen?

When using C++ with doxygen I would like to add to the class description from within a function. I basically want to add information about the function calls I am making.

class_name.h

/**
 * This is the overall description of the class
 */
class ClassName
{
...
}

class_name.cpp:

void ClassName::randomFunction()
{
    /**
     * @class ClassName 
     *
     * calls testData on stuff (this should be appended to the class description)
     */
    testData(stuff);
}

Doxygen output:

<b>Detailed Description</b>
<br>
This is the overall description of the class
<br>
calls testData on stuff

This method works when I put the comment outside of a function, but does not show up anywhere if I put it within randomFunction as the example shows. In the end, I would like the reader of the documentation to see a description of the class followed by the snippet that I have in the example. This makes it easier to keep my documentation in sync with the code and immediately tells the user about important functions that I am calling.

The reason I want to do this is to document the network messages that the class makes in one place instead of having the user search through documentation on multiple member functions.

EDIT: doxygen version is 1.8.5

added clarification

Upvotes: 0

Views: 2170

Answers (1)

albert
albert

Reputation: 9057

The used version of doxygen (1.8.5, August 23, 2013) is a bit old and it is advised to update to the current version (1.8.17).

To have code snippets or documentation snippets in an other place as well doxygen has the command \snippet (see http://doxygen.nl/manual/commands.html#cmdsnippet).

To group information in different places doxygen has grouping commands like \defgroup (http://doxygen.nl/manual/commands.html#cmddefgroup), \ingroup (http://doxygen.nl/manual/commands.html#cmdingroup), \addtogroup (http://doxygen.nl/manual/commands.html#cmdaddtogroup). See also the grouping chappetr in the doxgen documentation (http://doxygen.nl/manual/grouping.html).

Upvotes: 2

Related Questions