Motivation
The document you are reading now was generated using Doxygen. It follows in the tradition of literal programming, the goal of which is to keep documentation in the source code, when practical. This way, the documentation will not be outdated or unmaintained.
Commenting interfaces
Concise comments are preferred, as long as the explanation is correct, is not open to interpretation and does not assume extensive knowledge of other parts of the system.
By interface, we mean all content of a header file which is available from a C++ source file, and could result in compile errors if removed. When you comment a header file, you need to take care of a few, minor things in order to produce readable documentation using Doxygen. The basic guidelines for this project are:
- When commenting part of an interface, use one slash followed by two asterisks, followed by a line break and then the actual comment with an asterisk and a space aligned to the first asterisk in the opening line. The first sentence you write, terminated by a period, will be the brief description. After that, you can write a longer, more detailed description. The brief description will be shown in overviews, so it should be no more than a single line. It is possible to document virtually all parts of an interface, so it is not limited to classes.
Example:
{
...
};
Sort-of-Singleton that many classes, both GUI and non-GUI, use to access the game data.
- It is also possible to document symbols on the same line by using a slash followed by two asterisks and a left angular bracket:
};
ADDON_TYPE
Values used for add-on classification; UI-only at the moment, in the future it could be used for dire...
@ ADDON_SP_SCENARIO
Single-player scenario.
@ ADDON_MP_SCENARIO
Multiplayer scenario.
@ ADDON_MP_CAMPAIGN
Multiplayer campaign.
@ ADDON_SP_CAMPAIGN
Single-player campaign.
- Do not refer to multiple objects of the type "Manager" as "Managers" or "manager". Instead, say "Manager objects". Doxygen will automatically link to class documentation whenever it finds class names in comments, but will not do so if you do not use their proper names.
- Many Doxygen commands can be used in comments to enhance the generated documentation and structure the comments.
- There is a balance between readable autogenerated documentation and readable code, so beware of overdoing it.
Example: