1

So I have a #define that creates a "MY_ENUM" (minimal version)

#define MY_ENUM(ename, ...)              \                                                
  namespace ename {                      \
    enum ename { __VA_ARGS__, COUNT };   \
    static std::string _Strings[COUNT];  \
    static inline size_t size() {return COUNT;}  \ 
}

This generates useful enums that can be created as:

/**
  * @brief List of elements
  */
MY_ENUM(enuElements, Element1, Element2, Element3, Element4, Element5, Element6)

But generating the doc with doxygen doesn't seem to work => it mixes one enum with the following and some don't even appear.

I set:

MACRO_EXPANSION        = YES
SKIP_FUNCTION_MACROS   = NO
PREDEFINED             = MY_ENUM(x) = 

For what I have read, the answer is a proper setting of PREDEFINED but I haven't achieved, does anyone know how to create a document with this kind of defines?

Edit

Doxygen Version : 1.8.0

About why I think the clue is in PREDEFINED (but I might as well be wrong):

Ivan
  • 1,352
  • 2
  • 13
  • 31
  • Which version of doxygen are you using? Setting `PREDEFINED = MY_ENUM(x) =` in your settings file is a bit strange when you want to have the real setting, where did you read about the: "the answer is a proper setting of PREDEFINED"? Please can you expand your code samples to a complete example so we can do some testing. – albert Apr 16 '21 at 13:55
  • Editing right now ... :) – Ivan Apr 16 '21 at 14:00
  • @albert I added stuff to the question – Ivan Apr 16 '21 at 14:13
  • Well version 1.8.0 is very old (February 2012) so I definitely advise you to update to a newer version (current version is 1.9.1). With version 1.9.1 I have no problems, just see to it that the \ is the last character on the line! (in the example there are spaces behind it, might be from cut / paste though). I didn't set `PREDEFINED` as this is not necessary. – albert Apr 16 '21 at 14:26
  • Thanks @albert I'll try with a different version, just out of curiosity, did you get a nice printed list? or did Doxygen treated it as a function? – Ivan Apr 16 '21 at 14:30

1 Answers1

1

With the following code:

/// \file

#define MY_ENUM(ename, ...)              \
  namespace ename {                      \
    enum ename { __VA_ARGS__, COUNT };   \
    static std::string _Strings[COUNT];  \
    static inline size_t size() {return COUNT;}  \
}

/**
  * @brief List of elements
  */
MY_ENUM(enuElements, Element1, Element2, Element3, Element4, Element5, Element6)

The setting (besides the default settings):

MACRO_EXPANSION        = YES

and doxygen 1.9.1 I got:

enter image description here

albert
  • 8,285
  • 3
  • 19
  • 32