aantron / better-enums

C++ compile-time enum to string, iteration, in a single header file
http://aantron.github.io/better-enums
BSD 2-Clause "Simplified" License
1.65k stars 172 forks source link

Trying to figure out how to document a BETTER_ENUM in doxygen #60

Closed gunslingerfry closed 5 years ago

gunslingerfry commented 6 years ago

I want to use this library but it is important that the enums are documentable.

I can document the macro invocation, and even fake parameter values

BETTER_ENUM(A, uint8_t,
  Thing1,
  Thing2
); ///< \brief Comment about enum
///< \param Thing1 the first thing

but these are not searchable.

I've tried to document the class that is generated under the hood

///\class A
///\enum A::_enumerated
///\var A::_enumerated A::Thing1 the first thing

but doxygen, expanding macros, cannot find either the class or the enum.

Any suggestions on how to proceed or am I SOL?

aantron commented 6 years ago

I don't see how to make it fully work either. I would have expected Doxygen to be able to find the class when expanding macros.

If you find a way to fix/work around this, please post here, and I'll add it to the Better Enums documentation.

JarvisWhitman commented 2 years ago

I have the same issue; Strict corporate coding standards.

The best workaround I've found, which is admittedly ugly, is to #define it and document it as a class. Example:

/**
 * @class enum_Trick
 * @param Card A card trick
 * @param Hat A hat trick
 */
#define enum_Trick BETTER_ENUM
enum_Trick( Trick, int,
    Card,
    Hat
);

The drawbacks:

I'm not sure there can BE a solution without defining some construct within Doxygen (project configuration?) to look for.

A shame - I really like BETTER_ENUM.