Как документировать значения перечисления с таким же именем с помощью Doxygen? - PullRequest
8 голосов
/ 01 декабря 2011

Я пытаюсь задокументировать два перечисления классов, содержащих некоторые похожие значения, с помощью 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:

Переменная в стеке

Операнд в стеке

Есть ли способ документировать каждый из них конкретно?

1 Ответ

2 голосов
/ 01 декабря 2011

Обходной путь - поместить его в пространство имен и 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), если вам не нравитсяразделение.

...