Paperback Writer
Paperback Writer

Reputation: 2125

Is it possible to make Doxygen to expand enum initializers?

For the following input:

enum A  
{  
  A1 = 1,
  A2 = 2  
};  
enum B  
{  
  B1 = A2,  
  B2 = A2 * A2 + 1  
}  

I would like doxygen to expand/resolve initializers of B::B1 and B::B2. I would like to have respectably 2 and 5 in initializers of B1 and B2, rather then A2 and A2 * A2 + 1. Is it possible? If so, how can this be achieved?
Please mind that I am asking only about enum initializers. Those are known at the compile time, so (in theory) doxygen should be able to compute.

EDIT: Removed ; from enum definitions.

Upvotes: 3

Views: 494

Answers (1)

bosnjak
bosnjak

Reputation: 8624

I do not think this is possible, but, for a simple case as you presented, you can fake it by using #define in a way that would work for your code, and still be possible for doxygen to resolve the values.

Your code can look like this:

#define A_1 1
#define A_2 2
#define B_1 A_2
#define B_2 (A_2 * A_2 + 1)

enum A  
{  
  A1 = A_1,
  A2 = A_2
};

enum B  
{  
  B1 = B_1,
  B2 = B_2
};

And in the doxygen configuration you need to enable ENABLE_PREPROCESSING and MACRO_EXPANSION.

Upvotes: 1

Related Questions