[英]Doxygen: How can I document macros that are not #defined?
我正在嘗試使用Doxygen來記錄一些選項控制宏符號的功能,例如:
//! \def BOOST_SOMEFEATURE
/*! \brief Option macro that is not normally defined
* but can optionally be defined by consumers to activate the option.
*/
但是這不會被編入索引,並且注釋將被忽略,因為宏未定義。
只有#define
類的,才會在文檔中生成Doxygen宏符號條目
#define BOOST_SOMEFEATURE
在標題和其他文件中。
我可以強制宏符號的文檔除了令人討厭的軟糖之外
#undef BOOST_SOMEFEATURE
或者可能包括一個虛擬的.cpp文件,其中包含控制選項的所有宏符號的#define
?
#define BOOST_SOMEFEATURE
#define BOOST_SOMEOTHERFEATURE
...
請執行下列操作:
將以下行添加到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文件。
也可以看看
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.