记录 Doxygen 中定义的预处理器
是否可以在 Doxygen 中记录预处理器定义?我期望能够像变量或函数一样执行此操作,但是 Doxygen 输出似乎“丢失”了定义的文档,并且也不包含定义本身。
我尝试了以下操作
/**My Preprocessor Macro.*/
#define TEST_DEFINE(x) (x*x)
,还
/**@def TEST_DEFINE
My Preprocessor Macro.
*/
#define TEST_DEFINE(x) (x*x)
尝试将它们放入一个组中(尝试了 defgroup、addtogroup 和 ingroup),而不仅仅是在“文件范围”中,但这也没有效果(尽管组中的其他项目已按预期记录)。
我查看了各种 Doxygen 选项,但没有看到任何可以启用(或阻止)定义文档的内容。
Is it possible to document preprocessor defines in Doxygen? I expected to be able to do it just like a variable or function, however the Doxygen output appears to have "lost" the documentation for the define, and does not contain the define itself either.
I tried the following
/**My Preprocessor Macro.*/
#define TEST_DEFINE(x) (x*x)
and
/**@def TEST_DEFINE
My Preprocessor Macro.
*/
#define TEST_DEFINE(x) (x*x)
I also tried putting them within a group (tried defgroup, addtogroup and ingroup) rather than just at the "file scope" however that had no effect either (although other items in the group were documented as intended).
I looked through the various Doxygen options, but couldn't see anything that would enable (or prevent) the documentation of defines.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
是的,这是可能的。 Doxygen 文档 说:
行。您可以使用
@defgroup
、@addtogroup
和@ingroup
将相关项放入同一模块中,即使它们出现在单独的文件中(有关详细信息,请参阅文档此处)。这是一个适合我的最小示例(使用 Doxygen 1.6.3):Doxyfile:
Test.h:
Foo.h:
Bar.h:
在本例中,
TEST_DEFINE
文档显示在 HTML 中 Files 选项卡下的 Test.h 条目中输出,并且TEST_AAA
等定义与类Foo
和函数一起出现在 Modules 选项卡中的 Test Group 下酒吧
。需要注意的一件事是,如果将文件名放在
@file
命令后面,例如:那么这必须与文件的实际名称匹配。如果没有,则不会生成文件中项目的文档。
如果您不想添加
@file
命令,另一种解决方案是在 Doxyfile 中设置EXTRACT_ALL = YES
。我希望这有帮助!
Yes, it is possible. The Doxygen documentation says:
You can use
@defgroup
,@addtogroup
, and@ingroup
to put related items into the same module, even if they appear in separate files (see documentation here for details). Here's a minimal example that works for me (using Doxygen 1.6.3):Doxyfile:
Test.h:
Foo.h:
Bar.h:
In this case, the
TEST_DEFINE
documentation appears in the Test.h entry under the Files tab in the HTML output, and theTEST_AAA
etc. definitions appear under Test Group in the Modules tab together with classFoo
and functionBar
.One thing to note is that if you put the file name after the
@file
command, e.g:then this must match the actual name of the file. If it doesn't, documentation for items in the file won't be generated.
An alternative solution, if you don't want to add
@file
commands, is to setEXTRACT_ALL = YES
in your Doxyfile.I hope this helps!
在我的“C”文件中,我使用注释格式和#define 行,如下所示:
我的 html 文档最终包含我指定的文档。 (我确实在文件顶部有 @file 并且 EXTRACT_ALL=YES)
In my "C" files, I use a comment format and #define line like this:
My html documents do end up containing documentation I specify. (I do have @file at the top of the file and EXTRACT_ALL=YES)
尝试设置 EXTRACT_ALL 选项,我在我的项目中设置了该选项,它会生成 #defines 的文档。可能有一种更优雅的方法,无需使用 EXTRACT_ALL 即可完成此操作,因此请务必查看文档
http: //www.doxygen.nl/config.html#cfg_extract_all
Try setting EXTRACT_ALL option, I have that set in my project and it generates documentation for #defines. There might be a more elegant way of doing it without using EXTRACT_ALL so be sure to check the documentation
http://www.doxygen.nl/config.html#cfg_extract_all
除了前面的答案之外,还需要在 Doxyfile 上设置
ENABLE_PREPROCESSING=YES
。Adding to the previous answers, it is also needed to have
ENABLE_PREPROCESSING=YES
on the Doxyfile.