在Doxygen中记录#undef的好方法 [英] Good way to document #undef in doxygen

查看:112
本文介绍了在Doxygen中记录#undef的好方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在c文件中有几个#define,它们关闭了硬件的某些功能以进行测试。但是,当它们也未定义时,我想用doxygen记录它们。

I currently have a couple of #define in c files that turn off some functionality to hardware for testing. However, I want to document them with doxygen when they are undefined as well.

例如:

此可以正常工作:

/// \def SIMULATE_SOME_HW_INTERFACE
/// Define this when you want to simulate HW interface.
#define SIMULATE_SOME_HW_INTERFACE

将#define更改为#undef时,会收到警告在doxygen中显示,而不会在doxygen生成的输出中显示。我要记录此#define定义还是未定义。

When you change the #define to #undef, you get a warning in doxygen, and it doesn't show up in the doxygen generated output. I want to document this #define wether it's defined or undefined.

如何强制doxygen记录#undef ???

How can I force doxygen to document a #undef???

推荐答案

在仅Doxygen包含的头文件中定义它们(将其与主要源文件放在单独的目录树中)。

Define them in a header file that is only included by Doxygen (put in a separate directory tree from the main source).

通过使用仅在Doxygen设置中定义的定义来包装该头文件,例如:

Guard this header file by wrapping it with a define that you only define in the Doxygen setup, eg:

#ifdef ONLY_FOR_DOXYGEN

/// \def SIMULATE_SOME_HW_INTERFACE
/// Define this when you want to simulate HW interface.
#define SIMULATE_SOME_HW_INTERFACE

#endif

还可以有条件地包括轻量级定义,例如MFC基类它们显示为类层次结构的基础,而不必解析所有MFC。

I have used this to also conditionally include lightweight class definitions for things like MFC base classes so they appear as bases for the class hierarchy without having to parse all of MFC.

这篇关于在Doxygen中记录#undef的好方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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