How can I avoid repeating myself in doxygen comments (unfortunately without member groups)?

53 Views Asked by At

I'm documenting a (C++) library of mine with doxygen comments.

In this library, I have some cases of overloads of the same function, doing the same thing but with different inputs, e.g.

void frobincate(char const* s, int x, bool b);
void frobincate(char const* s, float f, double d);

I've noticed Doxygen has group begin and end commands,///@{ and ///@}, and so I naively write:

/// @brief Perform frobnication
/// @param s just some string

///@{

/// @param x a xylophonic calue
/// @param b a bulwark of a value
void frobincate(char const* s, int x, bool b);

/// @param f a fantastic value
/// @param d a dastardly value
void frobincate(char const* s, float f, double d);

///@}

However, looking at the doxygen documentation for this kind of grouping and the generated output sample, it seems that the group-level commands I specified do not apply to any group members - just to the group-level documentation. And, in fact, I am not interested in drawing special attention to frobnicate() - it's simply a function with more than a single possible type combination of input parameters.

Is there a way for me to not-repeat-myself w.r.t. function documentation, on one hand, but have that documentation text be applied to the actual function, on the other? Or must I resort to copy-and-paste?

1

There are 1 best solutions below

0
einpoklum On

(Thanks @albert for pointing this out)

You can use the @copydoc command to copy the @brief and @details documentation content from your first documented item to your second and subsequent items. This should work even when you're referring to one variant of several functions of the same name.

If you do this, you can get rid of the grouping.

Unfortunately, this will currently not copy @param documentation.