Toby
Toby

Reputation: 10144

Doxygen document possible parameter values

Currently my C-code function declaration is documented as follows

/** Some fubar function
 *@param[in]    val1    the first input variable
 *@param[in]    val2    the second input variable
 */
void foo (int val1, int val2);

But say the parameters can only except numbers within a certain range, e.g., 0-500

Is it possible to document this other than as part of the parameter description? Maybe so that it shows up separately in the produced documentation?

E.g. in the latex-produced pdf a table would be produced with a cell for the parameter type (int) the direction (in) and the name (var1/var2). There is some way of having another table cell with 0-500?

Upvotes: 3

Views: 5139

Answers (1)

Timmie Smith
Timmie Smith

Reputation: 433

Your best bet may be a table in the detail section. Doxygen supports HTML commands inside the documentation, and the table generated in the PDF looks decent.

/**
 * @brief Some fubar function
 * @param[in]    val1    the first input variable
 * @param[in]    val2    the second input variable
 *
 * <TABLE>
 * <TR><TD>Type</TD><TD>Direction</TD><TD>Name</TD><TD>Value Range</TD></TR>
 * <TR><TD>int</TD><TD>in</TD><TD>val1</TD><TD>0-500</TD></TR>
 * <TR><TD>int</TD><TD>in</TD><TD>val2</TD><TD>1-1000</TD></TR>
 * </TABLE>
 */
 void foo(int val1, int val2) {}

The issue is that it looks very redundant to me. Perhaps limiting the table to parameter name and expected value would look better.

See Doxygen Manual: HTML Commands for the set of HTML supported by doxygen.

Upvotes: 2

Related Questions