Doxygen: Difference between revisions

From Project Apollo - NASSP
Jump to navigation Jump to search
imported>Mark Grant
(Start)
 
imported>Mark Grant
m (→‎Installation: - some grammar improvement)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
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.
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.
==Installation==


You can download the software from:
You can download the software from:
Line 5: Line 7:
http://www.stack.nl/~dimitri/doxygen/
http://www.stack.nl/~dimitri/doxygen/


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


http://www.graphviz.org/
http://www.graphviz.org/


To generate the diagrams. And the Microsoft Help Workshop to build the help file from the HTML files:
And the Microsoft Help Workshop to build the help file from the HTML files:


http://www.microsoft.com/downloads/details.aspx?FamilyID=00535334-c8a6-452f-9aa0-d597d16580cc&DisplayLang=en
http://www.microsoft.com/downloads/details.aspx?FamilyID=00535334-c8a6-452f-9aa0-d597d16580cc&DisplayLang=en
==Use==


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.
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:
<code>
///<BR>
/// This is what the function does in detail.<BR>
///<BR>
/// \ingroup GroupName<BR>
/// \brief This is a brief description.<BR>
/// \param x This is what parameter x does.<BR>
/// \param y This is what parameter y does.<BR>
/// \return This is what it returns.<BR>
///<BR>
int DoStuff(x, y);<BR>
</code>
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.


[[Category:Development]]
[[Category:Development]]

Latest revision as of 22:30, 25 October 2006

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.

Installation

You can download the software from:

http://www.stack.nl/~dimitri/doxygen/

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

http://www.graphviz.org/

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

http://www.microsoft.com/downloads/details.aspx?FamilyID=00535334-c8a6-452f-9aa0-d597d16580cc&DisplayLang=en

Use

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.