Debian Codegraph @

documentation/source/namespace.rst

raw
1
2 .. _namespace-example:
3
4 doxygennamespace Directive
5 ==========================
6
7 This directive generates the appropriate output for the contents of a
8 namespace.
9
10 It takes the standard ``project``, ``path``, ``outline`` and ``no-link`` options
11 and additionally the ``content-only``, ``desc-only``, ``members``,
12 ``protected-members``, ``private-members`` and ``undoc-members`` options.
13
14 ``content-only``
15 If this flag is specified, then the directive does not output the name of the
16 namespace or the namespace description and instead outputs the contents of
17 the namespace. This can be useful for structuring your documentation but
18 leaving out the namespace declaration itself which is often undocumented.
19
20 ``desc-only``
21 If specified, only the description and name of the namespace will be
22 displayed.
23
24 ``members``
25 If specified, the public members of any classes in the namespace output will be
26 displayed. Unlike the ``doxygenclass`` ``members`` option, this does not
27 optionally take a list of member names to display as this will be applied
28 across multiple classes within the namespace.
29
30 ``protected-members``
31 If specified, the protected members of any classes in the namespace output will
32 be displayed.
33
34 ``private-members``
35 If specified, the private members of any classes in the namespace output will be
36 displayed.
37
38 ``undoc-members``
39 If specified, the undocumented members of any classes in the namespace output
40 will be displayed provided the appropriate ``members`` or ``private-members``
41 options are specified as well.
42
43 If you would like to always specify some combination of ``members``,
44 ``protected-members``, ``private-members`` and ``undoc-members`` then you can
45 use the :ref:`breathe_default_members <breathe-default-members>` configuration
46 variable to set it in the ``conf.py``.
47
48
49
50 Basic Example
51 -------------
52
53 .. cpp:namespace:: @ex_namespace_basic
54
55 The plain ``doxygennamespace`` directive will output the namespace name and
56 description and any top level publicly visible members of the namespace.
57
58 .. code-block:: rst
59
60 .. doxygennamespace:: foo
61 :project: namespace
62
63 It produces this output:
64
65 .. doxygennamespace:: foo
66 :project: namespace
67
68 Content-Only Example
69 --------------------
70
71 .. cpp:namespace:: @ex_namespace_content_only
72
73 The ``content-only`` option changes the output to only include the content of
74 the namespace and not the namespace name or description. So this:
75
76 .. code-block:: rst
77
78 .. doxygennamespace:: foo
79 :project: namespace
80 :content-only:
81
82 Produces this output:
83
84 .. doxygennamespace:: foo
85 :project: namespace
86 :content-only:
87 :no-link:
88
89 .. note::
90
91 As you can see from the output, section headings like 'Functions' are missing
92 from the ``:content-only:`` display. This is due to an implementation detail. Open
93 an issue on github if you'd like it addressed.
94
95
96 Members Example
97 ---------------
98
99 .. cpp:namespace:: @ex_namespace_members
100
101 The ``members`` option changes the output to include the public members of any
102 classes. The output for any class in the namespace should be the same as if it had
103 be produced by the :ref:`doxygenclass directive <class-example>` with the
104 ``members`` option specified.
105
106 .. code-block:: rst
107
108 .. doxygennamespace:: foo
109 :project: namespace
110 :members:
111
112 It produces this output:
113
114 .. doxygennamespace:: foo
115 :project: namespace
116 :members:
117 :no-link:
118
119
120 Protected Members Example
121 -------------------------
122
123 .. cpp:namespace:: @ex_namespace_members_protected
124
125 The ``protected-members`` option changes the output to include the protected
126 members of any classes. The output for any class in the namespace should be the same
127 as if it had be produced by the :ref:`doxygenclass directive <class-example>`
128 with the ``protected-members`` option specified.
129
130 .. code-block:: rst
131
132 .. doxygennamespace:: foo
133 :project: namespace
134 :protected-members:
135
136 It produces this output:
137
138 .. doxygennamespace:: foo
139 :project: namespace
140 :protected-members:
141 :no-link:
142
143
144 Private-Members Example
145 -----------------------
146
147 .. cpp:namespace:: @ex_namespace_members_private
148
149 The ``private-members`` option changes the output to include the private members
150 of any classes. The output for any class in the namespace should be the same as if
151 it had be produced by the :ref:`doxygenclass directive <class-example>` with the
152 ``private-members`` option specified.
153
154 .. code-block:: rst
155
156 .. doxygennamespace:: foo
157 :project: namespace
158 :private-members:
159
160 Produces this output:
161
162 .. doxygennamespace:: foo
163 :project: namespace
164 :private-members:
165 :no-link:
166
167 Undocumented Members Example
168 ----------------------------
169
170 .. cpp:namespace:: @ex_namespace_members_undocumented
171
172 The ``undoc-members`` option changes the output to include any undocumentated
173 members from the sections (public, protected, private) that are being displayed
174 for the classes in the namespace output.
175
176 .. code-block:: rst
177
178 .. doxygennamespace:: foo
179 :project: namespace
180 :private-members:
181 :undoc-members:
182
183 Produces this output:
184
185 .. doxygennamespace:: foo
186 :project: namespace
187 :private-members:
188 :undoc-members:
189 :no-link:
190
191 .. note::
192
193 Undocumented classes are still not shown in the output due to an
194 implementation issue. Please post an issue on github if you would like this
195 resolved.
196
197
198 Outline Example
199 ---------------
200
201 .. cpp:namespace:: @ex_namespace_outline
202
203 This displays only the names of the members of the namespace and not their
204 documentation. The other options determine which members are displayed.
205
206 .. code-block:: rst
207
208 .. doxygennamespace:: foo
209 :project: namespace
210 :members:
211 :outline:
212
213 It produces this output:
214
215 .. doxygennamespace:: foo
216 :project: namespace
217 :members:
218 :outline:
219 :no-link:
220
221
222 Nested Example
223 --------------
224
225 .. cpp:namespace:: @ex_namespace_nested
226
227 The referenced namespace can be nested in another namespace.
228
229 .. code-block:: rst
230
231 .. doxygennamespace:: foo::ns
232 :project: namespace
233
234 Produces this output:
235
236 .. doxygennamespace:: foo::ns
237 :project: namespace
238 :no-link:
239
240 Failing Example
241 ---------------
242
243 .. cpp:namespace:: @ex_namespace_failing
244
245 This intentionally fails:
246
247 .. code-block:: rst
248
249 .. doxygennamespace:: madeupnamespace
250 :project: namespace
251
252 It produces the following warning message:
253
254 .. warning::
255 doxygennamespace: Cannot find namespace “madeupnamespace” in
256 doxygen xml output for project “namespace” from directory:
257 ../../examples/specific/namespacefile/xml/