Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
inclusionstrategy.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2025 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\headerfile inclusionflags.h
6
\title Inclusion Strategy Components
7
\inmodule QDoc
8
\brief Defines types for controlling documentation inclusion of private and internal API elements.
9
10
The inclusion strategy system provides a centralized way to determine which
11
documentation nodes should be included in generated output. It consists of
12
three main components that work together to implement inclusion decisions:
13
14
\list
15
\li \l{InclusionFlag} and \l{InclusionFlags} - Flags representing different types of private API
16
\li \l{InclusionPolicy} - Configuration-driven policy for what to include
17
\li \l{NodeContext} - Lightweight node state capture for policy evaluation
18
\endlist
19
20
This system replaces scattered inclusion checks throughout QDoc with a
21
unified approach, ensuring consistent behavior across all output generators.
22
*/
23
24
/*!
25
\enum InclusionFlag
26
\headerfile inclusionflags.h
27
\inmodule QDoc
28
\brief Flags for different categories of private API elements.
29
30
These flags represent different types of private API elements that can be
31
selectively included in documentation based on configuration settings.
32
33
\value PrivateFunction
34
Private functions and methods. Corresponds to the
35
\c{includeprivate.functions} configuration option, or if unset,
36
to the general \c{includeprivate} option.
37
38
\value PrivateType
39
Private types including classes, enums, and typedefs. Corresponds to
40
the \c{includeprivate.types} configuration option, or if unset,
41
to the general \c{includeprivate} option.
42
43
\value PrivateVariable
44
Private member variables and properties. Corresponds to the
45
\c{includeprivate.variables} configuration option, or if unset,
46
to the general \c{includeprivate} option.
47
48
\value Internal
49
Internal API elements explicitly marked with \\internal.
50
Corresponds to the \c{showinternal} configuration option and command
51
line flag, together with \c InternalAuto.
52
53
\value InternalAuto
54
API elements that QDoc has automatically determined to be internal.
55
Like \c Internal, corresponds to the \c{showinternal} configuration
56
option/command line flag.
57
58
\sa InclusionFlags, InclusionPolicy
59
*/
60
61
/*!
62
\typedef InclusionFlags
63
\relates InclusionFlag
64
\headerfile inclusionflags.h
65
\inmodule QDoc
66
67
QFlags type for combining multiple InclusionFlag values.
68
*/
69
70
/*!
71
\struct InclusionPolicy
72
\headerfile inclusionpolicy.h
73
\inmodule QDoc
74
\brief Configuration-driven policy for including private API in documentation.
75
76
InclusionPolicy captures the current configuration settings for private API
77
documentation. It is constructed from QDoc's configuration variables and
78
provides a consistent interface for inclusion decisions.
79
80
The policy is typically created once per documentation run from the current
81
configuration and passed to InclusionFilter for making inclusion decisions.
82
83
\sa Config::createInclusionPolicy(), InclusionFilter
84
*/
85
86
/*!
87
\variable InclusionPolicy::includePrivateFunction
88
\brief Whether to include private functions in documentation.
89
90
When true, private functions and methods are included in documentation
91
output. Corresponds to the \c{includeprivate.functions} configuration
92
variable. Takes precedence over the general includePrivate setting for
93
function nodes.
94
*/
95
96
/*!
97
\variable InclusionPolicy::includePrivateType
98
\brief Whether to include private types in documentation.
99
100
When true, private classes, enums, and typedefs are included in
101
documentation output. Corresponds to the \c{includeprivate.types}
102
configuration variable. Takes precedence over the general includePrivate
103
setting for type nodes.
104
*/
105
106
/*!
107
\variable InclusionPolicy::includePrivateVariable
108
\brief Whether to include private variables in documentation.
109
110
When true, private member variables and properties are included in
111
documentation output. Corresponds to the \c{includeprivate.variables}
112
configuration variable. Takes precedence over the general includePrivate
113
setting for variable nodes.
114
*/
115
116
/*!
117
\variable InclusionPolicy::showInternal
118
\brief Whether to include internal API elements in documentation.
119
120
When true, API elements marked with \\internal comments are included in
121
documentation output. Corresponds to the \c{showinternal} configuration
122
variable and the \c{--show-internal} command line option.
123
*/
124
125
/*!
126
\fn InclusionFlags InclusionPolicy::toFlags() const
127
\brief Converts the policy settings to flags for efficient comparison.
128
129
Returns an InclusionFlags value representing which categories of private
130
API should be included based on the current policy settings.
131
*/
132
133
/*!
134
\struct NodeContext
135
\headerfile nodecontext.h
136
\inmodule QDoc
137
\brief Lightweight capture of node state for inclusion decisions.
138
139
NodeContext is a value type that captures relevant node properties once,
140
avoiding repeated type checks and casts when evaluating inclusion rules.
141
It is created from a Node via Node::createContext() and used by
142
InclusionFilter to make inclusion decisions.
143
144
The context captures:
145
\list
146
\li The node's type (function, class, variable, etc.)
147
\li Whether the node has private access
148
\li Whether the node is explicitly marked as \internal
149
\li Whether the node is automatically determined to be internal
150
\li Whether the node is a pure virtual function
151
\endlist
152
153
This approach eliminates redundant RTTI operations that were previously
154
performed at each inclusion check point.
155
156
\sa Node::createContext(), InclusionFilter
157
*/
158
159
/*!
160
\variable NodeContext::type
161
\brief The type of the documentation node.
162
163
Stores the NodeType enum value, indicating whether this is a function,
164
class, variable, or other type of documentation node.
165
*/
166
167
/*!
168
\variable NodeContext::metaness
169
\brief Stores the kind of function the node represents.
170
171
Valid if \l type is NodeType::Function, \c std::nullopt
172
otherwise.
173
*/
174
175
/*!
176
\variable NodeContext::isPrivate
177
\brief Whether the node has private access level.
178
179
True if the node represents a private member of a class or a non-public
180
API element.
181
*/
182
183
/*!
184
\variable NodeContext::isInternal
185
\brief Whether the node is explicitly marked as internal API.
186
187
True if the node is marked with \\internal documentation command,
188
indicating it's internal API not intended for public consumption.
189
*/
190
191
/*!
192
\variable NodeContext::isInternalAuto
193
\brief Whether the node is automatically determined to be internal.
194
195
True if the node is automatically marked as internal, for example,
196
because it is undocumented.
197
*/
198
199
/*!
200
\variable NodeContext::isPureVirtual
201
\brief Whether the node is a pure virtual function.
202
203
Pure virtual functions require special handling as they must always be
204
documented when included, since derived classes must implement them.
205
*/
206
207
/*!
208
\fn InclusionFlags NodeContext::toFlags() const
209
\brief Converts node properties to flags for policy matching.
210
211
Returns an InclusionFlags value representing the categories this node
212
belongs to. For non-private nodes, returns an empty flag set. For
213
private nodes, returns flags indicating what specific type of
214
private element it is (function, type, or variable).
215
*/
216
217
/*!
218
\class InclusionFilter
219
\headerfile inclusionfilter.h
220
\inmodule QDoc
221
\brief Centralized logic for documentation inclusion decisions.
222
223
InclusionFilter provides static methods that implement the logic for
224
determining whether a documentation node should be included in output
225
or whether warnings should be generated for undocumented nodes.
226
227
All inclusion decisions flow through this class, ensuring consistent
228
behavior across different output generators and eliminating duplicate
229
logic that was previously scattered throughout QDoc.
230
231
\sa InclusionPolicy, NodeContext
232
*/
233
234
/*!
235
\fn bool InclusionFilter::isIncluded(const InclusionPolicy& policy, const NodeContext& context)
236
\brief Determines if a node should be included in documentation output.
237
238
Returns true if the node described by \a context should be included
239
in documentation according to the given \a policy.
240
241
The method handles several special cases:
242
\list
243
\li Internal nodes are only included when showInternal policy is enabled
244
\li Non-private nodes are always included (unless internal and showInternal is false)
245
\li Pure virtual functions are always included (even if private, unless internal and showInternal is false)
246
\li Private nodes are included based on policy flags
247
\endlist
248
*/
249
250
/*!
251
\fn bool InclusionFilter::requiresDocumentation(const InclusionPolicy& policy, const NodeContext& context)
252
\brief Determines if warnings should be generated for undocumented nodes.
253
254
Returns true if QDoc should warn about the node described by \a context
255
being undocumented, according to the given \a policy.
256
257
Generally follows the same rules as isIncluded(), but is used specifically
258
for determining when to generate warnings about missing documentation.
259
*/
260
261
/*!
262
\fn bool InclusionFilter::isPubliclyVisible(const InclusionPolicy& policy, const NodeContext& context)
263
\brief Determines if a node should be visible in public documentation.
264
265
Returns true if the node described by \a context should be considered
266
publicly visible according to the given \a policy. This method implements
267
the business rule: "Include everything except internal nodes when
268
showInternal is disabled."
269
270
This is primarily used by index file generation and cross-referencing
271
systems that need to include private members for completeness but should
272
respect the internal visibility policy.
273
274
Unlike isIncluded(), this method only checks internal status and ignores
275
private member inclusion policies, making it suitable for systems that
276
need to preserve private API information for cross-referencing while
277
still respecting internal API visibility rules.
278
279
\sa isIncluded(), processInternalDocs()
280
*/
281
282
/*!
283
\fn bool InclusionFilter::processInternalDocs(const InclusionPolicy& policy)
284
\brief Determines if internal documentation should be processed.
285
286
Returns true if the given \a policy indicates that internal documentation
287
should be processed. This method implements the business rule: "Process
288
internal documentation only when showInternal is enabled."
289
290
This method is used by parsers, warning systems, and other components
291
that need to make decisions based solely on the internal documentation
292
policy without requiring a specific node context.
293
294
\sa isPubliclyVisible(), isIncluded()
295
*/
296
297
/*!
298
\fn bool InclusionFilter::isReimplementedMemberVisible(const InclusionPolicy& policy, const NodeContext& context)
299
\brief Determines if a reimplemented member should appear in documentation.
300
301
Returns true if the reimplemented member described by \a context should be
302
documented according to the given \a policy. This method implements the
303
business rule: "Reimplemented members are documented based on their access
304
level in the derived class, not their internal status."
305
306
This is specifically used for populating "Reimplemented Functions" sections,
307
where the fact that a function overrides a base class method is architectural
308
information that should be visible regardless of whether the implementation
309
details are marked as internal.
310
311
Unlike isIncluded(), this method treats internal status as orthogonal to
312
reimplementation visibility - a public override of an internal base class
313
function should still appear in the reimplemented functions list.
314
315
The method handles several cases:
316
\list
317
\li Public and protected reimplemented members are always visible
318
\li Pure virtual reimplemented members are always visible (even if private)
319
\li Private reimplemented members follow private inclusion policies
320
\li Internal status is explicitly ignored for reimplemented member visibility
321
\endlist
322
323
\sa isIncluded(), isPubliclyVisible(), requiresDocumentation()
324
*/
qttools
src
qdoc
qdoc
src
qdoc
inclusionstrategy.qdoc
Generated on
for Qt by
1.16.1