Doxygen是否可以从生成的XML中排除未记录的功能? [英] Is it possible for Doxygen to exclude undocumented functions from generated XML?

查看:72
本文介绍了Doxygen是否可以从生成的XML中排除未记录的功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想为具有Doxygen注释的代码生成文档。我已经通过Doxygen版本1.8.9.1创建了 Doxyfile 并将其配置为仅输出XML并隐藏所有未记录的代码:

I want to generate documentation only for code that has Doxygen comments. I have created a Doxyfile via Doxygen version 1.8.9.1 and configured it to output only XML and to hide all undocumented code:

GENERATE_HTML          = NO
GENERATE_LATEX         = NO
GENERATE_XML           = YES
HIDE_UNDOC_MEMBERS     = YES
HIDE_UNDOC_CLASSES     = YES

之后,我创建了一个简单的C标头 test.h ,其中有一个文档记录了一个未记录的函数声明:

After that I created a simple C header test.h with one documented and one non-documented function declaration:

void foo(int a);

/**
 * "bar" function description
 * @param b sample param
 */
void bar(int b);

通过执行 doxygen ,我只希望获得有关 bar 包含在生成的XML中。不幸的是,这两个功能的文档都已生成。是否可以仅为具有Doxygen注释的代码生成文档?还是Doxygen会始终将XML输出中的所有内容与设置无关?

By executing doxygen I expected only documentation for bar to be included in the resulting XML. Unfortunately, documentation for both functions is generated. Is it possible to generate documentation only for code that has Doxygen comments? Or will Doxygen always include everything in the XML output regardless of settings?

推荐答案

在进一步阅读之前,请确保 EXTRACT_ALL 设置为 NO

Before reading any further make sure EXTRACT_ALL is set to NO.

我不喜欢以下解决方案,但确实有效。使用doxygen的预处理器

I'm not a fan of the following solution but it does work. Use doxygen's preprocessor

#ifdef PROJECT_NO_DOC
void foo(int a); 
#endif /* PROJECT_NO_DOC */

/**
 *  * "bar" function description
 *   * @param b sample param
 *    */
void bar(int b); 

注意,在他们的文档中,您必须设置PREDEFINED宏,但至少在我的doxygen版本中不需要。他们的文档指定以此方式在配置中设置预定义的宏来为您完成此操作

Note, in their docs you have to set a PREDEFINED macro but at least in my version of doxygen this was not required. Their docs specify to do it this way set a predefined macro in the config to do it for you

#ifndef DOXYGEN_SHOULD_SKIP_THIS

 /* code that must be skipped by Doxygen */

#endif /* DOXYGEN_SHOULD_SKIP_THIS */

隐藏并放置:

PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS

在配置文件中,那么只要

in the config file then all blocks should be skipped by doxygen as long as

ENABLE_PREPROCESSING = YES

还有其他方法,但它们带有其他约束,即确保没有静态方法出现在其中您的公开文档可以将 EXTRACT_STATIC 设置为 NO

There are other methods but they come with additional constraints ie to make sure no static method appear in your public docs you can set EXTRACT_STATIC to NO.

这篇关于Doxygen是否可以从生成的XML中排除未记录的功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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