Documenting enum values with doxygen

Corey Richardson picture Corey Richardson · Dec 6, 2012 · Viewed 54.7k times · Source

Given:

namespace Foo {
    class Foo {
    public:
        /// Foo enum, possible ways to foo
        enum class Foo {
            /// Foo it with an A
            A,
            /// Foo it with a B
            B,
            /// Foo it with a C
            C
        }
    }
}

And the default Doxyfile made with doxygen -g, I get this:

generated documentation

How can I get the enum values documented? I tried putting the comment before/after the member, using ///<, etc, to no avail. Might this just be a bug in doxygen? The examples in the docs work. (Clicking on the name of the enum doesn't bring me anywhere)

Answer

Masked Man picture Masked Man · Dec 7, 2012

With Doxygen 1.8.2, both the following work for me:

Using ///

/// This is an enum class
enum class fooenum {
    FOO, ///< this is foo
    BAR, ///< this is bar
};

Using /*! ... */

/*! This is an enum class */
enum class fooenum {
    FOO, /*!< this is foo */
    BAR, /*!< this is bar */
};

Brief Description Detailed Description

The doxygen changelog says that enum class is supported in Doxygen 1.8.2, so I suspect there may be some minor syntax issue in your commands. Could you please compare your commands with the above two snippets?

New features

Added support for C++11:

strongly typed enums, e.g.:
enum class E