Doxygen - 展开宏但忽略#if?
是否可以告诉 Doxygen 扩展宏但忽略其他预处理器指令?
考虑以下因素:
#if defined(linux)
#define OS_LINUX
int function() { /* ... */ }
// Other functions defined for Linux
#elif defined(__WIN32__)
#define OS_WINDOWS
int function() { /* ... */ }
// Other functions defined for Windows
#else
#error "OS unsupported."
#endif
在这种情况下,我希望 Windows 和 Linux 的函数都显示出来,但我也希望宏 OS_LINUX 和 OS_WINDOWS 也显示在文档中。有没有办法在忽略 #if
的同时记录这两个宏?
Is it possible to tell Doxygen to expand macros but ignore other preprocessor directives?
Take the following into account:
#if defined(linux)
#define OS_LINUX
int function() { /* ... */ }
// Other functions defined for Linux
#elif defined(__WIN32__)
#define OS_WINDOWS
int function() { /* ... */ }
// Other functions defined for Windows
#else
#error "OS unsupported."
#endif
In this case, I want the functions for both Windows and Linux to show up, but I also want the macros OS_LINUX and OS_WINDOWS to show up in the documentation as well. Is there a way to document both macros while ignoring the #if
s?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,您不能这样做,您必须单独为每个配置构建文档。但是,如果 Windows 和 Linux 都定义了相同的接口,那么无论如何,这两个函数的文档肯定是相同的?
默认情况下,如果 Doxygen 在标头中找到声明的文档以及源文件中相应定义的文档,则将使用标头中的文档。在这种情况下,您可以通过仅将 Doxygen 标记放置在头文件中来利用这一点。通常,这些接口在跨平台上是相同的,并且您将有一个标头,但每个平台都有多个实现,可以在单独的源中或使用条件编译。
No, you cannot do that you will have to build the documentation for each configuration separately. However if both Windows and Linux have the same interfaces defined, the documentation will surely be the same for both functions in any case?
By default if Doxygen finds documentation for a declaration in a header and documentation for corresponding definitions in source-files, the documentation in the header will be used. In this case you can use this to your advantage by only placing Doxygen mark-up in the header files. Normally the interfaces will be identical cross-platform and you will have a single header, but multiple implementations for each platform, either in separate sources or using conditional compilation.