枚举 class 的 Doxygen 文档在单独的 header 中
Doxygen documentation for enum class in a seperate header
我试图为枚举 class 添加文档,它位于自己的 header 文件中。以下是我到目前为止所做的
/**
@file
*/
namespace foo {
/**
@brief blablabla
*/
enum class MyEnum{
/**
This is ENUM_A
*/
ENUM_A,
/**
This is ENUM_B
*/
ENUM_B,
/**
This is ENUM_C
*/
ENUM_C
};
}
出于某种原因,生成的文档在列表中显示了这 3 个枚举成员,但是当我单击它们时,它不会生成具有它们自己的描述的页面。然而,当我将此枚举 class 放入另一个 class 时,这就起作用了。
任何人都可以帮助我发现我丢失的东西吗?谢谢
To document a member of a C++ class, you must also document the class
itself. The same holds for namespaces. To document a global C
function, typedef, enum or preprocessor definition you must first
document the file that contains it (usually this will be a header
file, because that file contains the information that is exported to
other source files).
因此,如果您记录 foo
命名空间,一切正常:
/**
@brief Namespace foo
*/
namespace foo {
/**
@brief My enum
*/
enum class MyEnum{
/**
This is ENUM_A
*/
ENUM_A,
/**
This is ENUM_B
*/
ENUM_B,
/**
This is ENUM_C
*/
ENUM_C
};
}
首先单击命名空间,然后 foo
然后您的枚举文档就可用了。
更新
正如@albert 指出的那样,还有另一种方法。根据 Doxygen documentation,
If the EXTRACT_ALL
tag is set to YES
doxygen will assume all
entities in documentation are documented, even if no documentation was
available. Private class members and static file members will be
hidden unless the EXTRACT_PRIVATE
and EXTRACT_STATIC
tags are set
to YES
如果您的代码库中有很多这样的场景,这是一个不错的选择。
我试图为枚举 class 添加文档,它位于自己的 header 文件中。以下是我到目前为止所做的
/**
@file
*/
namespace foo {
/**
@brief blablabla
*/
enum class MyEnum{
/**
This is ENUM_A
*/
ENUM_A,
/**
This is ENUM_B
*/
ENUM_B,
/**
This is ENUM_C
*/
ENUM_C
};
}
出于某种原因,生成的文档在列表中显示了这 3 个枚举成员,但是当我单击它们时,它不会生成具有它们自己的描述的页面。然而,当我将此枚举 class 放入另一个 class 时,这就起作用了。 任何人都可以帮助我发现我丢失的东西吗?谢谢
To document a member of a C++ class, you must also document the class itself. The same holds for namespaces. To document a global C function, typedef, enum or preprocessor definition you must first document the file that contains it (usually this will be a header file, because that file contains the information that is exported to other source files).
因此,如果您记录 foo
命名空间,一切正常:
/**
@brief Namespace foo
*/
namespace foo {
/**
@brief My enum
*/
enum class MyEnum{
/**
This is ENUM_A
*/
ENUM_A,
/**
This is ENUM_B
*/
ENUM_B,
/**
This is ENUM_C
*/
ENUM_C
};
}
首先单击命名空间,然后 foo
然后您的枚举文档就可用了。
更新
正如@albert 指出的那样,还有另一种方法。根据 Doxygen documentation,
If the
EXTRACT_ALL
tag is set toYES
doxygen will assume all entities in documentation are documented, even if no documentation was available. Private class members and static file members will be hidden unless theEXTRACT_PRIVATE
andEXTRACT_STATIC
tags are set toYES
如果您的代码库中有很多这样的场景,这是一个不错的选择。