How to provide documentation shows alternative code # ifdef'd

I am developing a cross-platform library. Some pieces of code are platform dependent, so I have to separate them using #ifdef, checking the type of platform. I broke one class into two classes, each for its own platform. These classes have different names, but finally, I need to typedefuse these classes for the same type according to the platform:

#ifdef UNIX
/** some comment */
typedef Key_unix Key;
#elif WIN
/** another comment */
typedef Key_win Key;
#endif

The generated documentation shows only the first typedefwith both comments. How can I show both typedeftogether, each with its own comment?

+3
source share
1 answer

, , doxygen , #ifdefs. , PREDEFINED.

# The PREDEFINED tag can be used to specify one or more macro names that 
# are defined before the preprocessor is started (similar to the -D option of 
# gcc). The argument of the tag is a list of macros of the form: name 
# or name=definition (no spaces). If the definition and the = are 
# omitted =1 is assumed. To prevent a macro definition from being 
# undefined via #undef or recursively expanded use the := operator 
# instead of the = operator.

, #elif, PREDEFINED = UNIX WIN, #ifdef. :

#ifdef UNIX
/** some comment */
typedef Key_unix Key;
#endif
#ifdef WIN
/** another comment */
typedef Key_win Key;
#endif

UNIX WIN, .

+8

All Articles