doxygen:使用宏定义命名空间时,在CPP文件中使用单独的源和标头目录的类记录类
我正在尝试使用以下文件进行记录库:
include/mylib/mylib_global.h
include/mylib/SomeClass.h
source/SomeClass.cpp
Doxyfile
include/mylib/mylib_global.h:
#pragma once
#define MYLIB_NAMESPACE_BEGIN namespace mylibns {
#define MYLIB_NAMESPACE_END }
include/mylib/someclass.h:
#pragma once
#include "mylib_global.h"
MYLIB_NAMESPACE_BEGIN
class SomeClass
{
public:
SomeClass();
};
MYLIB_NAMESPACE_END
source/someclass.cpp:
#include "mylib/SomeClass.h"
MYLIB_NAMESPACE_BEGIN
/*!
* \class SomeClass
* This is a sample class.
*/
/*!
* This is a constructor.
*/
SomeClass::SomeClass()
{
}
MYLIB_NAMESPACE_END
doxyfile:
PROJECT_NAME = mylib
INPUT = .
RECURSIVE = YES
MACRO_EXPANSION = YES
doxygen会产生以下警告:
Doxygen version used: 1.9.3 (c0b9eafbfb53286ce31e75e2b6c976ee4d345473)
[...]
include/mylib/SomeClass.h:7: warning: Compound mylibns::SomeClass is not documented.
*** Doxygen has finished
如果我执行以下任何操作,它有效:
- 将CPP移至
include/
。但是我不想在那里。 - 将文档移至标题。但是我想简短。
名称空间mylibns {
而不是CPP中的宏。但是我希望名称空间可配置。macro_expansion = no
。但这也将从文档中删除命名空间。- 在doxygen注释中明确说明名称空间:
\ class mylibns :: SomeClass
。但是,这只有助于解决此特定问题(Doxygen也无法解决过载功能)。
没有帮助的事情:
- 为
输入
参数指定更长路径的任何组合。 extract_all = yes
clang_assisted_parsing = yes
我如何正确执行此操作?
I'm trying to document a library with the following files:
include/mylib/mylib_global.h
include/mylib/SomeClass.h
source/SomeClass.cpp
Doxyfile
include/mylib/mylib_global.h:
#pragma once
#define MYLIB_NAMESPACE_BEGIN namespace mylibns {
#define MYLIB_NAMESPACE_END }
include/mylib/SomeClass.h:
#pragma once
#include "mylib_global.h"
MYLIB_NAMESPACE_BEGIN
class SomeClass
{
public:
SomeClass();
};
MYLIB_NAMESPACE_END
source/SomeClass.cpp:
#include "mylib/SomeClass.h"
MYLIB_NAMESPACE_BEGIN
/*!
* \class SomeClass
* This is a sample class.
*/
/*!
* This is a constructor.
*/
SomeClass::SomeClass()
{
}
MYLIB_NAMESPACE_END
Doxyfile:
PROJECT_NAME = mylib
INPUT = .
RECURSIVE = YES
MACRO_EXPANSION = YES
Doxygen produces the following warning:
Doxygen version used: 1.9.3 (c0b9eafbfb53286ce31e75e2b6c976ee4d345473)
[...]
include/mylib/SomeClass.h:7: warning: Compound mylibns::SomeClass is not documented.
*** Doxygen has finished
If I do any of the following, it works:
- Move the cpp to
include/
. But I don't want it there. - Move the documentation to the header. But I'd like to keep it short.
namespace mylibns {
instead of the macro in the cpp. But I want the namespace to be configurable.MACRO_EXPANSION = NO
. But that would also remove the namespace from the documentation.- Explicitly state the namespace in the doxygen comment:
\class mylibns::SomeClass
. However that only helps with this specific issue (doxygen also fails to resolve overloaded functions).
Things that don't help:
- Specifying any combination of longer paths for the
INPUT
parameter. EXTRACT_ALL = YES
CLANG_ASSISTED_PARSING = YES
How do I do this properly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在文件
source/someclass.cpp
中,您有:但是文件
someclass.h
位于include> include/mylib
中,因此您必须告诉Doxygen在哪里可以找到包含文件。这可以通过设置来完成:(类似于您可能为编译器所做的用
-i include
(例如)的设置所做的事情)In the file
source/SomeClass.cpp
you have:but the file
SomeClass.h
is located ininclude/mylib
so you have to tell doxygen where to find the include file. This can be done by means of the setting:(analogous what you probably have done for the compiler with the setting like
-I include
)