使用doxygen在结构定义之外记录c结构的成员 [英] Use doxygen to document members of a c structure outside of the structure definition

查看:61
本文介绍了使用doxygen在结构定义之外记录c结构的成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用doxygen注释我的C代码。我使用的是外部API(即不是我自己的API),但缺少相关文档,因此我打算在自己的源文件中记录一些该API。我有用于外部API的头文件,但是将我自己的注释添加到该文件中是不切实际的。

I am using doxygen to comment my C code. I am making use of a foreign API (i.e. not my own) for which documentation is scarce so I intend to document some of that API within my own source files. I do have the header file for the foreign API but it is not practical to add my own comments to that file.

外国标头

struct foreignstruct
{
    int a;
    int b;
};

我的标题

/** My structure comments... */
struct mystruct
{
    /** Describe field here... */
    int field;
};

/** @struct foreignstruct
 *  @brief This structure blah blah blah...
 *  @??? a Member 'a' contains...
 *  @??? b Member 'b' contains...
 */

我在什么标签中使用 @ ??? 的位置以获取正确的doxygen输出(其中 correct表示为 mystruct foreignstruct 是相同的)?

What tag do I use in place of @??? to get the correct doxygen output (where 'correct' means generated output for mystruct and foreignstruct are the same)?

推荐答案

也许有一天doxygen会有一个为此,需要特殊的@field标记,直到那时为止,可以使用以下代码:

Maybe one day doxygen will have a special @field tag for this, until that time, the following can be used:

/** @struct foreignstruct
 *  @brief This structure blah blah blah...
 *  @var foreignstruct::a 
 *  Member 'a' contains...
 *  @var foreignstruct::b 
 *  Member 'b' contains...
 */

/** @struct foreignstruct
 *  @brief This structure blah blah blah...
 */
/** @var foreignstruct::a 
 *  Member 'a' contains...
 */
/** @var foreignstruct::b 
 *  Member 'b' contains...
 */

这篇关于使用doxygen在结构定义之外记录c结构的成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆