File: namespace.rst

package info (click to toggle)
breathe 4.36.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,224 kB
  • sloc: python: 12,703; cpp: 1,737; makefile: 523; xml: 168; sh: 54; ansic: 52
file content (257 lines) | stat: -rw-r--r-- 6,535 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257

.. _namespace-example:

doxygennamespace Directive
==========================

This directive generates the appropriate output for the contents of a
namespace.

It takes the standard ``project``, ``path``, ``outline`` and ``no-link`` options
and additionally the ``content-only``, ``desc-only``, ``members``,
``protected-members``, ``private-members`` and ``undoc-members`` options.

``content-only``
   If this flag is specified, then the directive does not output the name of the
   namespace or the namespace description and instead outputs the contents of
   the namespace. This can be useful for structuring your documentation but
   leaving out the namespace declaration itself which is often undocumented.

``desc-only``
   If specified, only the description and name of the namespace will be
   displayed.

``members``
   If specified, the public members of any classes in the namespace output will be
   displayed. Unlike the ``doxygenclass`` ``members`` option, this does not
   optionally take a list of member names to display as this will be applied
   across multiple classes within the namespace.

``protected-members``
   If specified, the protected members of any classes in the namespace output will
   be displayed.

``private-members``
   If specified, the private members of any classes in the namespace output will be
   displayed.

``undoc-members``
   If specified, the undocumented members of any classes in the namespace output
   will be displayed provided the appropriate ``members`` or ``private-members``
   options are specified as well.

If you would like to always specify some combination of ``members``,
``protected-members``, ``private-members`` and ``undoc-members`` then you can
use the :ref:`breathe_default_members <breathe-default-members>` configuration
variable to set it in the ``conf.py``.



Basic Example
-------------

.. cpp:namespace:: @ex_namespace_basic

The plain ``doxygennamespace`` directive will output the namespace name and
description and any top level publicly visible members of the namespace.

.. code-block:: rst

   .. doxygennamespace:: foo
      :project: namespace

It produces this output:

.. doxygennamespace:: foo
   :project: namespace

Content-Only Example
--------------------

.. cpp:namespace:: @ex_namespace_content_only

The ``content-only`` option changes the output to only include the content of
the namespace and not the namespace name or description. So this:

.. code-block:: rst

   .. doxygennamespace:: foo
      :project: namespace
      :content-only:

Produces this output:

.. doxygennamespace:: foo
   :project: namespace
   :content-only:
   :no-link:

.. note::

   As you can see from the output, section headings like 'Functions' are missing
   from the ``:content-only:`` display. This is due to an implementation detail. Open
   an issue on github if you'd like it addressed.


Members Example
---------------

.. cpp:namespace:: @ex_namespace_members

The ``members`` option changes the output to include the public members of any
classes. The output for any class in the namespace should be the same as if it had
be produced by the :ref:`doxygenclass directive <class-example>` with the
``members`` option specified.

.. code-block:: rst

   .. doxygennamespace:: foo
      :project: namespace
      :members:

It produces this output:

.. doxygennamespace:: foo
   :project: namespace
   :members:
   :no-link:


Protected Members Example
-------------------------

.. cpp:namespace:: @ex_namespace_members_protected

The ``protected-members`` option changes the output to include the protected
members of any classes. The output for any class in the namespace should be the same
as if it had be produced by the :ref:`doxygenclass directive <class-example>`
with the ``protected-members`` option specified.

.. code-block:: rst

   .. doxygennamespace:: foo
      :project: namespace
      :protected-members:

It produces this output:

.. doxygennamespace:: foo
   :project: namespace
   :protected-members:
   :no-link:


Private-Members Example
-----------------------

.. cpp:namespace:: @ex_namespace_members_private

The ``private-members`` option changes the output to include the private members
of any classes. The output for any class in the namespace should be the same as if
it had be produced by the :ref:`doxygenclass directive <class-example>` with the
``private-members`` option specified.

.. code-block:: rst

   .. doxygennamespace:: foo
      :project: namespace
      :private-members:

Produces this output:

.. doxygennamespace:: foo
   :project: namespace
   :private-members:
   :no-link:

Undocumented Members Example
----------------------------

.. cpp:namespace:: @ex_namespace_members_undocumented

The ``undoc-members`` option changes the output to include any undocumentated
members from the sections (public, protected, private) that are being displayed
for the classes in the namespace output.

.. code-block:: rst

   .. doxygennamespace:: foo
      :project: namespace
      :private-members:
      :undoc-members:

Produces this output:

.. doxygennamespace:: foo
   :project: namespace
   :private-members:
   :undoc-members:
   :no-link:

.. note::

   Undocumented classes are still not shown in the output due to an
   implementation issue. Please post an issue on github if you would like this
   resolved.


Outline Example
---------------

.. cpp:namespace:: @ex_namespace_outline

This displays only the names of the members of the namespace and not their
documentation. The other options determine which members are displayed.

.. code-block:: rst

   .. doxygennamespace:: foo
      :project: namespace
      :members:
      :outline:

It produces this output:

.. doxygennamespace:: foo
   :project: namespace
   :members:
   :outline:
   :no-link:


Nested Example
--------------

.. cpp:namespace:: @ex_namespace_nested

The referenced namespace can be nested in another namespace.

.. code-block:: rst

   .. doxygennamespace:: foo::ns
      :project: namespace

Produces this output:

.. doxygennamespace:: foo::ns
   :project: namespace
   :no-link:

Failing Example
---------------

.. cpp:namespace:: @ex_namespace_failing

This intentionally fails:

.. code-block:: rst

   .. doxygennamespace:: madeupnamespace
      :project: namespace

It produces the following warning message:

.. warning::
   doxygennamespace: Cannot find namespace “madeupnamespace” in
   doxygen xml output for project “namespace” from directory:
   ../../examples/specific/namespacefile/xml/