Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to get doxygen to show enum numerical values without changing css?

Tags:

I want to get the real value of the enum member in the doxygen output. For instance I have:

///MyEnum typedef enum My_Enum { MY_ENUM_0,///<MY_ENUM_0 MY_ENUM_1,///<MY_ENUM_1 MY_ENUM_2 ///<MY_ENUM_2 } My_Enum; 

The output is:

MyEnum. Enumerator: MY_ENUM_0       MY_ENUM_0. MY_ENUM_1       MY_ENUM_1. MY_ENUM_2       MY_ENUM_2. 

What I want is:

Enumerator: MY_ENUM_0           0 MY_ENUM_0. MY_ENUM_1           1 MY_ENUM_1. MY_ENUM_2           2 MY_ENUM_2. 

Or something similar.

like image 235
noti Avatar asked Dec 18 '12 09:12

noti


1 Answers

There isn't a way to do this directly from doxygen that I can think of. Doxygen is not a C compiler. So it will not derive the value of an enum which is a compile-time constant.

The closest thing doxygen can do is selectively expand your macros since it does have a C preprocesor. So if you have some value assigned to a constant that is derived by preprocessor expansion, doxygen can expand the macros and show you what will be assigned.

Building on TheCodeArtist's answer, you might consider writing script that runs prior to doxygen, makes copies of your files, searches for this pattern:

enum *** {     ***, ///< %VAL%: 

and replaces each occurrence of %VAL% with what the value should be so you aren't manually keeping up with the numbers. After doxygen runs the original files which contain the %VAL% tokens would need to be replaced. That's not a particularly elegant or robust solution.

like image 195
Nick Avatar answered Sep 26 '22 16:09

Nick