Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display constant variables or macros in documentation

Tags:

c

doxygen

Is it possible to use the value of a constant variable or a macro in the doxygen documentation?

I have the following lines in the source file

#define RD_IDN 0x01
#define RD_TEMP 0x02
// etc

and I'd like to use these values somewhere else in the documentation like this:

/* If the received command code is 0x01, the device will return it's unique ID. */
like image 433
Michael Haar Avatar asked Oct 20 '25 17:10

Michael Haar


1 Answers

I think it is not possible to do it. The features of the doxygen's built-in C-preprocessor are described in the documentation, and there is nothing about replacement of macros in the comments.

As alternative, you may try something like

//! Your RD_IDN description
#define RD_IDN 0x01
#define RD_TEMP 0x02

and then

/*! If the received command code is #RD_IDN, the device will return it's unique ID. */

Doxygen will add a link to the macro, with Your RD_IDN description shown ad hint when you hover the mouse. To see the value, you still have to click on it. Note that you must keep ENABLE_PREPROCESSING set to the default value YES on you Doxyfile.

like image 169
Giovanni Cerretani Avatar answered Oct 23 '25 08:10

Giovanni Cerretani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!