xref: /aosp_15_r20/external/pigweed/docs/style/doxygen.rst (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen:
2*61c4878aSAndroid Build Coastguard Worker
3*61c4878aSAndroid Build Coastguard Worker===================
4*61c4878aSAndroid Build Coastguard WorkerDoxygen style guide
5*61c4878aSAndroid Build Coastguard Worker===================
6*61c4878aSAndroid Build Coastguard Worker.. _Doxygen: https://www.doxygen.nl/index.html
7*61c4878aSAndroid Build Coastguard Worker
8*61c4878aSAndroid Build Coastguard Worker``pigweed.dev`` uses `Doxygen`_ to auto-generate C and C++ API references
9*61c4878aSAndroid Build Coastguard Workerfrom code comments in header files. These specially formatted comments are
10*61c4878aSAndroid Build Coastguard Workercalled **Doxygen comments**. This style guide shows you how to format Doxygen
11*61c4878aSAndroid Build Coastguard Workercomments and other related documentation.
12*61c4878aSAndroid Build Coastguard Worker
13*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-quickstart:
14*61c4878aSAndroid Build Coastguard Worker
15*61c4878aSAndroid Build Coastguard Worker----------
16*61c4878aSAndroid Build Coastguard WorkerQuickstart
17*61c4878aSAndroid Build Coastguard Worker----------
18*61c4878aSAndroid Build Coastguard WorkerAuto-generating an API reference on ``pigweed.dev`` requires interacting with
19*61c4878aSAndroid Build Coastguard Workera few different tools. This section provides an overview of when you interact
20*61c4878aSAndroid Build Coastguard Workerwith each tool, using ``pw_i2c`` as an example.
21*61c4878aSAndroid Build Coastguard Worker
22*61c4878aSAndroid Build Coastguard Worker.. inclusive-language: disable
23*61c4878aSAndroid Build Coastguard Worker
24*61c4878aSAndroid Build Coastguard Worker.. _//pw_i2c/public/pw_i2c/device.h: https://cs.opensource.google/pigweed/pigweed/+/4c1a7158b663f114c297d9c0a806f412768e73f8:pw_i2c/public/pw_i2c/device.h
25*61c4878aSAndroid Build Coastguard Worker.. _Breathe directives: https://breathe.readthedocs.io/en/latest/directives.html
26*61c4878aSAndroid Build Coastguard Worker.. _Sphinx: https://www.sphinx-doc.org/en/master/
27*61c4878aSAndroid Build Coastguard Worker.. _//pw_i2c/reference.rst: https://cs.opensource.google/pigweed/pigweed/+/4c1a7158b663f114c297d9c0a806f412768e73f8:pw_i2c/reference.rst;l=44
28*61c4878aSAndroid Build Coastguard Worker.. _//docs/BUILD.gn: https://cs.opensource.google/pigweed/pigweed/+/4c1a7158b663f114c297d9c0a806f412768e73f8:docs/BUILD.gn;l=192
29*61c4878aSAndroid Build Coastguard Worker
30*61c4878aSAndroid Build Coastguard Worker.. inclusive-language: enable
31*61c4878aSAndroid Build Coastguard Worker
32*61c4878aSAndroid Build Coastguard Worker#. Annotate your header file using `Doxygen`_ syntax. All of the comments
33*61c4878aSAndroid Build Coastguard Worker   that start with triple slashes (``///``) are Doxygen comments. Doxygen
34*61c4878aSAndroid Build Coastguard Worker   ignores double slash (``//``) comments.
35*61c4878aSAndroid Build Coastguard Worker
36*61c4878aSAndroid Build Coastguard Worker   Example: `//pw_i2c/public/pw_i2c/device.h`_
37*61c4878aSAndroid Build Coastguard Worker
38*61c4878aSAndroid Build Coastguard Worker#. Include the API reference content into a reStructuredText file using
39*61c4878aSAndroid Build Coastguard Worker   `Breathe directives`_. Breathe is the bridge between Doxygen and `Sphinx`_,
40*61c4878aSAndroid Build Coastguard Worker   the documentation generator that powers ``pigweed.dev``. See
41*61c4878aSAndroid Build Coastguard Worker   :ref:`docs-style-doxygen-breathe-overview` for more explanation.
42*61c4878aSAndroid Build Coastguard Worker
43*61c4878aSAndroid Build Coastguard Worker   Example: `//pw_i2c/reference.rst`_
44*61c4878aSAndroid Build Coastguard Worker
45*61c4878aSAndroid Build Coastguard Worker#. Add your header file's path to the ``_doxygen_input_files`` list in
46*61c4878aSAndroid Build Coastguard Worker   ``//docs/BUILD.gn``. The docs build system throws a "symbol not found"
47*61c4878aSAndroid Build Coastguard Worker   errors if you forget this step.
48*61c4878aSAndroid Build Coastguard Worker
49*61c4878aSAndroid Build Coastguard Worker   Example: `//docs/BUILD.gn`_
50*61c4878aSAndroid Build Coastguard Worker
51*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-writing:
52*61c4878aSAndroid Build Coastguard Worker
53*61c4878aSAndroid Build Coastguard Worker---------------------------
54*61c4878aSAndroid Build Coastguard WorkerAPI reference writing style
55*61c4878aSAndroid Build Coastguard Worker---------------------------
56*61c4878aSAndroid Build Coastguard Worker.. _API reference code comments: https://developers.google.com/style/api-reference-comments
57*61c4878aSAndroid Build Coastguard Worker
58*61c4878aSAndroid Build Coastguard WorkerFollow the guidance in `API reference code comments`_.
59*61c4878aSAndroid Build Coastguard Worker
60*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-comment-style:
61*61c4878aSAndroid Build Coastguard Worker
62*61c4878aSAndroid Build Coastguard Worker---------------------
63*61c4878aSAndroid Build Coastguard WorkerDoxygen comment style
64*61c4878aSAndroid Build Coastguard Worker---------------------
65*61c4878aSAndroid Build Coastguard WorkerThis section explains how you should style the comments within header files
66*61c4878aSAndroid Build Coastguard Workerthat Doxygen converts into API references.
67*61c4878aSAndroid Build Coastguard Worker
68*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-comment-syntax:
69*61c4878aSAndroid Build Coastguard Worker
70*61c4878aSAndroid Build Coastguard WorkerComment syntax
71*61c4878aSAndroid Build Coastguard Worker==============
72*61c4878aSAndroid Build Coastguard WorkerUse the triple slash (``///``) syntax.
73*61c4878aSAndroid Build Coastguard Worker
74*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
75*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
76*61c4878aSAndroid Build Coastguard Worker
77*61c4878aSAndroid Build Coastguard Worker   .. code-block:: none
78*61c4878aSAndroid Build Coastguard Worker
79*61c4878aSAndroid Build Coastguard Worker      /// ...
80*61c4878aSAndroid Build Coastguard Worker      /// ...
81*61c4878aSAndroid Build Coastguard Worker
82*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-special-command-syntax:
83*61c4878aSAndroid Build Coastguard Worker
84*61c4878aSAndroid Build Coastguard WorkerSpecial command syntax
85*61c4878aSAndroid Build Coastguard Worker======================
86*61c4878aSAndroid Build Coastguard Worker.. _Special commands: https://www.doxygen.nl/manual/commands.html
87*61c4878aSAndroid Build Coastguard Worker
88*61c4878aSAndroid Build Coastguard Worker`Special commands`_ like ``@code`` and ``@param`` are the core annotation
89*61c4878aSAndroid Build Coastguard Workertools of Doxygen. Doxygen recognizes words that begin with either backslashes
90*61c4878aSAndroid Build Coastguard Worker(``\``) or at symbols (``@``) as special commands. For example, ``\code`` and
91*61c4878aSAndroid Build Coastguard Worker``@code`` are synonyms. Always use the at symbol (``@``) format.
92*61c4878aSAndroid Build Coastguard Worker
93*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
94*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
95*61c4878aSAndroid Build Coastguard Worker
96*61c4878aSAndroid Build Coastguard Worker   .. code-block:: none
97*61c4878aSAndroid Build Coastguard Worker
98*61c4878aSAndroid Build Coastguard Worker      /// @param[out] dest The memory area to copy to.
99*61c4878aSAndroid Build Coastguard Worker
100*61c4878aSAndroid Build Coastguard Worker.. admonition:: **No**
101*61c4878aSAndroid Build Coastguard Worker   :class: error
102*61c4878aSAndroid Build Coastguard Worker
103*61c4878aSAndroid Build Coastguard Worker   .. code-block:: none
104*61c4878aSAndroid Build Coastguard Worker
105*61c4878aSAndroid Build Coastguard Worker      /// \param dest The memory area to copy to.
106*61c4878aSAndroid Build Coastguard Worker
107*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-structural-commands:
108*61c4878aSAndroid Build Coastguard Worker
109*61c4878aSAndroid Build Coastguard WorkerStructural commands
110*61c4878aSAndroid Build Coastguard Worker===================
111*61c4878aSAndroid Build Coastguard Worker.. _Doxygen structural commands: https://doxygen.nl/manual/docblocks.html#structuralcommands
112*61c4878aSAndroid Build Coastguard Worker
113*61c4878aSAndroid Build Coastguard Worker`Doxygen structural commands`_ like ``@struct``, ``@fn``, ``@class``, and ``@file``
114*61c4878aSAndroid Build Coastguard Workerassociate a comment to a symbol. Don't use structural commands if they're not
115*61c4878aSAndroid Build Coastguard Workerneeded. In other words, if your Doxygen comment renders correctly without the
116*61c4878aSAndroid Build Coastguard Workerstructural command, don't use it.
117*61c4878aSAndroid Build Coastguard Worker
118*61c4878aSAndroid Build Coastguard WorkerCode examples
119*61c4878aSAndroid Build Coastguard Worker=============
120*61c4878aSAndroid Build Coastguard WorkerUse ``@code{.cpp}`` followed by the code example followed by ``@endcode``.
121*61c4878aSAndroid Build Coastguard Worker
122*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
123*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
124*61c4878aSAndroid Build Coastguard Worker
125*61c4878aSAndroid Build Coastguard Worker   .. code-block:: none
126*61c4878aSAndroid Build Coastguard Worker
127*61c4878aSAndroid Build Coastguard Worker      /// @code{.cpp}
128*61c4878aSAndroid Build Coastguard Worker      ///   #include "pw_kvs/key_value_store.h"
129*61c4878aSAndroid Build Coastguard Worker      ///   #include "pw_kvs/flash_test_partition.h"
130*61c4878aSAndroid Build Coastguard Worker      ///
131*61c4878aSAndroid Build Coastguard Worker      ///   ...
132*61c4878aSAndroid Build Coastguard Worker      /// @endcode
133*61c4878aSAndroid Build Coastguard Worker
134*61c4878aSAndroid Build Coastguard WorkerOmit or change ``{.cpp}`` if your code example isn't C++ code.
135*61c4878aSAndroid Build Coastguard Worker
136*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
137*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
138*61c4878aSAndroid Build Coastguard Worker
139*61c4878aSAndroid Build Coastguard Worker   .. code-block:: none
140*61c4878aSAndroid Build Coastguard Worker
141*61c4878aSAndroid Build Coastguard Worker      /// @code
142*61c4878aSAndroid Build Coastguard Worker      ///   START + I2C_ADDRESS + WRITE(0) + TX_BUFFER_BYTES + STOP
143*61c4878aSAndroid Build Coastguard Worker      ///   START + I2C_ADDRESS + READ(1) + RX_BUFFER_BYTES + STOP
144*61c4878aSAndroid Build Coastguard Worker      /// @endcode
145*61c4878aSAndroid Build Coastguard Worker
146*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-params:
147*61c4878aSAndroid Build Coastguard Worker
148*61c4878aSAndroid Build Coastguard WorkerParameters
149*61c4878aSAndroid Build Coastguard Worker==========
150*61c4878aSAndroid Build Coastguard WorkerUse ``@param[<direction>] <name> <description>`` for each parameter.
151*61c4878aSAndroid Build Coastguard Worker
152*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
153*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
154*61c4878aSAndroid Build Coastguard Worker
155*61c4878aSAndroid Build Coastguard Worker   .. code-block:: none
156*61c4878aSAndroid Build Coastguard Worker
157*61c4878aSAndroid Build Coastguard Worker      /// @param[out] dest The memory area to copy to.
158*61c4878aSAndroid Build Coastguard Worker      /// @param[in] src The memory area to copy from.
159*61c4878aSAndroid Build Coastguard Worker      /// @param[in] n The number of bytes to copy.
160*61c4878aSAndroid Build Coastguard Worker
161*61c4878aSAndroid Build Coastguard WorkerPut a newline between the parameters if you need multi-line descriptions.
162*61c4878aSAndroid Build Coastguard Worker
163*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
164*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
165*61c4878aSAndroid Build Coastguard Worker
166*61c4878aSAndroid Build Coastguard Worker   .. code-block:: none
167*61c4878aSAndroid Build Coastguard Worker
168*61c4878aSAndroid Build Coastguard Worker      /// @param[out] dest Lorem ipsum dolor sit amet, consectetur adipiscing
169*61c4878aSAndroid Build Coastguard Worker      /// elit, sed do eiusmod tempor incididunt ut labore et dolore magna...
170*61c4878aSAndroid Build Coastguard Worker      ///
171*61c4878aSAndroid Build Coastguard Worker      /// @param[in] src The memory area to copy from.
172*61c4878aSAndroid Build Coastguard Worker      ///
173*61c4878aSAndroid Build Coastguard Worker      /// @param[in] n The number of bytes to copy.
174*61c4878aSAndroid Build Coastguard Worker
175*61c4878aSAndroid Build Coastguard WorkerThe direction annotation is required.
176*61c4878aSAndroid Build Coastguard Worker
177*61c4878aSAndroid Build Coastguard Worker.. admonition:: **No**
178*61c4878aSAndroid Build Coastguard Worker   :class: error
179*61c4878aSAndroid Build Coastguard Worker
180*61c4878aSAndroid Build Coastguard Worker   .. code-block:: none
181*61c4878aSAndroid Build Coastguard Worker
182*61c4878aSAndroid Build Coastguard Worker      /// @param dest The memory area to copy to.
183*61c4878aSAndroid Build Coastguard Worker      /// @param src The memory area to copy from.
184*61c4878aSAndroid Build Coastguard Worker      /// @param n The number of bytes to copy.
185*61c4878aSAndroid Build Coastguard Worker
186*61c4878aSAndroid Build Coastguard Worker   ``<direction>`` must be specified and the value must be either ``in`` or
187*61c4878aSAndroid Build Coastguard Worker   ``out``.
188*61c4878aSAndroid Build Coastguard Worker
189*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-pre:
190*61c4878aSAndroid Build Coastguard Worker
191*61c4878aSAndroid Build Coastguard WorkerPreconditions
192*61c4878aSAndroid Build Coastguard Worker=============
193*61c4878aSAndroid Build Coastguard WorkerUse ``@pre <description>``.
194*61c4878aSAndroid Build Coastguard Worker
195*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
196*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
197*61c4878aSAndroid Build Coastguard Worker
198*61c4878aSAndroid Build Coastguard Worker   .. code-block:: none
199*61c4878aSAndroid Build Coastguard Worker
200*61c4878aSAndroid Build Coastguard Worker      /// @pre Description of a precondition that must be satisifed before
201*61c4878aSAndroid Build Coastguard Worker      /// invoking this function.
202*61c4878aSAndroid Build Coastguard Worker
203*61c4878aSAndroid Build Coastguard WorkerDeprecated features
204*61c4878aSAndroid Build Coastguard Worker===================
205*61c4878aSAndroid Build Coastguard WorkerUse ``@deprecated <description>``.
206*61c4878aSAndroid Build Coastguard Worker
207*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
208*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
209*61c4878aSAndroid Build Coastguard Worker
210*61c4878aSAndroid Build Coastguard Worker   .. code-block:: none
211*61c4878aSAndroid Build Coastguard Worker
212*61c4878aSAndroid Build Coastguard Worker      /// @deprecated This function, class, or other entity is deprecated. Use
213*61c4878aSAndroid Build Coastguard Worker      /// the replacement instead.
214*61c4878aSAndroid Build Coastguard Worker
215*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-pw_status:
216*61c4878aSAndroid Build Coastguard Worker
217*61c4878aSAndroid Build Coastguard Workerpw_status codes
218*61c4878aSAndroid Build Coastguard Worker===============
219*61c4878aSAndroid Build Coastguard WorkerUse the following syntax when referring to ``pw_status`` codes:
220*61c4878aSAndroid Build Coastguard Worker
221*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
222*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
223*61c4878aSAndroid Build Coastguard Worker
224*61c4878aSAndroid Build Coastguard Worker   .. code-block:: none
225*61c4878aSAndroid Build Coastguard Worker
226*61c4878aSAndroid Build Coastguard Worker      @pw_status{...}
227*61c4878aSAndroid Build Coastguard Worker
228*61c4878aSAndroid Build Coastguard WorkerReplace ``...`` with a valid ``pw_status`` code. See
229*61c4878aSAndroid Build Coastguard Worker:ref:`module-pw_status-quickref`.
230*61c4878aSAndroid Build Coastguard Worker
231*61c4878aSAndroid Build Coastguard WorkerDoxygen converts this alias into a link to the status code's reference
232*61c4878aSAndroid Build Coastguard Workerdocumentation.
233*61c4878aSAndroid Build Coastguard Worker
234*61c4878aSAndroid Build Coastguard WorkerDon't use this syntax for functions or methods that return a set of
235*61c4878aSAndroid Build Coastguard Workerstatus codes. Use ``pw-status-codes``. See :ref:`pw-status-codes`.
236*61c4878aSAndroid Build Coastguard Worker
237*61c4878aSAndroid Build Coastguard Worker.. _pw-status-codes:
238*61c4878aSAndroid Build Coastguard Worker
239*61c4878aSAndroid Build Coastguard WorkerFunctions and methods that return pw::Status codes
240*61c4878aSAndroid Build Coastguard Worker==================================================
241*61c4878aSAndroid Build Coastguard WorkerUse ``pw-status-codes`` to present the set of codes and descriptions as a
242*61c4878aSAndroid Build Coastguard Workertwo-column table:
243*61c4878aSAndroid Build Coastguard Worker
244*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
245*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
246*61c4878aSAndroid Build Coastguard Worker
247*61c4878aSAndroid Build Coastguard Worker   .. code-block:: none
248*61c4878aSAndroid Build Coastguard Worker
249*61c4878aSAndroid Build Coastguard Worker      /// @returns @rst
250*61c4878aSAndroid Build Coastguard Worker      ///
251*61c4878aSAndroid Build Coastguard Worker      /// .. pw-status-codes::
252*61c4878aSAndroid Build Coastguard Worker      ///
253*61c4878aSAndroid Build Coastguard Worker      ///    <code>: <description>
254*61c4878aSAndroid Build Coastguard Worker      ///
255*61c4878aSAndroid Build Coastguard Worker      ///    <code>: <description>
256*61c4878aSAndroid Build Coastguard Worker      ///
257*61c4878aSAndroid Build Coastguard Worker      /// @endrst
258*61c4878aSAndroid Build Coastguard Worker
259*61c4878aSAndroid Build Coastguard WorkerExample:
260*61c4878aSAndroid Build Coastguard Worker
261*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
262*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
263*61c4878aSAndroid Build Coastguard Worker
264*61c4878aSAndroid Build Coastguard Worker   .. code-block:: none
265*61c4878aSAndroid Build Coastguard Worker
266*61c4878aSAndroid Build Coastguard Worker      /// @returns @rst
267*61c4878aSAndroid Build Coastguard Worker      ///
268*61c4878aSAndroid Build Coastguard Worker      /// .. pw-status-codes::
269*61c4878aSAndroid Build Coastguard Worker      ///
270*61c4878aSAndroid Build Coastguard Worker      ///    OK: The bulk read was successful.
271*61c4878aSAndroid Build Coastguard Worker      ///
272*61c4878aSAndroid Build Coastguard Worker      ///    RESOURCE_EXHAUSTED: The remaining space is too small to hold a
273*61c4878aSAndroid Build Coastguard Worker      ///    new block.
274*61c4878aSAndroid Build Coastguard Worker      ///
275*61c4878aSAndroid Build Coastguard Worker      /// @endrst
276*61c4878aSAndroid Build Coastguard Worker
277*61c4878aSAndroid Build Coastguard Worker* Each ``<code>`` must be a valid :ref:`status code <module-pw_status-codes>`.
278*61c4878aSAndroid Build Coastguard Worker  The part before the colon must be plaintext.
279*61c4878aSAndroid Build Coastguard Worker* Each ``<description>`` should explain further what the code means in this
280*61c4878aSAndroid Build Coastguard Worker  particular scenario. The description must be a single paragraph. It can use
281*61c4878aSAndroid Build Coastguard Worker  inline reStructuredText features such as code formatting and cross-references.
282*61c4878aSAndroid Build Coastguard Worker* ``pw-status-codes`` needs to be wrapped in ``@rst`` and ``@endrst``
283*61c4878aSAndroid Build Coastguard Worker  because it's a reStructuredText directive and Doxygen doesn't natively
284*61c4878aSAndroid Build Coastguard Worker  support reST. The implementation is at
285*61c4878aSAndroid Build Coastguard Worker  ``//pw_docgen/py/pw_docgen/sphinx/pw_status_codes.py``.
286*61c4878aSAndroid Build Coastguard Worker
287*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
288*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
289*61c4878aSAndroid Build Coastguard Worker
290*61c4878aSAndroid Build Coastguard Worker   .. code-block:: none
291*61c4878aSAndroid Build Coastguard Worker
292*61c4878aSAndroid Build Coastguard Worker      /// @returns @rst
293*61c4878aSAndroid Build Coastguard Worker      ///
294*61c4878aSAndroid Build Coastguard Worker      /// .. pw-status-codes::
295*61c4878aSAndroid Build Coastguard Worker      ///
296*61c4878aSAndroid Build Coastguard Worker      ///    OK: Data successfully written to ``buffer``.
297*61c4878aSAndroid Build Coastguard Worker      ///
298*61c4878aSAndroid Build Coastguard Worker      ///    RESOURCE_EXHAUSTED: The remaining space is too small to hold a
299*61c4878aSAndroid Build Coastguard Worker      ///    new block. See :ref:`module-pw_example-troubleshooting`.
300*61c4878aSAndroid Build Coastguard Worker      ///
301*61c4878aSAndroid Build Coastguard Worker      /// @endrst
302*61c4878aSAndroid Build Coastguard Worker
303*61c4878aSAndroid Build Coastguard Worker   It's OK to use reStructuredText features like code formatting and
304*61c4878aSAndroid Build Coastguard Worker   cross-references within the descriptions. The status code itself
305*61c4878aSAndroid Build Coastguard Worker   must be plaintext.
306*61c4878aSAndroid Build Coastguard Worker
307*61c4878aSAndroid Build Coastguard Worker.. admonition:: **No**
308*61c4878aSAndroid Build Coastguard Worker   :class: error
309*61c4878aSAndroid Build Coastguard Worker
310*61c4878aSAndroid Build Coastguard Worker   .. code-block:: none
311*61c4878aSAndroid Build Coastguard Worker
312*61c4878aSAndroid Build Coastguard Worker      /// @returns @rst
313*61c4878aSAndroid Build Coastguard Worker      ///
314*61c4878aSAndroid Build Coastguard Worker      /// .. pw-status-codes::
315*61c4878aSAndroid Build Coastguard Worker      ///
316*61c4878aSAndroid Build Coastguard Worker      ///    RESOURCE_EXHAUSTED: The remaining space is too small to hold a
317*61c4878aSAndroid Build Coastguard Worker      ///                        new block.
318*61c4878aSAndroid Build Coastguard Worker      ///
319*61c4878aSAndroid Build Coastguard Worker      /// @endrst
320*61c4878aSAndroid Build Coastguard Worker
321*61c4878aSAndroid Build Coastguard Worker   For items that span multiple lines, don't use whitespace like this.
322*61c4878aSAndroid Build Coastguard Worker
323*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-namespaces:
324*61c4878aSAndroid Build Coastguard Worker
325*61c4878aSAndroid Build Coastguard WorkerUse fully namespaced names
326*61c4878aSAndroid Build Coastguard Worker==========================
327*61c4878aSAndroid Build Coastguard WorkerIn general, write out the full namespace to Pigweed classes, methods, and
328*61c4878aSAndroid Build Coastguard Workerso on. If you're writing a code sample, and that code sample clearly shows
329*61c4878aSAndroid Build Coastguard Workerwhere the item comes from via a ``using`` statement, you don't need to use
330*61c4878aSAndroid Build Coastguard Workerfull namespacing.
331*61c4878aSAndroid Build Coastguard Worker
332*61c4878aSAndroid Build Coastguard Worker.. admonition:: Discussion
333*61c4878aSAndroid Build Coastguard Worker
334*61c4878aSAndroid Build Coastguard Worker   Pigweed has over 160 modules. It can be overwhelming for beginners
335*61c4878aSAndroid Build Coastguard Worker   to figure out where an item is coming from.
336*61c4878aSAndroid Build Coastguard Worker
337*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-multisymbol:
338*61c4878aSAndroid Build Coastguard Worker
339*61c4878aSAndroid Build Coastguard WorkerSingle comment block for multiple symbols
340*61c4878aSAndroid Build Coastguard Worker=========================================
341*61c4878aSAndroid Build Coastguard WorkerUse ``@def <symbol>`` followed by the comment block.
342*61c4878aSAndroid Build Coastguard Worker
343*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
344*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
345*61c4878aSAndroid Build Coastguard Worker
346*61c4878aSAndroid Build Coastguard Worker   .. code-block:: cpp
347*61c4878aSAndroid Build Coastguard Worker
348*61c4878aSAndroid Build Coastguard Worker      /// @def PW_ASSERT_EXCLUSIVE_LOCK
349*61c4878aSAndroid Build Coastguard Worker      /// @def PW_ASSERT_SHARED_LOCK
350*61c4878aSAndroid Build Coastguard Worker      ///
351*61c4878aSAndroid Build Coastguard Worker      /// Documents functions that dynamically check to see if a lock is held, and
352*61c4878aSAndroid Build Coastguard Worker      /// fail if it is not held.
353*61c4878aSAndroid Build Coastguard Worker
354*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-xrefs:
355*61c4878aSAndroid Build Coastguard Worker
356*61c4878aSAndroid Build Coastguard WorkerCross-references (x-refs)
357*61c4878aSAndroid Build Coastguard Worker=========================
358*61c4878aSAndroid Build Coastguard Worker
359*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-xrefs-comments:
360*61c4878aSAndroid Build Coastguard Worker
361*61c4878aSAndroid Build Coastguard WorkerX-refs in Doxygen comments
362*61c4878aSAndroid Build Coastguard Worker--------------------------
363*61c4878aSAndroid Build Coastguard WorkerFor C or C++ x-refs, use one of the following aliases:
364*61c4878aSAndroid Build Coastguard Worker
365*61c4878aSAndroid Build Coastguard Worker.. csv-table::
366*61c4878aSAndroid Build Coastguard Worker   :header: Alias, reStructuredText equivalent
367*61c4878aSAndroid Build Coastguard Worker
368*61c4878aSAndroid Build Coastguard Worker   ``@c_macro{<identifier>}``, ``:c:macro:`<identifier>```
369*61c4878aSAndroid Build Coastguard Worker   ``@cpp_func{<identifier>}``, ``:cpp:func:`<identifier>```
370*61c4878aSAndroid Build Coastguard Worker   ``@cpp_class{<identifier>}``, ``:cpp:class:`<identifier>```
371*61c4878aSAndroid Build Coastguard Worker   ``@cpp_type{<identifier>}``, ``:cpp:type:`<identifier>```
372*61c4878aSAndroid Build Coastguard Worker
373*61c4878aSAndroid Build Coastguard Worker.. inclusive-language: disable
374*61c4878aSAndroid Build Coastguard Worker
375*61c4878aSAndroid Build Coastguard Worker.. _Sphinx Domain: https://www.sphinx-doc.org/en/master/usage/domains/index.html
376*61c4878aSAndroid Build Coastguard Worker
377*61c4878aSAndroid Build Coastguard Worker.. inclusive-language: enable
378*61c4878aSAndroid Build Coastguard Worker
379*61c4878aSAndroid Build Coastguard WorkerFor all other x-refs, use Pigweed's custom basic alias,
380*61c4878aSAndroid Build Coastguard Worker``@crossref{<domain>,<type>,<identifier>}``. ``<domain>`` must be a valid
381*61c4878aSAndroid Build Coastguard Worker`Sphinx Domain`_ and ``<type>`` must be a valid type within that domain.
382*61c4878aSAndroid Build Coastguard Worker``@crossref`` can be used with any domain.
383*61c4878aSAndroid Build Coastguard Worker
384*61c4878aSAndroid Build Coastguard WorkerAvoid Doxygen x-refs
385*61c4878aSAndroid Build Coastguard Worker^^^^^^^^^^^^^^^^^^^^
386*61c4878aSAndroid Build Coastguard WorkerAlways use Pigweed's custom aliases for x-refs unless you have specific
387*61c4878aSAndroid Build Coastguard Workerreasons not to do so. Pigweed's x-ref aliases are built on top of Sphinx.
388*61c4878aSAndroid Build Coastguard WorkerDoxygen provides its own features for x-refs but they should be avoided
389*61c4878aSAndroid Build Coastguard Workerbecause Sphinx's are better:
390*61c4878aSAndroid Build Coastguard Worker
391*61c4878aSAndroid Build Coastguard Worker* Sphinx x-refs work for all identifiers known to Sphinx, including
392*61c4878aSAndroid Build Coastguard Worker  those documented with directives like ``.. cpp:class::`` or extracted from
393*61c4878aSAndroid Build Coastguard Worker  Python. Doxygen references can only refer to identifiers known to Doxygen.
394*61c4878aSAndroid Build Coastguard Worker* Sphinx x-refs always use consistent formatting. Doxygen
395*61c4878aSAndroid Build Coastguard Worker  x-refs sometimes render as plaintext instead of code-style
396*61c4878aSAndroid Build Coastguard Worker  monospace, or include ``()`` in macros that shouldn’t have them.
397*61c4878aSAndroid Build Coastguard Worker* Sphinx x-refs can refer to symbols that haven't yet been documented.
398*61c4878aSAndroid Build Coastguard Worker  They will be formatted correctly and become links once the symbols are
399*61c4878aSAndroid Build Coastguard Worker  documented.
400*61c4878aSAndroid Build Coastguard Worker
401*61c4878aSAndroid Build Coastguard WorkerUsing Sphinx x-refs in Doxygen comments makes x-ref syntax more consistent
402*61c4878aSAndroid Build Coastguard Workerwithin Doxygen comments and between reStructuredText and Doxygen.
403*61c4878aSAndroid Build Coastguard Worker
404*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-xrefs-rest:
405*61c4878aSAndroid Build Coastguard Worker
406*61c4878aSAndroid Build Coastguard WorkerCross-references in reST to Doxygen symbols
407*61c4878aSAndroid Build Coastguard Worker-------------------------------------------
408*61c4878aSAndroid Build Coastguard WorkerAfter you've used Doxygen to generate API references, you can link to those
409*61c4878aSAndroid Build Coastguard Workersymbols from your reStructuredText with standard Sphinx x-ref
410*61c4878aSAndroid Build Coastguard Workersyntax.
411*61c4878aSAndroid Build Coastguard Worker
412*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
413*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
414*61c4878aSAndroid Build Coastguard Worker
415*61c4878aSAndroid Build Coastguard Worker   .. code-block:: rst
416*61c4878aSAndroid Build Coastguard Worker
417*61c4878aSAndroid Build Coastguard Worker      :cpp:class:`pw::sync::BinarySemaphore::BinarySemaphore`
418*61c4878aSAndroid Build Coastguard Worker
419*61c4878aSAndroid Build Coastguard Worker.. inclusive-language: disable
420*61c4878aSAndroid Build Coastguard Worker
421*61c4878aSAndroid Build Coastguard Worker.. _domain: https://www.sphinx-doc.org/en/master/usage/domains/index.html
422*61c4878aSAndroid Build Coastguard Worker.. _C++ Domain: https://www.sphinx-doc.org/en/master/usage/domains/cpp.html
423*61c4878aSAndroid Build Coastguard Worker.. _C Domain: https://www.sphinx-doc.org/en/master/usage/domains/c.html
424*61c4878aSAndroid Build Coastguard Worker.. _Python Domain: https://www.sphinx-doc.org/en/master/usage/domains/python.html
425*61c4878aSAndroid Build Coastguard Worker
426*61c4878aSAndroid Build Coastguard Worker.. inclusive-language: enable
427*61c4878aSAndroid Build Coastguard Worker
428*61c4878aSAndroid Build Coastguard WorkerIn the Sphinx docs the reference documentation for x-ref syntax is
429*61c4878aSAndroid Build Coastguard Workerprovided in the `domain`_ docs:
430*61c4878aSAndroid Build Coastguard Worker
431*61c4878aSAndroid Build Coastguard Worker* `C++ Domain`_
432*61c4878aSAndroid Build Coastguard Worker* `C Domain`_
433*61c4878aSAndroid Build Coastguard Worker* `Python Domain`_
434*61c4878aSAndroid Build Coastguard Worker
435*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-embedded-rest:
436*61c4878aSAndroid Build Coastguard Worker
437*61c4878aSAndroid Build Coastguard WorkerEmbedded reStructuredText
438*61c4878aSAndroid Build Coastguard Worker=========================
439*61c4878aSAndroid Build Coastguard WorkerTo use reStructuredText (reST) within a Doxygen comment, wrap the reST
440*61c4878aSAndroid Build Coastguard Workerin ``@rst`` and ``@endrst``.
441*61c4878aSAndroid Build Coastguard Worker
442*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-breathe:
443*61c4878aSAndroid Build Coastguard Worker
444*61c4878aSAndroid Build Coastguard Worker-------
445*61c4878aSAndroid Build Coastguard WorkerBreathe
446*61c4878aSAndroid Build Coastguard Worker-------
447*61c4878aSAndroid Build Coastguard Worker.. _Breathe: https://breathe.readthedocs.io
448*61c4878aSAndroid Build Coastguard Worker
449*61c4878aSAndroid Build Coastguard WorkerThis section provides guidance on how `Breathe`_ should and shouldn't be used
450*61c4878aSAndroid Build Coastguard Workerwhen authoring ``pigweed.dev`` docs.
451*61c4878aSAndroid Build Coastguard Worker
452*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-breathe-overview:
453*61c4878aSAndroid Build Coastguard Worker
454*61c4878aSAndroid Build Coastguard WorkerOverview
455*61c4878aSAndroid Build Coastguard Worker========
456*61c4878aSAndroid Build Coastguard Worker.. inclusive-language: disable
457*61c4878aSAndroid Build Coastguard Worker
458*61c4878aSAndroid Build Coastguard Worker.. _Breathe directives: https://breathe.readthedocs.io/en/latest/directives.html
459*61c4878aSAndroid Build Coastguard Worker.. _Sphinx: https://www.sphinx-doc.org/en/master/
460*61c4878aSAndroid Build Coastguard Worker
461*61c4878aSAndroid Build Coastguard Worker.. inclusive-language: enable
462*61c4878aSAndroid Build Coastguard Worker
463*61c4878aSAndroid Build Coastguard WorkerAfter you annotate your header comments as Doxygen comments, you need to
464*61c4878aSAndroid Build Coastguard Workerspecify where to render the API reference within the ``pigweed.dev`` docs.
465*61c4878aSAndroid Build Coastguard WorkerThe reStructuredText files distributed across the main Pigweed repo are
466*61c4878aSAndroid Build Coastguard Workerthe source code for ``pigweed.dev``. Updating these ``.rst`` files is how
467*61c4878aSAndroid Build Coastguard Workeryou surface the API reference on ``pigweed.dev``. Doxygen doesn't natively
468*61c4878aSAndroid Build Coastguard Workerinteract with `Sphinx`_, the documentation generator that powers
469*61c4878aSAndroid Build Coastguard Worker``pigweed.dev``. `Breathe`_ is the bridge and API that enables ``pigweed.dev``
470*61c4878aSAndroid Build Coastguard Workerand Doxygen to work together.
471*61c4878aSAndroid Build Coastguard Worker
472*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-breathe-doxygenclass:
473*61c4878aSAndroid Build Coastguard Worker
474*61c4878aSAndroid Build Coastguard Workerdoxygenclass
475*61c4878aSAndroid Build Coastguard Worker============
476*61c4878aSAndroid Build Coastguard Worker.. _doxygenclass: https://breathe.readthedocs.io/en/latest/directives.html#doxygenclass
477*61c4878aSAndroid Build Coastguard Worker
478*61c4878aSAndroid Build Coastguard WorkerOK to use. `doxygenclass`_ documents a class and its members.
479*61c4878aSAndroid Build Coastguard Worker
480*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
481*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
482*61c4878aSAndroid Build Coastguard Worker
483*61c4878aSAndroid Build Coastguard Worker   .. code-block:: rst
484*61c4878aSAndroid Build Coastguard Worker
485*61c4878aSAndroid Build Coastguard Worker      .. doxygenclass:: pw::sync::BinarySemaphore
486*61c4878aSAndroid Build Coastguard Worker         :members:
487*61c4878aSAndroid Build Coastguard Worker
488*61c4878aSAndroid Build Coastguard WorkerClasses that are a major part of a Pigweed module's API should have their
489*61c4878aSAndroid Build Coastguard Workerown section so that they're easy to find in the right-side page nav on
490*61c4878aSAndroid Build Coastguard Worker``pigweed.dev``.
491*61c4878aSAndroid Build Coastguard Worker
492*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
493*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
494*61c4878aSAndroid Build Coastguard Worker
495*61c4878aSAndroid Build Coastguard Worker   .. code-block:: rst
496*61c4878aSAndroid Build Coastguard Worker
497*61c4878aSAndroid Build Coastguard Worker      .. _module-pw_<name>-reference:
498*61c4878aSAndroid Build Coastguard Worker
499*61c4878aSAndroid Build Coastguard Worker      =========
500*61c4878aSAndroid Build Coastguard Worker      Reference
501*61c4878aSAndroid Build Coastguard Worker      =========
502*61c4878aSAndroid Build Coastguard Worker      .. pigweed-module-subpage::
503*61c4878aSAndroid Build Coastguard Worker         :name: pw_<name>
504*61c4878aSAndroid Build Coastguard Worker
505*61c4878aSAndroid Build Coastguard Worker      ...
506*61c4878aSAndroid Build Coastguard Worker
507*61c4878aSAndroid Build Coastguard Worker      .. _module-pw_<name>-reference-<class>:
508*61c4878aSAndroid Build Coastguard Worker
509*61c4878aSAndroid Build Coastguard Worker      -------------------
510*61c4878aSAndroid Build Coastguard Worker      pw::<name>::<class>
511*61c4878aSAndroid Build Coastguard Worker      -------------------
512*61c4878aSAndroid Build Coastguard Worker      .. doxygenclass:: pw::<name>::<class>
513*61c4878aSAndroid Build Coastguard Worker         :members:
514*61c4878aSAndroid Build Coastguard Worker
515*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-breathe-doxygenfunction:
516*61c4878aSAndroid Build Coastguard Worker
517*61c4878aSAndroid Build Coastguard Workerdoxygenfunction
518*61c4878aSAndroid Build Coastguard Worker===============
519*61c4878aSAndroid Build Coastguard Worker.. _doxygenfunction: https://breathe.readthedocs.io/en/latest/directives.html#doxygenfunction
520*61c4878aSAndroid Build Coastguard Worker
521*61c4878aSAndroid Build Coastguard WorkerOK to use. `doxygenfunction` documents a single function or method.
522*61c4878aSAndroid Build Coastguard Worker
523*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
524*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
525*61c4878aSAndroid Build Coastguard Worker
526*61c4878aSAndroid Build Coastguard Worker   .. code-block:: rst
527*61c4878aSAndroid Build Coastguard Worker
528*61c4878aSAndroid Build Coastguard Worker      .. doxygenfunction:: pw::tokenizer::EncodeArgs
529*61c4878aSAndroid Build Coastguard Worker
530*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-breathe-doxygendefine:
531*61c4878aSAndroid Build Coastguard Worker
532*61c4878aSAndroid Build Coastguard Workerdoxygendefine
533*61c4878aSAndroid Build Coastguard Worker=============
534*61c4878aSAndroid Build Coastguard Worker.. _doxygendefine: https://breathe.readthedocs.io/en/latest/directives.html#doxygendefine
535*61c4878aSAndroid Build Coastguard Worker
536*61c4878aSAndroid Build Coastguard WorkerOK to use. `doxygendefine`_ documents a preprocessor macro.
537*61c4878aSAndroid Build Coastguard Worker
538*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
539*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
540*61c4878aSAndroid Build Coastguard Worker
541*61c4878aSAndroid Build Coastguard Worker   .. code-block:: rst
542*61c4878aSAndroid Build Coastguard Worker
543*61c4878aSAndroid Build Coastguard Worker      .. doxygendefine:: PW_TOKENIZE_STRING
544*61c4878aSAndroid Build Coastguard Worker
545*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-breathe-doxygengroup:
546*61c4878aSAndroid Build Coastguard Worker
547*61c4878aSAndroid Build Coastguard Workerdoxygengroup
548*61c4878aSAndroid Build Coastguard Worker============
549*61c4878aSAndroid Build Coastguard Worker.. _doxygengroup: https://breathe.readthedocs.io/en/latest/directives.html#doxygengroup
550*61c4878aSAndroid Build Coastguard Worker
551*61c4878aSAndroid Build Coastguard Worker`doxygengroup`_ lets you manually mark a set of symbols as belonging to the same
552*61c4878aSAndroid Build Coastguard Workerconceptual group.
553*61c4878aSAndroid Build Coastguard Worker
554*61c4878aSAndroid Build Coastguard Worker``doxygengroup`` is OK to use when a simple
555*61c4878aSAndroid Build Coastguard Worker:ref:`docs-style-doxygen-breathe-doxygenclass`-based organization
556*61c4878aSAndroid Build Coastguard Workerdoesn't work well for your module.
557*61c4878aSAndroid Build Coastguard Worker
558*61c4878aSAndroid Build Coastguard Worker.. _@defgroup: https://www.doxygen.nl/manual/commands.html#cmddefgroup
559*61c4878aSAndroid Build Coastguard Worker.. _@addtogroup: https://www.doxygen.nl/manual/commands.html#cmdaddtogroup
560*61c4878aSAndroid Build Coastguard Worker.. _@ingroup: https://www.doxygen.nl/manual/commands.html#cmdingroup
561*61c4878aSAndroid Build Coastguard Worker
562*61c4878aSAndroid Build Coastguard WorkerTo create a group, annotate your Doxygen comments with `@defgroup`_,
563*61c4878aSAndroid Build Coastguard Worker`@addtogroup`_, and `@ingroup`_. You can wrap a set of contiguous comments
564*61c4878aSAndroid Build Coastguard Workerin ``@{`` and ``@}`` to indicate that they all belong to a group.
565*61c4878aSAndroid Build Coastguard Worker
566*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
567*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
568*61c4878aSAndroid Build Coastguard Worker
569*61c4878aSAndroid Build Coastguard Worker   .. code-block:: cpp
570*61c4878aSAndroid Build Coastguard Worker
571*61c4878aSAndroid Build Coastguard Worker      /// @defgroup <name> <description>
572*61c4878aSAndroid Build Coastguard Worker      /// @{
573*61c4878aSAndroid Build Coastguard Worker      /// ...
574*61c4878aSAndroid Build Coastguard Worker      /// @}
575*61c4878aSAndroid Build Coastguard Worker
576*61c4878aSAndroid Build Coastguard Worker.. _issue #772: https://github.com/breathe-doc/breathe/issues/772
577*61c4878aSAndroid Build Coastguard Worker
578*61c4878aSAndroid Build Coastguard WorkerDon't include namespaces in ``doxygengroup`` because Breathe doesn't handle
579*61c4878aSAndroid Build Coastguard Workerthem correctly. See `issue #772`_.
580*61c4878aSAndroid Build Coastguard Worker
581*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
582*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
583*61c4878aSAndroid Build Coastguard Worker
584*61c4878aSAndroid Build Coastguard Worker   .. code-block:: rst
585*61c4878aSAndroid Build Coastguard Worker
586*61c4878aSAndroid Build Coastguard Worker      .. cpp:namespace:: my_namespace
587*61c4878aSAndroid Build Coastguard Worker
588*61c4878aSAndroid Build Coastguard Worker      .. doxygengroup:: my_group
589*61c4878aSAndroid Build Coastguard Worker         :content-only:
590*61c4878aSAndroid Build Coastguard Worker         :members:
591*61c4878aSAndroid Build Coastguard Worker
592*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-breathe-doxygentypedef:
593*61c4878aSAndroid Build Coastguard Worker
594*61c4878aSAndroid Build Coastguard Workerdoxygentypedef
595*61c4878aSAndroid Build Coastguard Worker==============
596*61c4878aSAndroid Build Coastguard Worker.. _doxygentypedef: https://breathe.readthedocs.io/en/latest/directives.html#doxygentypedef
597*61c4878aSAndroid Build Coastguard Worker
598*61c4878aSAndroid Build Coastguard WorkerOK to use. `doxygentypedef`_ documents a ``typedef`` or ``using`` statement.
599*61c4878aSAndroid Build Coastguard Worker
600*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
601*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
602*61c4878aSAndroid Build Coastguard Worker
603*61c4878aSAndroid Build Coastguard Worker   .. code-block:: rst
604*61c4878aSAndroid Build Coastguard Worker
605*61c4878aSAndroid Build Coastguard Worker      .. doxygentypedef:: pw::Function
606*61c4878aSAndroid Build Coastguard Worker
607*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-breathe-doxygenfile:
608*61c4878aSAndroid Build Coastguard Worker
609*61c4878aSAndroid Build Coastguard Workerdoxygenfile
610*61c4878aSAndroid Build Coastguard Worker===========
611*61c4878aSAndroid Build Coastguard Worker.. _doxygenfile: https://breathe.readthedocs.io/en/latest/directives.html#doxygenfile
612*61c4878aSAndroid Build Coastguard Worker
613*61c4878aSAndroid Build Coastguard WorkerDon't use `doxygenfile`_. Use :ref:`docs-style-doxygen-breathe-doxygengroup`
614*61c4878aSAndroid Build Coastguard Workerinstead.
615*61c4878aSAndroid Build Coastguard Worker
616*61c4878aSAndroid Build Coastguard Worker.. _docs-style-doxygen-disabled-include:
617*61c4878aSAndroid Build Coastguard Worker
618*61c4878aSAndroid Build Coastguard Worker-----------------------------------------------
619*61c4878aSAndroid Build Coastguard WorkerDisabled auto-generated ``#include`` statements
620*61c4878aSAndroid Build Coastguard Worker-----------------------------------------------
621*61c4878aSAndroid Build Coastguard Worker.. note::
622*61c4878aSAndroid Build Coastguard Worker
623*61c4878aSAndroid Build Coastguard Worker   This is an FYI section. There's no prescriptive rule here.
624*61c4878aSAndroid Build Coastguard Worker
625*61c4878aSAndroid Build Coastguard WorkerDoxygen and Breathe have the ability to auto-generate ``#include`` statements
626*61c4878aSAndroid Build Coastguard Workerfor class references. These have been disabled because:
627*61c4878aSAndroid Build Coastguard Worker
628*61c4878aSAndroid Build Coastguard Worker* The auto-generated paths are inaccurate. E.g. the ``#include`` for
629*61c4878aSAndroid Build Coastguard Worker  ``pw::string::RandomGenerator`` was generated as ``#include <random.h>``
630*61c4878aSAndroid Build Coastguard Worker  when it should be ``#include "pw_random/random.h"``.
631*61c4878aSAndroid Build Coastguard Worker* The auto-generation is not consistent. They seem to only get generated when
632*61c4878aSAndroid Build Coastguard Worker  using the ``doxygennamespace`` directive but ``pigweed.dev`` frequently
633*61c4878aSAndroid Build Coastguard Worker  uses ``doxygenclass``, ``doxygenfunction``, etc.
634*61c4878aSAndroid Build Coastguard Worker
635*61c4878aSAndroid Build Coastguard WorkerIn the future, if it's decided that these ``#include`` statements are needed,
636*61c4878aSAndroid Build Coastguard Workerthere is a way to manually override each one. The code block below shows how
637*61c4878aSAndroid Build Coastguard Workerit's done. This approach wouldn't be great because it adds a lot of noise to
638*61c4878aSAndroid Build Coastguard Workerthe header files.
639*61c4878aSAndroid Build Coastguard Worker
640*61c4878aSAndroid Build Coastguard Worker.. code-block::
641*61c4878aSAndroid Build Coastguard Worker
642*61c4878aSAndroid Build Coastguard Worker   /// @class RandomGenerator random.h "pw_random/random.h"``
643*61c4878aSAndroid Build Coastguard Worker
644*61c4878aSAndroid Build Coastguard WorkerSee `b/295023422 <https://issues.pigweed.dev/issues/295023422>`_.
645