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

发布于 2024-12-19 01:33:22 字数 950 浏览 1 评论 0原文

我正在尝试使用 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的描述是:

栈上的变量

栈上的操作数

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

I'm trying to document two class enumerations containing some similar values with Doxygen. But that generates duplicates text for each field with the same name.

Here are my two enumerations :

/*!
 * \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.*/
};

The description for the STACK member of each enumeration is the concatenation of both descriptions and there is the same problem for GLOBAL.

The description of STACK is :

A variable on the stack

An operand on the stack

Is there a way to document each of them specifically ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猫九 2024-12-26 01:33:22

解决方法是将其放入命名空间中,然后使用 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 放在单独的命名空间(枚举)中。

Workaround is to put it in a namespace and using to bring it out.

/*!
 * 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.*/
};

You can put PositionType in a separate namespace (enumeration) if you don't like the separation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文