C语言 使用 doxygen 记录结构定义之外的 ac 结构的成员
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7199151/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Use doxygen to document members of a c structure outside of the structure definition
提问by Ben
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 dohave the header file for the foreign API but it is not practical to add my own comments to that file.
我正在使用 doxygen 来注释我的 C 代码。我正在使用文档稀缺的外国 API(即不是我自己的 API),因此我打算在我自己的源文件中记录其中的一些 API。我确实有外部 API 的头文件,但是将我自己的注释添加到该文件中是不切实际的。
Foreign Header
外部标题
struct foreignstruct
{
int a;
int b;
};
My Header
我的标题
/** 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...
*/
What tag do I use in place of @???to get the correct doxygen output (where 'correct' means generated output for mystructand foreignstructare the same)?
我在的地方用什么标签@???,以获得正确的doxygen输出(其中生成的输出为“正确”的方式mystruct和foreignstruct相同)?
回答by doxygen
Maybe one day doxygen will have a special @field tag for this, until that time, the following can be used:
也许有一天 doxygen 会有一个特殊的 @field 标签,直到那时,可以使用以下内容:
/** @struct foreignstruct
* @brief This structure blah blah blah...
* @var foreignstruct::a
* Member 'a' contains...
* @var foreignstruct::b
* Member 'b' contains...
*/
Which is a short-hand notation for
这是一个简写的符号
/** @struct foreignstruct
* @brief This structure blah blah blah...
*/
/** @var foreignstruct::a
* Member 'a' contains...
*/
/** @var foreignstruct::b
* Member 'b' contains...
*/

