| 1 | = Doxygen Conventions = |
| 2 | |
| 3 | == Comment layouts == |
| 4 | |
| 5 | * boxed comments have the following layout: |
| 6 | {{{ |
| 7 | #!cpp |
| 8 | /** |
| 9 | * Boxed comment example. |
| 10 | */ |
| 11 | }}} |
| 12 | '''Note:''' {{{/**}}} and {{{*/}}} are always in separate lines. |
| 13 | * class and function header file comments have the following layout |
| 14 | {{{ |
| 15 | #!cpp |
| 16 | /** |
| 17 | * Short class description goes here ending with dot. |
| 18 | * |
| 19 | * Second sentence is here. |
| 20 | * Third sentence is here. |
| 21 | */ |
| 22 | class my_class : public base_class |
| 23 | { |
| 24 | public: |
| 25 | /** |
| 26 | * Brief description. |
| 27 | * |
| 28 | * Function header documentation goes here. |
| 29 | * |
| 30 | * @param parameter Parameter description. |
| 31 | * @return Description of the returned value |
| 32 | */ |
| 33 | int my_function( int parameter ); |
| 34 | ... |
| 35 | } |
| 36 | }}} |
| 37 | * these comments are recognized by the Doxygen tool, which can generate HTML documentation for classes. For this reason, the comment has to start with {{{/**}}} instead of {{{/*}}}. Keep the {{{/**}}} and {{{*/}}} in a separate line. |
| 38 | |
| 39 | == Header documentation == |
| 40 | |
| 41 | '''Example''': |
| 42 | |
| 43 | {{{ |
| 44 | #!cpp |
| 45 | // Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz |
| 46 | // http://chaosforge.org/ |
| 47 | // |
| 48 | // This file is part of NV Libraries. |
| 49 | // For conditions of distribution and use, see copyright notice in nv.hh |
| 50 | |
| 51 | /** |
| 52 | * @file file_name.hh |
| 53 | * @author Name Surname name.surname(at)mailadress.com |
| 54 | * @brief Brief description |
| 55 | * |
| 56 | */ |
| 57 | |
| 58 | #ifndef NV_CLASS_NAME_HH |
| 59 | #define NV_CLASS_NAME_HH |
| 60 | |
| 61 | #include <nv/common.hh> |
| 62 | #include <system_header> |
| 63 | #include <system_header2> |
| 64 | |
| 65 | #include <nv/...> |
| 66 | #include <nv/...> |
| 67 | |
| 68 | namespace nv |
| 69 | { |
| 70 | |
| 71 | // Code goes here... |
| 72 | |
| 73 | } // namespace nv |
| 74 | |
| 75 | #endif // NV_CLASS_NAME_HH |
| 76 | |
| 77 | }}} |
| 78 | |
| 79 | '''Notes:''' |
| 80 | * author is the person mainly responsible for the class, or the one that wrote the most code of it |
| 81 | * copyright date should match current year |
| 82 | * use "@" for doxytags, not "\" |
| 83 | * file description can be a single brief line if the file constitutes of a single class and the class is well documented |
| 84 | |
| 85 | == Class documentation == |
| 86 | |
| 87 | '''Example''': |
| 88 | {{{ |
| 89 | #!cpp |
| 90 | /** |
| 91 | * An interesting class. |
| 92 | * |
| 93 | * A more elaborate multiline class description, |
| 94 | * |
| 95 | * @see another_class |
| 96 | */ |
| 97 | class class |
| 98 | { |
| 99 | }; // class |
| 100 | }}} |
| 101 | '''Notes''': |
| 102 | * description should be as elaborate as possible |
| 103 | * include any see also information |
| 104 | * include any revelant note, todo, warning and pre/post conditions if applicable to the whole class |
| 105 | * if class throws exceptions, write about which ones |
| 106 | |
| 107 | == Method/function documentation == |
| 108 | |
| 109 | '''Example''': |
| 110 | {{{ |
| 111 | #!cpp |
| 112 | /** |
| 113 | * A brief description. |
| 114 | * |
| 115 | * A normal function taking two arguments and returning an integer value. |
| 116 | * |
| 117 | * @param param an integer argument. |
| 118 | * @param another a constant character pointer. |
| 119 | * @return A funny value. |
| 120 | * |
| 121 | * @throws funny_exception on error |
| 122 | */ |
| 123 | uint32 funny_function( int param, const char* another ); |
| 124 | }}} |
| 125 | '''Notes''': |
| 126 | * param, return and throw are all mandatory descriptions |
| 127 | * any warnings, pre and post conditions, etc. are welcome |