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 ?
1. Two enum names can have same value. For example, in the following C program both 'Failed' and 'Freezed' have same value 0.
doxygen Getting started with doxygen Commenting your code//! //! ... text ... //! Note the 2 slashes to end the normal comment block and start a special comment block.
In Ruby on Rails, an enum is an attribute where the values map to integers in the database and can be queried by name. For example, we could define an enum for the status attribute, where the possible values are pending , active , or archived . Ruby on Rails added support for enums in Rails 4.1.
Doxygen (/ˈdɒksidʒən/ DOK-see-jən) is a documentation generator and static analysis tool for software source trees. When used as a documentation generator, Doxygen extracts information from specially-formatted comments within the code.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With