Mohan
Mohan

Reputation: 8863

Doxygen: documenting class in .dox file

The \class command can be used to put the documentation for a class into a .dox file -- see http://www.doxygen.nl/manual/commands.html#cmdclass . (For those of us who find Javadocs-style documentation makes header files nigh unreadable.)

How do you move documentation for the class's methods into a .dox file too?

To give an example, if I have a Datatypes.h

struct Coordinates {
    const double lat;
    const double lng;

    Coordinates(double lat, double lng);
};

And then I create Datatypes.dox

/** \class Coordinates
 * \brief Represents (latitude, longitude) coordinates encoded according to the World Geodetic System (WGS84).
 */

/* \var const double Coordinates::lat
 * \brief the latitude
 */

then Coordinates is picked up in the index, but Coordinates::lat isn't. What's the right way to do this?

Upvotes: 1

Views: 1487

Answers (1)

albert
albert

Reputation: 9077

Looking at the code of Datatypes.dox we see:

/* \var const double Coordinates::lat
 * \brief the latitude
 */

This is not a doxygen understood comment, but a regular comment. The comment should be (note the second * in the first line):

/** \var const double Coordinates::lat
 * \brief the latitude
 */

Alternatively you could join the both documentation sections to:

/** \class Coordinates
 * \brief Represents (latitude, longitude) coordinates encoded according to the World Geodetic System (WGS84).
 *
 * \var const double Coordinates::lat
 * \brief the latitude
 */

Upvotes: 2

Related Questions