From ProjectApollo
Jump to: navigation, search

Doxygen is an automated method of documenting code... you add a few special comments to the header files and then run the Doxygen program, which spews out about 50MB of HTML files which document the code in a web browser.


You can download the software from:

To generate the diagrams you'll also need GraphViz from:

And the Microsoft Help Workshop to build the help file from the HTML files:


There's a sample config file in the source directory 'Doxyfile': run the Doygen Wizard program, open the config file and press 'Start' to process the source. There's also another version which produces a cut-down file, 'MiniDoxyFile': that skips the diagrams and doesn't include the source in the files.

Documenting Code

Basically, if you add a new function int DoStuff(x, y) you should put a comment before its definition in the header file like:

/// This is what the function does in detail.
/// \ingroup GroupName
/// \brief This is a brief description.
/// \param x This is what parameter x does.
/// \param y This is what parameter y does.
/// \return This is what it returns.
int DoStuff(x, y);

Note the use of three slashes rather than two: Doxygen only processes comments with the extra slash. Obviously if there are no parameters and no return value then you can skip that, and for variables you typically only need the brief description.

Groups are defined in nassdefs.h, and you could add new ones if you think those aren't appropriate. Look at les.h for examples if the above doesn't make sense. Also note that if you document a virtual function in a base class then that documentation is also applied to any derived classes, so you don't need to document the functions in derived classes unless they do something different.