如何用xygen记录同名的枚举值
How to document enumeration values with same name with Doxygen?
我试图用氧记录两个包含一些相似值的类枚举。但是这会为每个具有相同名称的字段生成重复的文本。
下面是我的两个枚举:
/*!
* enum OperandType
* brief A type of operand. Represents the location of the operand.
*/
enum class OperandType : unsigned int {
IMMEDIATE, /**< An immediate operand */
REGISTER, /**< An operand in a register */
STACK, /**< An operand on the stack */
GLOBAL /**< A global operand */
};
/*!
* enum PositionType
* brief A type of position for a variable
*/
enum class PositionType : unsigned int {
STACK, /**< A variable on the stack */
PARAMETER, /**< A parameter */
GLOBAL, /**< A global variable */
CONST /**< A const variable.*/
};
每个枚举的STACK成员的描述是两个描述的串联,对于GLOBAL也有同样的问题。
STACK的描述为:
堆栈上的变量
堆栈上的操作数
是否有一种方法来具体记录每一个?
解决方法是把它放在一个命名空间中,然后用using
把它带出来。
/*!
* enum class
*/
namespace enum_class {
/*!
* enum OperandType
* brief A type of operand. Represents the location of the operand.
* Ok
*/
enum class OperandType : unsigned int {
IMMEDIATE, /**< An immediate operand */
REGISTER, /**< An operand in a register */
STACK, /**< An operand on the stack */
GLOBAL /**< A global operand */
};
}
using enum_class::OperandType;
/*!
* enum PositionType
* brief A type of position for a variable
*/
enum class PositionType : unsigned int {
STACK, /**< A variable on the stack */
PARAMETER, /**< A parameter */
GLOBAL, /**< A global variable */
CONST /**< A const variable.*/
};
如果不喜欢分隔,可以将PositionType
放在单独的命名空间(enumeration
)中。
相关文章:
- 不带大括号的枚举形式
- 枚举环境变量的惯用C++14/C++17方法
- 类似枚举的计算常量
- 如何正确实现和访问运算符的各种自定义枚举器
- 错误:从"int"到枚举c++的转换无效
- C++中构造函数中的枚举
- 访问在 C++ 结构中声明的枚举变量
- 枚举类'classname'的多重定义
- 强枚举类型定义:Clang Bug 还是 C++11 标准不确定性?
- typedef 枚举和枚举类有什么区别?
- 为什么我的开关/机箱在使用枚举时默认?
- 标准::可选枚举的比较运算符
- C++两个源文件之间共享的枚举的静态实例
- 打印没有铸件的枚举可以在C++中吗?
- 枚举成员与静态 int 成员?
- C++:枚举:错误:应使用标识符而不是"}"
- 带有 c++ 的枚举(输入检查)
- 在 qml 中使用 Q_ENUM 和 Q_PROPERTY 作为枚举类
- 我如何用doxygen记录一个富特枚举
- 如何用xygen记录同名的枚举值