12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
35
36
37
38
39
40
41
43 :
Node(NodeType::Function, parent, name),
45 m_implicitlyGenerated(
false),
49 m_overloadFlag(
false),
50 m_primaryOverloadFlag(
false),
56 m_explicitlyDefaulted(
false),
58 m_hiddenFriend(
false),
62 m_virtualness(NonVirtual),
69
70
71
72
73
74
75
76
77
81 m_implicitlyGenerated(
false),
85 m_overloadFlag(
false),
86 m_primaryOverloadFlag(
false),
92 m_explicitlyDefaulted(
false),
94 m_hiddenFriend(
false),
102 if (!
isCppNode() && name.startsWith(
"__"))
107
108
109
112 auto *fn =
new FunctionNode(*
this);
113 fn->setParent(
nullptr);
114 parent->addChild(fn);
119
120
121
124 switch (m_virtualness) {
126 return QLatin1String(
"virtual");
128 return QLatin1String(
"pure");
133 return QLatin1String(
"non");
137
138
139
140
141
142
145 if (value == QLatin1String(
"pure")) {
148 parent()->setAbstract(
true);
187
188
189
190
191
214 return Genus::DontCare;
218
219
220
225 return metanessMap_[value];
229
230
231
236 return topicMetanessMap_[topic];
240
241
242
248 for (
auto *property : m_associatedProperties) {
249 if (property->isInAPI())
257
258
259
260
263 m_overloadNumber = number;
264 m_overloadFlag = (number > 0);
268
269
270
271
272
273
274
277
278
279
280
283 switch (m_metaness) {
287 return "QML signal handler";
296
297
298
301 switch (m_metaness) {
309 return "constructor";
311 return "copy-constructor";
313 return "move-constructor";
317 return "macrowithparams";
319 return "macrowithoutparams";
323 return "copy-assign";
325 return "move-assign";
329 return "qmlsignalhandler";
338
339
340
341
344 m_associatedProperties.append(p);
348
349
350
351
352
353
354
355
356
357
360 if (m_associatedProperties.isEmpty())
362 if (m_associatedProperties.size() == 1)
363 return m_associatedProperties[0];
365 auto it =
std::find_if(
366 m_associatedProperties.cbegin(), m_associatedProperties.cend(),
368 return name().startsWith(p->name());
371 return it != m_associatedProperties.cend() ? *it : m_associatedProperties[0];
375
376
377
378
379
386
387
390
391
392
393
394
395
396
397
398
399
400
401
402
403
406 QStringList elements;
408 if (options & Node::SignatureTemplateParams && templateDecl())
409 elements << (*templateDecl()).to_qstring();
410 if (options & Node::SignatureReturnType)
411 elements << m_returnType.first;
412 elements.removeAll(QString());
414 if (!isMacroWithoutParams()) {
415 elements << name() + QLatin1Char(
'(')
416 + m_parameters.signature(options & Node::SignatureDefaultValues)
420 elements << QStringLiteral(
"const");
422 elements << QStringLiteral(
"&");
424 elements << QStringLiteral(
"&&");
429 return elements.join(QLatin1Char(
' '));
433
434
435
436
437
438
439
440
466 for (qsizetype i = 0; i < param_count; ++i) {
467 if (
int type_comp = QString::compare(p1.at(i).type(), p2.at(i).type());
480 return (*t1).to_std_string().compare((*t2).to_std_string());
486
487
488
489
490
491
492
493
494
495
496
497
498
502 if (name().startsWith(QLatin1String(
"qt_")) || name() == QLatin1String(
"metaObject")
503 || name() == QLatin1String(
"tr") || name() == QLatin1String(
"trUtf8")
504 || name() == QLatin1String(
"d_func")) {
508 if (s.contains(QLatin1String(
"enum_type")) && s.contains(QLatin1String(
"operator|")))
515
516
517
520
521
522
523
524
525
528 if (m_returnType.second.has_value())
529 return m_returnType.second.value();
530 return m_returnType.first;
534
535
536
539 auto it =
std::find_if_not(m_associatedProperties.begin(), m_associatedProperties.end(),
542 if (!m_associatedProperties.isEmpty() && it == m_associatedProperties.end())
This node is used to represent any kind of function being documented.
QString metanessString() const
Returns a string representing the Metaness enum value for this function.
QString kindString() const
Returns a string representing the kind of function this Function node represents, which depends on th...
FunctionNode(Metaness type, Aggregate *parent, const QString &name, bool attached=false)
Construct a function node for a QML method or signal, specified by ther Metaness value type.
const Parameters & parameters() const
bool isInAPI() const override
Extends the base implementation to test whether an associated enum is in the API.
bool isDeprecated() const override
\reimp
static Genus getGenus(Metaness metaness)
Determines the Genus value for this FunctionNode given the Metaness value metaness.
bool isAttached() const override
Returns true if the QML property or QML method node is marked as attached.
void setOverloadNumber(signed short number)
Sets the function node's overload number to number.
bool isIgnored() const
In some cases, it is ok for a public function to be not documented.
friend int compare(const FunctionNode *f1, const FunctionNode *f2)
Compares FunctionNode f1 with f2, assumed to have identical names.
QString returnTypeString() const
Returns the type of the function as a string.
virtual Status status() const override
Returns the status of the function, taking the status of any associated properties into account.
void setVirtualness(const QString &value)
Sets the function node's virtualness value based on the value of string value, which is the value of ...
const PropertyNode * primaryAssociatedProperty() const
Returns the primary associated property, if this is an access function for one or more properties.
QString virtualness() const
Returns this function's virtualness value as a string for use as an attribute value in index files.
This class describes one instance of using the Q_PROPERTY macro.
Status
Specifies the status of the QQmlIncubator.
static void buildTopicMetanessMap()
static void buildMetanessMap()
static QMap< QString, FunctionNode::Metaness > metanessMap_
static QMap< QString, FunctionNode::Metaness > topicMetanessMap_
Combined button and popup list for selecting options.
The Node class is the base class for all the nodes in QDoc's parse tree.
virtual Status status() const
Returns the node's status value.
Aggregate * parent() const
Returns the node's parent pointer.
virtual bool isDeprecated() const
Returns true if this node's status is Deprecated.
const std::optional< RelaxedTemplateDeclaration > & templateDecl() const
virtual bool isInAPI() const
Returns true if this node is considered to be part of the API as per the InclusionPolicy retrieved fr...
bool hasDoc() const
Returns true if this node is documented, or it represents a documented node read from the index ('had...
bool isCppNode() const
Returns true if this node's Genus value is CPP.
void setStatus(Status t)
Sets the node's status to t.
A class for parsing and managing a function parameter list.