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),
49 m_overloadFlag(
false),
50 m_primaryOverloadFlag(
false),
59 m_virtualness(NonVirtual),
66
67
68
69
70
71
72
73
74
82 m_overloadFlag(
false),
83 m_primaryOverloadFlag(
false),
96 if (!
isCppNode() && name.startsWith(
"__"))
101
102
103
106 auto *fn =
new FunctionNode(*
this);
107 fn->setParent(
nullptr);
108 parent->addChild(fn);
113
114
115
118 switch (m_virtualness) {
120 return QLatin1String(
"virtual");
122 return QLatin1String(
"pure");
127 return QLatin1String(
"non");
131
132
133
134
135
136
139 if (value == QLatin1String(
"pure")) {
142 parent()->setAbstract(
true);
181
182
183
184
185
208 return Genus::DontCare;
212
213
214
219 return metanessMap_[value];
223
224
225
230 return topicMetanessMap_[topic];
234
235
236
237
240 m_overloadNumber = number;
241 m_overloadFlag = (number > 0);
245
246
247
248
249
250
251
254
255
256
257
260 switch (m_metaness) {
264 return "QML signal handler";
273
274
275
278 switch (m_metaness) {
286 return "constructor";
288 return "copy-constructor";
290 return "move-constructor";
294 return "macrowithparams";
296 return "macrowithoutparams";
300 return "copy-assign";
302 return "move-assign";
306 return "qmlsignalhandler";
315
316
317
318
321 m_associatedProperties.append(p);
325
326
327
328
329
330
331
332
333
334
337 if (m_associatedProperties.isEmpty())
339 if (m_associatedProperties.size() == 1)
340 return m_associatedProperties[0];
342 auto it = std::find_if(
343 m_associatedProperties.cbegin(), m_associatedProperties.cend(),
344 [
this](
const PropertyNode *p) {
345 return name().startsWith(p->name());
348 return it != m_associatedProperties.cend() ? *it : m_associatedProperties[0];
352
353
354
355
356
363
364
367
368
369
370
371
372
373
374
375
376
377
378
379
380
383 QStringList elements;
385 if (options & Node::SignatureTemplateParams && templateDecl())
386 elements << (*templateDecl()).to_qstring();
387 if (options & Node::SignatureReturnType)
388 elements << m_returnType.first;
389 elements.removeAll(QString());
391 if (!isMacroWithoutParams()) {
392 elements << name() + QLatin1Char(
'(')
393 + m_parameters.signature(options & Node::SignatureDefaultValues)
397 elements << QStringLiteral(
"const");
399 elements << QStringLiteral(
"&");
401 elements << QStringLiteral(
"&&");
406 return elements.join(QLatin1Char(
' '));
410
411
412
413
414
415
416
417
443 for (qsizetype i = 0; i < param_count; ++i) {
444 if (
int type_comp = QString::compare(p1.at(i).type(), p2.at(i).type());
457 return (*t1).to_std_string().compare((*t2).to_std_string());
463
464
465
466
467
468
469
470
471
472
473
474
475
479 if (name().startsWith(QLatin1String(
"qt_")) || name() == QLatin1String(
"metaObject")
480 || name() == QLatin1String(
"tr") || name() == QLatin1String(
"trUtf8")
481 || name() == QLatin1String(
"d_func")) {
485 if (s.contains(QLatin1String(
"enum_type")) && s.contains(QLatin1String(
"operator|")))
492
493
494
497
498
499
500
501
502
505 if (m_returnType.second.has_value())
506 return m_returnType.second.value();
507 return m_returnType.first;
511
512
513
516 auto it = std::find_if_not(m_associatedProperties.begin(), m_associatedProperties.end(),
517 [](
const Node *p) ->
bool {
return p->isDeprecated(); });
519 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 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.
void setVirtualness(const QString &value)
Sets the function node's virtualness value based on the value of string value, which is the value of ...
virtual Status status() const override
Returns the status of the function, taking the status of any associated properties into account.
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.
static void buildTopicMetanessMap()
static void buildMetanessMap()
static QMap< QString, FunctionNode::Metaness > metanessMap_
static QMap< QString, FunctionNode::Metaness > topicMetanessMap_
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.
const std::optional< RelaxedTemplateDeclaration > & templateDecl() const
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.
Status
An unsigned char that specifies the status of the documentation element in the documentation set.
A class for parsing and managing a function parameter list.