gpt4 book ai didi

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

转载 作者:IT老高 更新时间:2023-10-28 21:57:48 26 4
gpt4 key购买 nike

如何使用 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com