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