I'm using the C preprocessor to generate elements in an enum. Is there a way to write doxygen comments for the generated elements? I can't just run it through the preprocessor before doxygen since that will strip the doxygen comments.
Example:
#define ATTRIBUTES \
X(TITLE, "title") \
X(FILENAME, "filename") \
X(GENRE_ID, "genre_id")
enum ATTRIBUTES_ENUM {
#define X(a, b) a##_ATTRIBUTE,
ATTRIBUTES
#undef X
ATTRIBUTES_COUNT
};
And adding something like:
/**
* \def TITLE_ATTRIBUTE
* The media's title.
*/
doesn't work.
EDIT Thanks to Thomas Matthews, here's the solution I used:
#define ATTRIBUTES \
X(TITLE, "title") /*!< title attribute */ \
X(FILENAME, "filename") /*!< filename attribute */ \
X(GENRE_ID, "genre_id") /*!< genre id attribute */
#define X(a, b) a##_ATTRIBUTE,
enum ATTRIBUTES_ENUM {
ATTRIBUTES
ATTRIBUTES_COUNT
};
#undef X
And tell Doxygen to expand macros. The only downside is that the comment for the last element is also used as the comment for the ATTRIBUTES define. But that's a minor issue in my case.