在 doxygen 中记录 C 类型定义
Documenting C typedefs in doxygen
按照doxygen手册中的例子,我构建了测试头文件test.h
:
/**
* @file test.h
*/
/** @brief This is a struct
* @var foo A foo.
* @var bar Also a Foo.
* @var baz (unused field)
*/
typedef struct {
int foo;
int bar;
char *baz;
} whatsit;
当我使用默认 Doxyfile
(由“doxygen -g
”生成)时,我看到了警告:
...test.h:11: warning: Compound whatsit is not documented
...test.h:7: warning: documented symbol `foo A Foo` was not defined
...test.h:12: warning: Member foo (variable) of class whatsit is not documented
什么给了?我从手册中得到的印象是,当注释直接在定义之前时,您不需要像 @struct
这样的标签,而且在上面的块中记录成员变量是合法的,而不是在同一个块中它们用 /*< ...
语法声明的行。 (我绝对讨厌后一种风格...)
我怎样才能让它正确识别评论?
根据文档:
24.51 \var (变量声明)
表示注释块包含变量或枚举值的文档(全局或作为 class 的成员)。此命令等效于 \fn、\属性 和 \typedef.
表示在 \var 行中只应包含变量名。由于变量 foo
不存在但结构成员 whatsit::foo
您必须使用完整限定名。
结构的类似推理。
结果应该是这样的:
/**
* @file test.h
*/
/** @struct whatsit
* This is a struct
*
* @var whatsit::foo
* A foo.
* @var whatsit::bar
* Also a Foo.
* @var whatsit::baz
* (unused field)
*/
typedef struct {
int foo;
int bar;
char *baz;
} whatsit;
按照doxygen手册中的例子,我构建了测试头文件test.h
:
/**
* @file test.h
*/
/** @brief This is a struct
* @var foo A foo.
* @var bar Also a Foo.
* @var baz (unused field)
*/
typedef struct {
int foo;
int bar;
char *baz;
} whatsit;
当我使用默认 Doxyfile
(由“doxygen -g
”生成)时,我看到了警告:
...test.h:11: warning: Compound whatsit is not documented
...test.h:7: warning: documented symbol `foo A Foo` was not defined
...test.h:12: warning: Member foo (variable) of class whatsit is not documented
什么给了?我从手册中得到的印象是,当注释直接在定义之前时,您不需要像 @struct
这样的标签,而且在上面的块中记录成员变量是合法的,而不是在同一个块中它们用 /*< ...
语法声明的行。 (我绝对讨厌后一种风格...)
我怎样才能让它正确识别评论?
根据文档: 24.51 \var (变量声明)
表示注释块包含变量或枚举值的文档(全局或作为 class 的成员)。此命令等效于 \fn、\属性 和 \typedef.
表示在 \var 行中只应包含变量名。由于变量 foo
不存在但结构成员 whatsit::foo
您必须使用完整限定名。
结构的类似推理。
结果应该是这样的:
/**
* @file test.h
*/
/** @struct whatsit
* This is a struct
*
* @var whatsit::foo
* A foo.
* @var whatsit::bar
* Also a Foo.
* @var whatsit::baz
* (unused field)
*/
typedef struct {
int foo;
int bar;
char *baz;
} whatsit;