2

I am trying to document an enum class values out of line in the *.cpp file:

Consider:

class SomeClass
{
    enum class MyEnum
    {
        val1
    };
};

and out-of-line Doxygen documentation in the *.cpp file:

/*!
 * \class SomeClass
 * ...
 *\

/*!
 * \enum SomeClass:MyEnum
 * This works fine.
 */

/*!
 * \var SomeClass::MyEnum::val1
 * And this does not...
 */

The third comment section fails with this message:

warning: no matching class member found for SomeClass::MyEnum::val1

I have tried many variations suggested in other similar questions and answers but to no avail. I can either make the enum class a regular enum or put the documentation inline to the header. Any other options?

1 Answer 1

1

Try following:

class SomeClass
{
    enum class MyEnum
    {
        val1
    };
};

and in the cpp file:

/*!
 * \class SomeClass
 * ...
 */

/*!
 * \enum SomeClass:MyEnum
 * This works fine.
 */

/*!
 * \var SomeClass::val1
 * And this works now, too...
 */

Note that I removed the tag name of the enumeration.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks, I mention that option in OP. It works with regular enums but not with enum class. Anyway, I have abandoned Doxygen and moved to QDoc as I use Qt primarily.
Oh, I tried exactly the code I posted, and it worked for me even with enum class.
Interesting, you are right. That is not very intuitive and will not work for multiple enum classes with the same values but it is the answer for current Doxygen.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.