Debian Codegraph @

documentation/source/directives.rst

raw
1 Directives & Config Variables
2 =============================
3
4 .. toctree::
5 :hidden:
6
7 autoindex
8 function
9 struct
10 class
11 namespace
12 concept
13 enum
14 enumvalue
15 typedef
16 union
17 define
18 variable
19 file
20 group
21 autofile
22 page
23
24
25 Directives
26 ----------
27
28 The available directives are shown below. In each case the ``project``,
29 ``path``, ``no-link`` and ``outline`` options have the following meaning:
30
31 ``project``
32 Specifies which project, as defined in the ``breathe_projects`` config value,
33 should be used for this directive. This overrides the default project if one
34 has been specified.
35
36 This is not used by the `autodoxygenindex`_ directive. Use ``source``
37 instead to specify the entry in the :confval:`breathe_projects_source` config value
38 to use.
39
40 ``path``
41 Directly specifies the path to the folder with the doxygen output. This
42 overrides the project and default project if they have been specified.
43
44 This is not used by the `autodoxygenindex`_ directive. Use ``source-path``
45 instead to specify the root path to the sources files which are to be
46 processed.
47
48 ``no-link``
49 Instructs Breathe to not attempt to generate any document targets for the
50 content generated by this particular directive.
51
52 This allows you to have your main reference listings somewhere with
53 targets, but then to be able to sneak in repeat directives into other
54 parts of the documentation to illustrate particular points without
55 Sphinx getting confused what should be linked to by other references.
56
57 ``outline``
58 Results in Breathe only outputting the raw code definitions without
59 any additional description information.
60
61 If neither project nor path are provided on the directive then breathe will
62 expect the :ref:`breathe_default_project <default_project>` config value to be
63 set.
64
65
66 .. _doxygenclass:
67
68 doxygenclass
69 ~~~~~~~~~~~~
70
71 This directive generates the appropriate output for a single class. It takes the
72 standard ``project``, ``path``, ``outline`` and ``no-link`` options and
73 additionally the ``members``, ``protected-members``, ``private-members``,
74 ``undoc-members``, ``membergroups`` and ``members-only`` options
75
76 .. code-block:: rst
77
78 .. doxygenclass:: <class name>
79 :project: ...
80 :path: ...
81 :members: [...]
82 :protected-members:
83 :private-members:
84 :undoc-members:
85 :membergroups: ...
86 :members-only:
87 :outline:
88 :no-link:
89 :allow-dot-graphs:
90
91 Checkout the :ref:`doxygenclass documentation <class-example>` for more details
92 and to see it in action.
93
94 .. _doxygendefine:
95
96 doxygendefine
97 ~~~~~~~~~~~~~
98
99 This directive generates the appropriate output for a single preprocessor
100 define. It behaves the same as the `doxygenstruct`_ directive.
101
102 .. code-block:: rst
103
104 .. doxygendefine:: <define name>
105 :project: ...
106 :path: ...
107 :outline:
108 :no-link:
109
110 Checkout the :ref:`example <define-example>` to see it in action.
111
112 .. _doxygenconcept:
113
114 doxygenconcept
115 ~~~~~~~~~~~~~~
116
117 This directive generates the appropriate output for a single concept. It
118 behaves the same as the `doxygenstruct`_ directive.
119
120 .. code-block:: rst
121
122 .. doxygenconcept:: <concept name>
123 :project: ...
124 :path: ...
125 :outline:
126 :no-link:
127
128 Checkout the :ref:`example <concept-example>` to see it in action.
129
130 .. _doxygenenum:
131
132 doxygenenum
133 ~~~~~~~~~~~
134
135 This directive generates the appropriate output for a single enum. It behaves
136 the same as the `doxygenstruct`_ directive.
137
138 .. code-block:: rst
139
140 .. doxygenenum:: <enum name>
141 :project: ...
142 :path: ...
143 :outline:
144 :no-link:
145
146 Checkout the :ref:`example <enum-example>` to see it in action.
147
148 .. _doxygenenumvalue:
149
150 doxygenenumvalue
151 ~~~~~~~~~~~~~~~~
152
153 This directive generates the appropriate output for a single enum value.
154
155 .. code-block:: rst
156
157 .. doxygenenumvalue:: <enum value name>
158 :project: ...
159 :path: ...
160 :outline:
161 :no-link:
162
163 Checkout the :ref:`example <enumvalue-example>` to see it in action.
164
165 .. _doxygenfile:
166
167 doxygenfile
168 ~~~~~~~~~~~
169
170 This directive generates the appropriate output for the contents of a source
171 file.
172
173 .. code-block:: rst
174
175 .. doxygenfile:: <filename>
176 :project: ...
177 :path: ...
178 :outline:
179 :no-link:
180 :sections: ...
181 :allow-dot-graphs:
182
183 Checkout the :ref:`example <file-example>` to see it in action.
184
185 .. _autodoxygenfile:
186
187 autodoxygenfile
188 ~~~~~~~~~~~~~~~
189
190 This directive is this ``auto`` version of the `doxygenfile`_ directive above.
191 It handles the doxygen xml generation for you like the other auto directives.
192
193 .. code-block:: rst
194
195 .. autodoxygenfile:: <filename>
196 :project: ...
197 :outline:
198 :no-link:
199 :sections: ...
200 :allow-dot-graphs:
201
202 Checkout the :ref:`example <autodoxygenfile-example>` to see it in action.
203
204 .. _doxygenfunction:
205
206 doxygenfunction
207 ~~~~~~~~~~~~~~~
208
209 This directive generates the appropriate output for a single function. The
210 function name is required to be unique in the project.
211
212 .. code-block:: rst
213
214 .. doxygenfunction:: <function name>
215 :project: ...
216 :path: ...
217 :outline:
218 :no-link:
219
220 Checkout the :ref:`example <function-example>` to see it in action.
221
222 .. _doxygengroup:
223
224 doxygengroup
225 ~~~~~~~~~~~~
226
227 This directive generates the appropriate output for the contents of a doxygen
228 group. A doxygen group can be declared with specific doxygen markup in the
229 source comments as covered in the `doxygen grouping documentation`_.
230
231 It takes the standard ``project``, ``path``, ``outline`` and ``no-link`` options
232 and additionally the ``content-only``, ``desc-only``, ``members``,
233 ``protected-members``, ``private-members`` and ``undoc-members`` options.
234
235 .. code-block:: rst
236
237 .. doxygengroup:: <group name>
238 :project: ...
239 :path: ...
240 :content-only:
241 :desc-only:
242 :outline:
243 :members:
244 :protected-members:
245 :private-members:
246 :undoc-members:
247 :no-link:
248 :inner:
249
250 Checkout the :ref:`doxygengroup documentation <group-example>` for more details
251 and to see it in action.
252
253 .. _doxygen grouping documentation: https://www.doxygen.nl/manual/grouping.html
254
255
256 .. _doxygenindex:
257
258 doxygenindex
259 ~~~~~~~~~~~~
260
261 This directive processes and produces output for everything described by the
262 Doxygen xml output. It reads the ``index.xml`` file and process everything
263 referenced by it.
264
265 .. code-block:: rst
266
267 .. doxygenindex::
268 :project: ...
269 :path: ...
270 :outline:
271 :no-link:
272 :allow-dot-graphs:
273
274 .. _autodoxygenindex:
275
276 autodoxygenindex
277 ~~~~~~~~~~~~~~~~
278
279 This directive performs a similar role to the `doxygenindex`_ directive except
280 that it handles the doxygen xml generation for you. It uses the
281 :confval:`breathe_projects_source` configuration dictionary to judge which code source
282 files should have doxygen xml generated for them. The ``project`` directive
283 option associates the directive with a particular project in the
284 :confval:`breathe_projects_source` dictionary. All the files references by the entry in
285 the :confval:`breathe_projects_source` will be included in the output. In addition, any
286 options specified in :confval:`breathe_doxygen_config_options` will be added to the
287 generated Doxygen config file and any custom aliases specified in
288 :confval:`breathe_doxygen_aliases` will be added to the `doxygen aliases
289 <https://www.doxygen.nl/manual/custcmd.html>`_.
290
291 Thank you to `Scopatz <https://github.com/scopatz>`_ for the idea and initial
292 implementation.
293
294 .. code-block:: rst
295
296 .. autodoxygenindex::
297 :project: ...
298 :outline:
299 :no-link:
300 :allow-dot-graphs:
301
302 Checkout the :ref:`example <autodoxygenindex-example>` to see it in action.
303
304 .. _doxygennamespace:
305
306 doxygennamespace
307 ~~~~~~~~~~~~~~~~
308
309 This directive generates the appropriate output for the contents of a namespace.
310
311 It takes the standard ``project``, ``path``, ``outline`` and ``no-link`` options
312 and additionally the ``content-only``, ``desc-only``, ``members``,
313 ``protected-members``, ``private-members`` and ``undoc-members`` options.
314
315 To reference a nested namespace, the full namespaced path must be provided, e.g.
316 ``foo::bar`` for the ``bar`` namespace inside the ``foo`` namespace.
317
318 .. code-block:: rst
319
320 .. doxygennamespace:: <namespace>
321 :project: ...
322 :path: ...
323 :content-only:
324 :desc-only:
325 :outline:
326 :members:
327 :protected-members:
328 :private-members:
329 :undoc-members:
330 :no-link:
331
332 Checkout the :ref:`doxygennamespace documentation <namespace-example>` for more
333 details and to see it in action.
334
335 .. _doxygenstruct:
336
337 doxygenstruct
338 ~~~~~~~~~~~~~
339
340 This directive generates the appropriate output for a single struct. The struct
341 name is required to be unique in the project.
342
343 It takes the standard ``project``, ``path``, ``outline`` and ``no-link`` options
344 and additionally the ``members``, ``protected-members``, ``private-members``,
345 ``membergroups``, ``members-only`` and ``undoc-members`` options.
346
347 .. code-block:: rst
348
349 .. doxygenstruct:: <struct name>
350 :project: ...
351 :path: ...
352 :members:
353 :protected-members:
354 :private-members:
355 :undoc-members:
356 :membergroups: ...
357 :members-only:
358 :outline:
359 :no-link:
360 :allow-dot-graphs:
361
362 Checkout the :ref:`example <struct-example>` to see it in action.
363
364 .. _doxygeninterface:
365
366 doxygeninterface
367 ~~~~~~~~~~~~~~~~
368
369 This directive generates the appropriate output for a single interface (specially-used
370 class). It behaves the same as the `doxygenclass`_ directive.
371
372 .. code-block:: rst
373
374 .. doxygeninterface:: <interface name>
375 :project: ...
376 :path: ...
377 :members:
378 :protected-members:
379 :private-members:
380 :undoc-members:
381 :membergroups: ...
382 :members-only:
383 :outline:
384 :no-link:
385
386 .. _doxygentypedef:
387
388 doxygentypedef
389 ~~~~~~~~~~~~~~
390
391 This directive generates the appropriate output for a single typedef. It behaves
392 the same as the doxygenstruct directive.
393
394 .. code-block:: rst
395
396 .. doxygentypedef:: <typedef name>
397 :project: ...
398 :path: ...
399 :outline:
400 :no-link:
401
402 Checkout the :ref:`example <typedef-example>` to see it in action.
403
404 .. _doxygenunion:
405
406 doxygenunion
407 ~~~~~~~~~~~~
408
409 This directive generates the appropriate output for a single union. It behaves
410 the same as the doxygenstruct directive.
411
412 .. code-block:: rst
413
414 .. doxygenunion:: <union name>
415 :project: ...
416 :path: ...
417 :outline:
418 :no-link:
419
420 Checkout the :ref:`example <union-example>` to see it in action.
421
422 .. _doxygenvariable:
423
424 doxygenvariable
425 ~~~~~~~~~~~~~~~
426
427 This directive generates the appropriate output for a single variable.
428 It behaves the same as the doxygenstruct directive.
429
430 .. code-block:: rst
431
432 .. doxygenvariable:: <variable name>
433 :project: ...
434 :path: ...
435 :outline:
436 :no-link:
437
438 Checkout the :ref:`example <variable-example>` to see it in action.
439
440 .. _doxygenpage:
441
442 doxygenpage
443 ~~~~~~~~~~~
444
445 This directive generates the appropriate output for the contents of a doxygen
446 page. A doxygen page is created for each "key" of every \\xrefitem command used
447 for markup in the source comments. For more information check the
448 `doxygen xrefitem documentation`_.
449
450 It takes the standard ``project`` and ``path`` options and additionally the
451 ``content-only`` option.
452
453 .. code-block:: rst
454
455 .. doxygenpage:: <page name>
456 :project: ...
457 :path: ...
458 :content-only:
459
460 Checkout the :ref:`doxygenpage documentation <page-example>` for more details
461 and to see it in action.
462
463 .. _doxygen xrefitem documentation: https://www.doxygen.nl/manual/commands.html#cmdxrefitem
464
465
466
467 Config Values
468 -------------
469
470 .. confval:: breathe_projects
471
472 This should be a dictionary in which the keys are project names and the values are
473 paths to the folder containing the doxygen output for that project.
474
475 .. _default_project:
476
477 .. confval:: breathe_default_project
478
479 This should match one of the keys in the :confval:`breathe_projects` dictionary and
480 indicates which project should be used when the project is not specified on
481 the directive.
482
483 .. confval:: breathe_domain_by_extension
484
485 Allows you to specify domains for particular files according to their
486 extension.
487
488 For example:
489
490 .. code-block:: python
491
492 breathe_domain_by_extension = {
493 "h" : "cpp",
494 }
495
496 You can also use this to enable support for Doxygen XML generated from PHP code:
497
498 .. code-block:: python
499
500 breathe_domain_by_extension = {
501 "php" : "php",
502 }
503
504 .. confval:: breathe_domain_by_file_pattern
505
506 Allows you to specify domains for particular files by wildcard syntax. This
507 is checked after :confval:`breathe_domain_by_extension` and so will override
508 it when necessary.
509
510 For example:
511
512 .. code-block:: python
513
514 breathe_domain_by_file_pattern = {
515 "\*/alias.h" : "c",
516 }
517
518 If you wanted all ``.h`` header files to be treated as being in the **cpp**
519 domain you might use the :confval:`breathe_domain_by_extension` example
520 above. But if you had one ``.h`` file that should be treated as being in the
521 **c** domain then you can override as above.
522
523
524 .. confval:: breathe_projects_source
525
526 A dictionary in which the keys are project names and the values are a tuple
527 of the directory and a list of file names of the source code for those
528 projects that you would like to be automatically processed with doxygen.
529 If you have some files in:
530
531 .. code-block:: text
532
533 /some/long/path/to/myproject/file.c
534 /some/long/path/to/myproject/subfolder/otherfile.c
535
536 Then you can set:
537
538 .. code-block:: python
539
540 breathe_projects_source = {
541 "myprojectsource" : (
542 "/some/long/path/to/myproject", ["file.c", "subfolder/otherfile.c"]
543 )
544 }
545
546 Then your `autodoxygenfile`_ usage can look like this:
547
548 .. code-block:: rst
549
550 .. autodoxygenfile:: file.c
551 :project: myprojectsource
552
553 The directory entry in the tuple can be an empty string if the entries in the
554 list are full paths.
555
556 .. confval:: breathe_build_directory
557
558 In order to process the `autodoxygenindex`_ Breathe has to run ``doxygen``
559 to create the xml files for processing. This config value specifies the root
560 directory that these files should be created in. By default, this is set to
561 the parent directory of the ``doctrees`` output folder which is the normal
562 build directory. You can change it with this setting if you have a custom
563 set up.
564
565 Breathe will take the final value and append ``breathe/doxygen/<project
566 name>`` to the path to minimize conflicts.
567
568 .. _breathe-default-members:
569
570 .. confval:: breathe_default_members
571
572 Provides the directive flags that should be applied to all directives which
573 take ``:members:``, ``:private-members:`` and ``:undoc-members:`` options.
574 By default, this is set to an empty list, which means no members are
575 displayed. If you'd like to always display the public and public,
576 undocumented members then you could set it like this:
577
578 .. code-block:: python
579
580 breathe_default_members = ('members', 'undoc-members')
581
582 .. _breathe-implementation-filename-extensions:
583
584 .. confval:: breathe_implementation_filename_extensions
585
586 Provides a list of the filename extensions which are considered to be
587 implementation files. These files are ignored when the `doxygenfunction`_
588 directive looks for un-namespaced function names. This is to avoid the issue
589 where the same function name appears in the doxygen XML output for a header
590 file and implementation file because the declaration is in one and the
591 definition is in the other. Doxygen appends the documentation from the
592 definition to the XML for the declaration so we don't miss any documentation
593 information from the implementation files. The default value for this
594 variable is:
595
596 .. code-block:: python
597
598 breathe_implementation_filename_extensions = ['.c', '.cc', '.cpp']
599
600 .. _breathe-doxygen-config-options:
601
602 .. confval:: breathe_doxygen_config_options
603
604 A dictionary in which the keys and values are the names and values of config
605 options to be placed in the Doxygen config file generated by
606 `autodoxygenindex`_. For instance, this:
607
608 .. code-block:: python
609
610 breathe_doxygen_config_options = {'EXCLUDE_SYMBOLS': 'abc123'}
611
612 would place ``EXCLUDE_SYMBOLS=abc123`` in the config file. The default value is
613 the empty dictionary.
614
615 .. confval:: breathe_doxygen_aliases
616
617 A dictionary in which the keys and values are the names and values of aliases
618 to be placed in the Doxygen config file generated by `autodoxygenindex`_.
619 For instance, this:
620
621 .. code-block:: python
622
623 breathe_doxygen_aliases = {
624 'rstref{1}': r'\verbatim embed:rst:inline :ref:`\1` \endverbatim'
625 }
626
627 would place the line::
628
629 ALIASES += rstref{1}="\verbatim embed:rst:inline :ref:`\1` \endverbatim"
630
631 in the config file. The default value is an empty dictionary.
632 Note the use of a raw string to ensure that backslashes are interpreted as literal characters.
633 (This example alias enables linking to rst targets inline in doxygen comments using
634 ``\rstref{<target_name>}``)
635
636 .. confval:: breathe_show_define_initializer
637
638 A boolean flag which can be set to ``True`` to display the initializer of a define in the output.
639
640 For example a define ``MAX_LENGTH 100`` would be shown with the value 100 if this is set to ``True``,
641 and without if it is set to ``False``.
642
643 .. confval:: breathe_show_enumvalue_initializer
644
645 A boolean flag which can be set to ``True`` to display the initializer of an enum value in the output.
646
647 For example an enum value ``TWO = 2`` would be shown with the value 2 if this is set to ``True``,
648 and without if it is set to ``False``.
649
650 .. confval:: breathe_show_include
651
652 A boolean flag which can be set to ``False`` to hide the header in which each
653 entity (struct, function, macro, etc.) is defined.
654
655 For example, when set to ``True`` (the default) a ``struct Foo`` is rendered
656 similarly to::
657
658 struct Foo
659 #include <foo.hpp>
660 Description of Foo.
661
662 but when set to ``False`` it is instead rendered as::
663
664 struct Foo
665 Description of Foo.
666
667 .. confval:: breathe_use_project_refids
668
669 True or False setting to control if the refids generated by breathe for doxygen
670 elements contain the project name or not. Legacy (breathe 4.6.0 and earlier)
671 behavior was that all refids are prefixed with the project name. This causes
672 trouble when trying to link documentation between multiple projects since the
673 projects can't see each other's documentation elements. The new default behavior
674 is to not prefix the refids with the project name. This::
675
676 breathe_use_project_refids = True
677
678 will restore the legacy behavior if it is needed.
679
680 .. confval:: breathe_order_parameters_first
681
682 True or False setting to control if the parameters section from doxygen generated
683 documentation should be placed immediately after the brief and detailed description
684 or at the end, after the returns, remarks and warnings section. Default value and
685 also the legacy behavior is False.
686
687 .. confval:: breathe_separate_member_pages
688
689 True or False setting to control if the input XML generated by Doxygen had the
690 Doxygen SEPARATE_MEMBER_PAGES option set to YES or NO. The Doxygen option defaults
691 to NO which generates XML that allows Breathe to resolve all references. When set
692 to YES the refid/id of elements get an extra element which Breathe tries to get rid
693 of when this setting is True.