我正在尝试使用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.*/
};
Run Code Online (Sandbox Code Playgroud)
每个枚举的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.*/
};
Run Code Online (Sandbox Code Playgroud)
如果您不喜欢这种分离,可以放入PositionType单独的命名空间 ( )。enumeration