如何让宏由doxygen的扩大,但没有记录作为界定? [英] How to have macros expanded by doxygen, but not documented as a define?

查看:328
本文介绍了如何让宏由doxygen的扩大,但没有记录作为界定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我有:

#define MY_MACRO(FOO) void FOO();

MY_MACRO(hi);
MY_MACRO(hey);
MY_MACRO(hello);

#undef MY_MACRO

我想宏被doxygen的扩展,这我能够通过配置它的正确的方式来做到:

I want the macros to be expanded by doxygen, which I am able to do by configuring it the right way:

ENABLE_PREPROCESSING   = YES
MACRO_EXPANSION        = YES
EXPAND_ONLY_PREDEF     = YES
EXPAND_AS_DEFINED      = MY_MACRO

这让我看到了宏的展开结果作为doxygen的输出记录的API(函数你好)。这是所有好为止。但问题是,doxygen的文件也 MY_MACRO 作为一个定义。不过,我不希望API的客户了解 MY_MACRO ,因为它是undefed,而不是由他们使用,并且不应该对他们是可见的。

This enables me to see the expanded result of the macros as documented APIs in the doxygen output (functions hi, hey, and hello). That is all good so far. But the problem is that, doxygen also documents MY_MACRO as a define. However, I do not want the clients of the API to know about MY_MACRO, since it is undefed and is not usable by them, and should not be visible to them.

EXTRACT_ALL = YES 在我的doxygen配置,我不想改变这种状况。我曾尝试以下配置没有成功:

I have EXTRACT_ALL = YES in my doxygen configuration and I do not want to change that. I have tried the following configuration without success:

PREDEFINED      = DOXYGEN_SKIP_FOR_USERS

通过以​​下code:

With the following code:

#ifndef DOXYGEN_SKIP_FOR_USERS
#define MY_MACRO(FOO) void FOO();
#endif /*DOXYGEN_SKIP_FOR_USERS*/

MY_MACRO(hi);
MY_MACRO(hey);
MY_MACRO(hello);

#undef MY_MACRO

这隐藏的定义文件,当然prevents扩张,所以我没有得到生成的API中记录的功能。

This hides the documentation of the define, but of course prevents the expansion, so I do not get the functions documented in the generated API.

我想AP preciate你的帮助。

I would appreciate your help.

推荐答案

假设 MY _ 是你在你的code。使用一贯的preFIX :)我会使用preFIX MY __ (两个下划线)内部宏,然后把类似

Supposing that MY_ is the prefix that you are using consistently in your code :) I would use the prefix MY__ (two underscores) for internal macros and then put something like

EXCLUDE_SYMBOLS        = MY__*

Doxygen的配置文件中的

编辑:双下划线符号,里面保留了C ++(不是C)。所以,如果你想用C和C ++兼容,你应该选择一些其他类型的公约。不幸的是,下划线被保留,也因此 _My _ 不会做也没有。

the double underscore inside symbols is reserved for C++ (not for C). So if you want to be compatible with C and C++ you should choose some other type of convention. Unfortunately a leading underscore is reserved, too, so _MY_ wouldn't do neither.

这篇关于如何让宏由doxygen的扩大,但没有记录作为界定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆