Doxygen: Difference between revisions
Lou Montana (talk | contribs) m (Some wiki formatting) |
Lou Montana (talk | contribs) (Add Arma Reforger + Enfusion Doxygen links) |
||
Line 3: | Line 3: | ||
{{Feature|informative| | {{Feature|informative| | ||
* The official Doxygen documentation can be found here: https://www.doxygen.nl/manual/ | * The official Doxygen format documentation can be found here: https://www.doxygen.nl/manual/ | ||
* See also {{Link/Enfusion|armaR|SCR_ExampleDoxygen}} for "live" examples. | * See also {{Link/Enfusion|armaR|SCR_ExampleDoxygen}} for "live" examples. | ||
}} | }} | ||
Line 12: | Line 12: | ||
== Project Documentation == | == Project Documentation == | ||
{{ | {{Feature|armaR|{{armaR}}'s Doxygen documentation is provided with {{Link|https://store.steampowered.com/app/1874910/Arma_Reforger_Tools/|{{armaR}} Tools}} in {{hl|Workbench\docs}} and can be viewed and downloaded on the wiki: | ||
* {{Link|https://community.bistudio.com/wikidata/external-data/arma-reforger/ArmaReforgerScriptAPIPublic.zip|download}} - {{Link|https://community.bistudio.com/wikidata/external-data/arma-reforger/ArmaReforgerScriptAPIPublic/|ArmaReforgerScriptAPIPublic}} | |||
* {{Link|https://community.bistudio.com/wikidata/external-data/arma-reforger/EnfusionScriptAPIPublic.zip|download}} - {{Link|https://community.bistudio.com/wikidata/external-data/arma-reforger/EnfusionScriptAPIPublic/|EnfusionScriptAPIPublic}} | |||
Current version: '''1.0.0''' | |||
}}<!-- | |||
{{Feature|arma4|{{arma4}}'s Doxygen documentation can be found {{Link|{{SERVER}}/Doxygen/arma-reforger/|here}}.}}--> | {{Feature|arma4|{{arma4}}'s Doxygen documentation can be found {{Link|{{SERVER}}/Doxygen/arma-reforger/|here}}.}}--> | ||
Line 28: | Line 31: | ||
{{Name|bi}} recommendations: | {{Name|bi}} recommendations: | ||
* use {{hl|//!}} and eventually {{hl|/*! */}} | * use {{hl|//!}}, {{hl|//!<}} and ''eventually'' {{hl|/*! */}} (inline comment is preferred in order to remain able to comment big chunks of code with {{hl|/* */}} without breaking scopes) | ||
* do not go too much into details (e.g | ** {{hl|///}} and {{hl|/** */}} are to be avoided | ||
* do not over-document code ( | * do not go too much into details (e.g {{hl|//! This method does xxx if provided Y but will not do it if Z is set to true at line 246 and ...}}) | ||
* do not over-document code ({{hl|m_iVar++; //< increments m_iVar by 1}} is of absolutely no value) again, code should be self-explanatory and a comment should explain a design decision (if needed) | |||
{{Feature|important| | {{Feature|important| | ||
Line 58: | Line 62: | ||
A method documentation goes below the {{hl|//---}} separator and must ideally document the method's purpose, its '''parameters''', and its '''return value'''. | A method documentation goes below the {{hl|//---}} separator and must ideally document the method's purpose, its '''parameters''', and its '''return value'''. | ||
{{Feature|warning|'''Always''' amend the documentation when changing a method's signature!}} | {{Feature|warning|'''Always''' amend the documentation when changing a method's signature/behaviour!}} | ||
<enforce> | <enforce> |
Revision as of 15:19, 24 November 2023
Doxygen is a tool that generates documentation from code comment respecting a certain format. This code documentation is used across Enfusion projects, starting with Arma Reforger.
Project Documentation
Bohemia Interactive Guidelines
Documentation is important:
- Document what is public (protected methods go second - people should use public methods anyway)
- Document what is important (features, concepts, specifics like variables or constants, etc)
- Document what is dangerous (performance-wise, crash-wise)
Bohemia Interactive recommendations:
- use
/ /!, / /!< and eventually /*! * / (inline comment is preferred in order to remain able to comment big chunks of code with /* * / without breaking scopes) / / / and /** * / are to be avoided
- do not go too much into details (e.g
/ /! This method does xxx if provided Y but will not do it if Z is set to true at line 246 and ...) - do not over-document code (m_iVar++;
/ /< increments m_iVar by 1 is of absolutely no value) again, code should be self-explanatory and a comment should explain a design decision (if needed)
Class
A class documentation explains what the class does. It can add said class to groups (see Doxygen's grouping documentation). Grouping is usually done in a different comment block than class comment.
Method
A method documentation goes below the
Various parameter formats:
Only one return format:
To be used when a void signature is not used.
Variable
Examples
Do
This example is taken from SCR_ObstacleDetector:
This comment is fine for multiple reasons:
- the main description states the method's goal and usage condition
- parameters are documented and specifics (when present) are explained
- the return value is described accurately
- error cases are covered
Don't
Example | Explanation |
---|---|
| |
//------------------------------------------------------------------------------------------------
//! Returns true if has obstacle
//! \param worldPos the world position
//! \param exclusionList the exclusion list
//! \return true or false
bool HasObstacle(vector worldPos, array<IEntity> exclusionList = null) |
|
This one is one of the worst possible cases: no comment is better than a wrong comment. |
See Also
- https://www.doxygen.nl/ - the official Doxygen website
- https://www.doxygen.nl/manual/ - the official documentation