Tuesday, May 17, 2011

Documentation using Doxygen

Doxygen is a great tool to document the code in a neat style in most of the desired formats like html, chm, pdf, latex and also rtf!  Most of the customization of the doxygen output is possible through the options in configuration file of doxygen, generally called Doxyfile, unless named something else while generation.
All the commands that Doxygen understands are documented here.
Below is a list of some options that I found useful for the documentation of my code, extracted from the above link only:

1. To undcoument sections of code from the doxygen output:

#ifndef DOXY_DOC_SKIP
code-segment-to-skip-from-documentation
#endif

 Define this in the configuration file of Doxygen, which is Doxyfile if no name has been provided while generation of the initial configuration.           
PREDEFINED = DOXY_DOC_SKIP

2. To undocument/document some section from the doxygen comments:
/**
doxygen-captured comments
\if WANTED_ENABLED
doxygen uncaptured comments
\endif
*/

This will disable the documentation of the block in the \if &\endif construct, if at any later stage you want in the documentation, Put the flag in configuration file at the
ENABLED_SECTION = WANTED_ENABLED
This would enable in the documentation.

3. To have numbered documentation:
/**
* -# Numbered list
*    -# sublist
**/

4. To enable the documentation of the static functions in C, edit the configuration file in
EXTRACT_STATIC = YES

5. To enable the hyperlinks in pdf generated by doxygen and have the Table of Contents in the pdf document
PDF_HYPERLINKS         = YES
SHOW_DIRECTORIES       = YES

6. To capture tables and ascii charts/images put in the comment block as it is in the doxygen generated documentation, enclose the section in the \verbatim construct. For instance,
/**
  * - This is just to show the use of verbatim
  *\verbatim
 ________________________
|  S.NO.      | Command  |
|========================|
|     1.      |  printf  |
|     2.      |  scanf   |
| _______________________|
   \endverbatim
**/

No comments:

Post a Comment