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

标签 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);                       

在 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();
};

这可能吗?

最佳答案

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

section "Special Commands"列出 \def command ,以及 section "Automatic link generation"描述您要链接到宏的内容。

使用 \def 记录一个独立于声明的宏。
使用 #MACRO(params) 自动链接到所述宏定义。

关于c++ - 使用 Doxygen 在 C++ 中记录宏函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4542626/

相关文章:

c++ - 有没有办法在 C++ 函数中获取函数名?

c++ - 用指针向后重新排序数组

c++ - 使用计算着色器进行纹理贴图

rust - 有没有办法在 Rust 宏中引用局部变量?

c - 使用 Doxygen 记录宏

c++ - 在不同的命名空间中记录一个函数

svn - 将 SVN 日志消息包含到 Doxygen 中

c++ - 无法将二维字符数组初始化为所有空格

C++:LPWSTR 在 cout 中打印为地址

使用 C 预处理器指令检查编译时间