'Documenting constants with Doxygen in C
I have various groups of constants in a C .h file that I'd like to document with Doxygen.
Example: axis, direction, possible values.
#define TYPE_LAT 0x01
#define TYPE_LONG 0x02
#define NORTH 0x01
#define SOUTH 0x02
#define EAST 0x01
#define WEST 0x02
#define TROPIC_OF_CANCER 23.5
#define EQUATOR 0
#define PRIME_MERIDIAN 0
#define SYD_LAT_DIR SOUTH
#define SYD_LNG_DIR EAST
#define SYD_LAT_VAL 151.21
#define SYD_LNG_VAL 33.9
These would be arguments for parameters in a function like:
void SetOneDimension(int axis, int direction, float value);
and for Sydney I'd do:
SetOneDimension(TYPE_LAT, SYD_LAT_DIR, SYD_LAT_VAL);
SetOneDimension(TYPE_LNG, SYD_LNG_DIR, SYD_LNG_VAL);
Ideally in the documentation I'd like to categorise the constants where I show them as sub-sections to their appropriate "parents," like this:
Dimension types:
#define TYPE_LAT 0x01
Directions:
#define NORTH 0x01
#define SOUTH 0x02
#define SYD_LAT_DIR SOUTH
Key Values:
#define EQUATOR 0
#define TROPIC_OF_CANCER 23.5
#define SYD_LAT_VAL 151.21
#define TYPE_LAT 0x02
Directions:
#define EAST 0x01
#define WEST 0x02
#define SYD_LNG_DIR EAST
Key Values:
#define PRIME_MERIDIAN 0
#define SYD_LNG_VAL 33.9
with a relevant comment for each. This allows a quick sighting for valid sets / combinations of parameters. The example above is simple - I would actually have functions with multiple commands, sub-commands and possible values.
Doxygen member groups would be great but I don't think they allow sub-groups like I am after. There is the possibility of using module groups but I htink these go beyond what I'm after here.
Do you have any suggestions on how to document these with Doxygen?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
