gpt4 book ai didi

c++ - 如何使用 Doxygen 记录具有相同名称的枚举值?

转载 作者:可可西里 更新时间:2023-11-01 17:58:53 25 4
gpt4 key购买 nike

我正在尝试用 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 存在相同的问题。

堆栈的描述是:

A variable on the stack

An operand on the stack

有没有办法专门记录它们中的每一个?

最佳答案

解决方法是将它放在命名空间中,然后使用 将其取出。

/*!
* 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++ - 如何使用 Doxygen 记录具有相同名称的枚举值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8334081/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com