使用Doxygen在C++中记录宏函数

rcv*_*rcv 19 c++ macros doxygen

如何使用Doxygen在C++中记录宏函数,并在我的非Evil代码的文档中引用它?

更具体地说,我在Message.H中定义了一些名为"Message"的常规类,用户可以继承它来定义自己的消息.在另一个文件("MessageHelpers.H")中,我有一个像这样的疯狂宏:

//! Users must call this macro to register their messages...
/*! 
   ...lest they be forced to type all sorts of boring and 
   error-prone boiler plate code. 
   blah blah blah... More specific documentation and explanation...
*/
#define REGISTER_MESSAGE_TYPE(MSGTYPE) \
 do_some(MSGTYPE);                     \
 seriously();                          \
 crazy_stuff(MSGTYPE);                       
Run Code Online (Sandbox Code Playgroud)

在Message的文档中,如果短语"REGISTER_MESSAGE_TYPE"可以自动成为链接并指向我的宏文档,我会很高兴.例如

//! A cool message class
/*! 
   Users can inherit from this class to create their own cool messages.
   Just be sure to call REGISTER_MESSAGE_TYPE after your class definition!
*/
class Message
{
  virtual void doSomeStuff();
};
Run Code Online (Sandbox Code Playgroud)

这可能吗?

Gue*_*ero 15

http://www.doxygen.nl/manual/index.html

部分"特殊命令"列出的\def命令,以及部分"自动链接生成"描述你要链接到宏观的东西.

用于记录\def与文档分开的宏.使用#MACRO(params)自动链接到所述宏定义.

  • 使用Doxygen GUI前端,如果我转到"专家"选项卡,"预处理器"主题,并取消选中ENABLE_PREPROCESSING,它将停止记录样本......但后来我得到"警告:显式链接请求'ABS(x)'无法在输出中解决.对不起,我无法提供更多帮助. (3认同)