我正在尝试使用Doxygen来记录某些控制选项的宏符号的功能,例如:
//! \def BOOST_SOMEFEATURE
/*! \brief Option macro that is not normally defined
* but can optionally be defined by consumers to activate the option.
*/
但是这不会被编入索引,注释将被忽略,因为宏没有被定义。
当有#define
之类的
#define BOOST_SOMEFEATURE
在标题和其他文件中。
除了像
这样讨厌的软糖之外,我可以强制使用宏符号的文档吗? #undef BOOST_SOMEFEATURE
或者可能包含一个虚拟的.cpp文件,其中包含用于控制选项的所有宏符号的#define
个?
#define BOOST_SOMEFEATURE
#define BOOST_SOMEOTHERFEATURE
...
答案 0 :(得分:2)
执行以下操作:
将以下行添加到Doxyfile:
PREDEFINED = _DOXYGEN_
将您的#define
宏放入#ifdef _DOXYGEN_
部分:
#ifdef _DOXYGEN_
/*!
* Documentation describing the BOOST_SOMEFEATURE macro.
*/
#define BOOST_SOMEFEATURE
/*!
* Documentation describing the BOOST_SOMEOTHERFEATURE macro.
*/
#define BOOST_SOMEOTHERFEATURE
#endif
使用此方法,在正常构建期间预处理器不会看到您的宏,但Doxygen会看到它。
您可以将此部分放在您喜欢的代码中的任何位置:.cpp文件,.h文件,或者如果您愿意,可以创建一个虚拟的.cpp文件。
另见