Search code examples
cdocumentationdoxygendocumentation-generation

How to document struct data members outside of struct


When I document a function with Doxygen I can do this:

/*!
 * @brief does something
 * @param a first parameter
 *
 * Longer description
 */
void foo(int a) { /* */ }

But is there way I can document struct members this way:

/*!
 * @brief a struct
 * @??? a first struct member
 * @??? b second struct member
 *
 * Longer description
 */
struct a 
{
    int a,
    int b,
};

The reason is, I want to avoid having to document my struct members with inline comments, if possible.


Solution

  • /*!
     * @struct str_a
     * @brief my a struct
     * @details Longer description
     *
     * @var str_a::a
     *   @brief first struct member
     *   @details detailed first struct member
     * @var str_a::b
     *   @brief brf second struct member
     *   @details detailed second struct member
     *
     */
    struct str_a
    {
        int a;
        int b;
    };