How to display a specific value

In some doxygen docs, I would like to display the contents of #define , not the tag itself. For example, in the C file, I have

 #define REPEAT_N_TIMES 10 

Now in my documentation I want to display:

The action is performed 10 times.

If I use \ref REPEAT_N_TIMES , it displays:

Action completed REPEAT_N_TIMES times

Is there a way to display the contents of the link, and not the link itself, for example, like \ValueOf(\ref REPEAT_N_TIMES) or \contentOf(\ref REPEAT_N_TIMES) ?

Update: My Doxygen configuration:

 // Configuration options related to the preprocessor ENABLE_PREPROCESSING = YES MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = YES SEARCH_INCLUDES = YES INCLUDE_PATH = INCLUDE_FILE_PATTERNS = PREDEFINED = WXUNUSED()= EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES 

The MACRO_EXPANSION parameter seems to change the "details" of the macros. But I see no way to select either the macro name or its contents. Using the \ref command seems wrong: it means "something", not the content of "something"

Is it possible to use an operator or function, possibly similar to C , where I can use something like \ref *something instead of \ref something ?

+4
source share
1 answer

It looks like the doxygen pre-processing manual page has all the necessary information. As a first step, try setting the MACRO_EXPANSION flag in the doxygen configuration file to YES , then in your MACRO_EXPANSION documentation

 The action is done REPEAT_N_TIMES times. 

As noted in the doxygen manual, this will expand all macro definitions (recursively, if necessary), which is often too much. Therefore, you can specify exactly which macros to expand using the EXPAND_ONLY_PREDEF and EXPAND_AS_DEFINED in the configuration file. For example, try installing

EXPAND_ONLY_PREDEF = YES
EXPAND_AS_DEFINED = REPEAT_N_TIMES

in the configuration file.

UPDATE: After @spamy comment, I studied this a bit more, and it seems that the methods I mentioned above do not work for macros in comment blocks, i.e. only macros in the source code are expanded. See, for example, this post on the doxygen sourceforge page. According to this post, the only way to achieve macro expansion inside comment blocks is to use the INPUT_FILTER configuration file INPUT_FILTER . Use something like

 INPUT_FILTER = sed /REPEAT_N_TIMES/10 

Warning: the above INPUT_FILTER not been tested.

If you do not want to use INPUT_FILTER then this answer for another INPUT_FILTER probably your best bet. In essence, this suggests that you can document the macro so that documentation readers can easily find real value. So add the documentation to your #define and just \ref elsewhere in your documentation.

0
source

All Articles