How to document a property in Doxygen if the language only supports accessors?

Viewed 496

In C/C++ I usually need to document a property, not only its accessors (getters and setters). Some documentation systems support this directly, for example, GTK-Doc. But how can I do this with Doxygen?

I describe properties in getters, but it's definitely not a solution. Copying the description in both getter and setter is even worse.

A typical C example, where Obj is opaque:

/**
 * Doc for getter
 */
int getSize(Obj* obj);

/**
 * Doc for setter
 */
void setSize(Obj* obj, int size);

// Where to put the documentation for size itself?
1 Answers

You could do this:

class SomeClass
{
private:
    m_size ///< Documentation for the property...  
}

See the section "Putting documentation after members" here. Various other comment formats are specified on that page. You can choose the one that best fits what you already have.

Related