23#include <QtCore/quuid.h>
24#include <QtCore/qversionnumber.h>
30using namespace Qt::StringLiterals;
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
56#define LT_RETURN_IF_NOT_EQUAL(a, b)
61#define LT_RETURN_IF_NOT_EQUAL_QSTR(a, b)
63 return QString::compare(a, b) < 0
;
66
67
68
69
70
71
72
73
74
75
76
77
78
82 const auto *f1 =
static_cast<
const FunctionNode *>(n1);
83 const auto *f2 =
static_cast<
const FunctionNode *>(n2);
87 f2->signature(Node::SignatureReturnType));
101
102
103
104
105
106
107
108
109
110
119 const auto *f1 =
static_cast<
const FunctionNode *>(n1);
120 const auto *f2 =
static_cast<
const FunctionNode *>(n2);
139 const auto *f1 =
static_cast<
const FunctionNode *>(n1);
140 const auto *f2 =
static_cast<
const FunctionNode *>(n2);
149
150
151
152
153
154
155
156
157
158
159
160
163 const QString default_sortkey{QChar{QChar::LastValidCodePoint}};
166 if (
auto cmp = QString::compare(
167 n1_metamap ? n1_metamap->value(u"sortkey"_s, default_sortkey) : default_sortkey,
168 n2_metamap ? n2_metamap->value(u"sortkey"_s, default_sortkey) : default_sortkey); cmp != 0) {
180 context.metaness =
static_cast<
const FunctionNode *>(
this)->metaness();
192
193
194
195
196
197
198
201
202
203
204
205
206
207
210
211
212
213
214
215
216
217
220
221
222
223
224
225
226
227
228
229
230
233
234
235
236
237
238
239
240
241
244
245
246
247
248
249
250
251
252
255
256
257
258
259
260
261
262
263
264
265
268
269
270
271
272
275
276
279
283
284
287
288
291
292
295
296
299
300
303
304
307
308
311
312
315
316
319
320
323
324
327
328
331
332
335
336
339
340
343
344
347
348
351
352
355
356
359
360
363
364
367
368
371
372
375
376
379
380
383
384
387
388
391
392
395
396
399
400
403
404
407
408
411
412
415
416
417
420
421
424
425
428
429
432
433
436
437
440
441
444
445
446
449
450
451
452
455
456
457
458
461
462
463
464
467
468
469
472
473
476
477
480
481
482
483
486 if (isFunction() && !isMacro())
487 return m_name + QLatin1String(
"()");
492
493
494
495
496
497
500 if (m_name.isEmpty())
501 return QLatin1String(
"global");
506 const Node *node =
this;
508 parts.prepend(node->plainName());
513 return parts.join(QLatin1String(
"::"));
517
518
519
520
521
524 if (m_name.isEmpty())
525 return QLatin1String(
"global");
528 const Node *node =
this;
533 fullName.prepend(QLatin1String(
"::"));
540
541
542
543
546 if ((isTextPageNode() || isGroup()) && !title().isEmpty())
548 return plainFullName(relative);
552
553
554
555
556
557
558
559
563 doc
.location().warning(QStringLiteral(
"Overrides a previous doc"),
564 QStringLiteral(
"from here: %1").arg(m_doc
.location().toString()));
570
571
572
573
583 const InclusionPolicy policy = Config::instance().createInclusionPolicy();
588 case Status::DontDocument:
589 m_url = QStringLiteral(
"");
597
598
599
600
603 m_indexNodeFlag(
false),
604 m_relatedNonmember(
false),
616
617
618
619
620
621
622
623
656 return Genus::DontCare;
661
662
663
664
665
666
667
670
671
672
673
674
675
676
677
680
681
682
686 const auto *fn =
static_cast<
const FunctionNode *>(
this);
687 return fn->kindString();
689 return nodeTypeString(nodeType());
693
694
695
700 return QLatin1String(
"namespace");
702 return QLatin1String(
"class");
704 return QLatin1String(
"struct");
706 return QLatin1String(
"union");
708 return QLatin1String(
"header");
710 return QLatin1String(
"page");
712 return QLatin1String(
"enum");
714 return QLatin1String(
"example");
716 return QLatin1String(
"external page");
719 return QLatin1String(
"typedef");
721 return QLatin1String(
"function");
723 return QLatin1String(
"property");
725 return QLatin1String(
"proxy");
727 return QLatin1String(
"variable");
729 return QLatin1String(
"group");
731 return QLatin1String(
"module");
733 return QLatin1String(
"concept");
735 return QLatin1String(
"enumeration");
737 return QLatin1String(
"QML type");
739 return QLatin1String(
"QML value type");
741 return QLatin1String(
"QML module");
743 return QLatin1String(
"QML property");
746 return QLatin1String(
"shared comment");
748 return QLatin1String(
"collection");
756
757
758
765
766
767
768
769
783
784
785
786
787void Node::setLink(LinkType linkType,
const QString &link,
const QString &desc)
789 std::pair<QString, QString> linkPair;
790 linkPair.first =
std::move(link);
791 linkPair.second =
std::move(desc);
792 m_linkMap[linkType] = std::move(linkPair);
796
797
798
799
802 QStringList parts = since.split(QLatin1Char(
' '));
804 if (parts.size() > 1)
805 project = Config::dot + parts.first();
807 QVersionNumber cutoff =
808 QVersionNumber::fromString(Config::instance().get(
CONFIG_IGNORESINCE + project).asString())
811 if (!cutoff.isNull() && QVersionNumber::fromString(parts.last()).normalized() < cutoff)
814 m_since = parts.join(QLatin1Char(
' '));
818
819
823 for (
int i = 0; i <= string.size(); ++i) {
825 if (i != string.size())
828 QChar lower = ch.toLower();
829 if ((lower >= QLatin1Char(
'a') && lower <= QLatin1Char(
'z')) || ch.digitValue() >= 0
830 || ch == QLatin1Char(
'_') || ch == QLatin1Char(
':')) {
832 }
else if (!result.isEmpty()) {
833 if (result != QLatin1String(
"const"))
842
843
844
845
846
847
856
857
858
859
868
869
870
883
884
887
888
891 if (parent() ==
nullptr)
892 return (
this->isAggregate() ?
static_cast<Aggregate *>(
const_cast<Node *>(
this)) :
nullptr);
900
901
908
909
910
911
914 QString suffix = t.fileSuffix();
917 else if (suffix ==
"cpp")
926
927
928
929
932 const InclusionPolicy policy = Config::instance().createInclusionPolicy();
939
940
941
942
943
944
953 return (m_sharedCommentNode && m_sharedCommentNode
->hasDoc());
957
958
959
962 if (m_parent && m_parent->isNamespace() && !m_parent->name().isEmpty())
963 return m_parent->name() +
"::" + m_name;
968
969
970
973 if (m_parent && !m_parent->name().isEmpty())
974 return m_parent->name() +
"::" + m_name;
979
980
981
984 return logicalModuleName() +
"::" + m_name;
988
989
990
991
994 return m_parent !=
nullptr && m_parent
->isWrapper();
998
999
1003 const Node *n =
this;
1006 if (!n->name().isEmpty())
1007 pieces.insert(0, n->name());
1010 pieces.insert(0, n->logicalModuleName());
1025 QString concatenator =
"::";
1027 concatenator = QLatin1Char(
'.');
1030 concatenator = QLatin1Char(
'#');
1032 return pieces.join(concatenator);
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1050 if (!m_deprecatedSince.isEmpty())
1051 qCWarning(lcQdoc) << QStringLiteral(
1052 "Setting deprecated since version for %1 to %2 even though it "
1053 "was already set to %3. This is very unexpected.")
1054 .arg(
this->m_name, sinceVersion,
this->m_deprecatedSince);
1055 m_deprecatedSince = sinceVersion;
1057 if (!sinceVersion.isEmpty()) {
1058 QVersionNumber since = QVersionNumber::fromString(sinceVersion).normalized();
1059 QVersionNumber current = QVersionNumber::fromString(
1062 if (!current.isNull() && !since.isNull()) {
1063 if (current < since)
1071
1072
1073
1074
1075
1076
1077
1078
1081
1082
1083
1084
1087
1088
1089
1090
1093
1094
1097
1098
1099
1100
1101
1102
1103
1104
1107
1108
1109
1112
1113
1114
1115
1118
1119
1120
1123
1124
1125
1126
1129
1130
1131
1132
1135
1136
1139
1140
1141
1142
1145
1146
1147
1148
1149
1150
1153
1154
1155
1156
1157
1158
1159
1162
1163
1164
1167
1168
1169
1172
1173
1174
1177
1178
1179
1182
1183
1184
1187
1188
1189
1192
1193
1194
1195
1198
1199
1200
1201
1202
1205
1206
1207
1208
1209
1212
1213
1214
1215
1218
1219
1220
1221
1222
1223
1224
1225
1228
1229
1230
1231
1232
1235
1236
1237
1238
1239
1242
1243
1244
1245
1246
1247
1250
1251
1252
1253
1254
1255
1256
1259
1260
1261
1262
1263
1264
1265
1266
1269
1270
1271
1274
1275
1276
1279
1280
1283
1284
1287
1288
1289
1290
1293
1294
1295
1296
1299
1300
1301
1302
1305
1306
1307
1308
1309
1312
1313
1314
1317
1318
1319
1320
1321
1324
1325
1326
1327
1328
1329
1330
1333
1334
1335
1336
1337
1338
1341
1342
1343
1344
1347
1348
1349
1350
1353
1354
1357
1358
1359
1362
1363
1364
1365
1366
1369
1370
1371
1372
1375
1376
1377
1380
1381
1382
1385
1386
1387
1390
1391
1392
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1421
1422
1423
1424
1427
1428
1429
1432
1433
1434
1435
1438
1439
1440
1441
1444
1445
1446
1447
1448
1449
void addChild(Node *child)
Adds the child to this node's child list and sets the child's parent pointer to this Aggregate.
const Location & location() const
Returns the starting location of a qdoc comment.
Doc & operator=(const Doc &doc)
bool isMarkedReimp() const
Returns true if the set of metacommands used in the doc comment contains {reimp}.
bool isAutoGenerated() const
Returns true if this documentation was auto-generated by QDoc rather than written by an author.
QStringMultiMap * metaTagMap() const
static bool processInternalDocs(const InclusionPolicy &policy)
static bool isIncluded(const InclusionPolicy &policy, const NodeContext &context)
The Location class provides a way to mark a location in a file.
int lineNo() const
Returns the current line number.
Status
Specifies the status of the QQmlIncubator.
This class constructs and maintains a tree of instances of the subclasses of Node.
#define CONFIG_IGNORESINCE
Combined button and popup list for selecting options.
#define LT_RETURN_IF_NOT_EQUAL(a, b)
#define LT_RETURN_IF_NOT_EQUAL_QSTR(a, b)
The Node class is the base class for all the nodes in QDoc's parse tree.
bool isDontDocument() const
Returns true if this node's status is DontDocument.
virtual QString plainName() const
Returns this node's name member.
const Doc & doc() const
Returns a reference to the node's Doc data member.
virtual bool isWrapper() const
Returns true if the node is a class node or a QML type node that is marked as being a wrapper class o...
bool isPrivate() const
Returns true if this node's access is Private.
virtual bool isAbstract() const
Returns true if the ClassNode or QmlTypeNode is marked abstract.
QString nodeTypeString() const
Returns this node's type as a string for use as an attribute value in XML or HTML.
bool isQmlType() const
Returns true if the node type is QmlType or QmlValueType.
virtual bool isInternal() const
Returns true if the node's status is Internal, or if its parent is a class with Internal status.
bool isHeader() const
Returns true if the node type is HeaderFile.
NodeType nodeType() const override
Returns this node's type.
virtual bool isPageNode() const
Returns true if this node represents something that generates a documentation page.
virtual Status status() const
Returns the node's status value.
virtual bool isTextPageNode() const
Returns true if the node is a PageNode but not an Aggregate.
Aggregate * parent() const
Returns the node's parent pointer.
static bool fromFlagValue(FlagValue fv, bool defaultValue)
Converts the enum fv back to a boolean value.
void setLocation(const Location &t)
Sets the node's declaration location, its definition location, or both, depending on the suffix of th...
QString plainFullName(const Node *relative=nullptr) const
Constructs and returns the node's fully qualified name by recursively ascending the parent links and ...
FlagValue
A value used in PropertyNode and QmlPropertyNode that can be -1, 0, or +1.
QString qualifyQmlName()
Returns the QML node's qualified name by prepending the logical module name.
static bool nodeNameLessThan(const Node *first, const Node *second)
Returns true if the node n1 is less than node n2.
QString qualifyCppName()
Returns the CPP node's qualified name by prepending the namespaces name + "::" if there isw a namespa...
ThreadSafeness inheritedThreadSafeness() const
If this node has a parent, the parent's thread safeness value is returned.
const Location & location() const
If this node's definition location is empty, this function returns this node's declaration location.
Access access() const
Returns the node's Access setting, which can be Public, Protected, or Private.
bool isInternalAuto() const
bool isFunction(Genus g=Genus::DontCare) const
Returns true if this is a FunctionNode and its Genus is set to g.
ThreadSafeness threadSafeness() const
Returns the thread safeness value for whatever this node represents.
virtual bool isInAPI() const
Returns true if this node is considered to be part of the API as per the InclusionPolicy retrieved fr...
QString fullDocumentName() const
Construct the full document name for this node and return it.
virtual Tree * tree() const
Returns a pointer to the Tree this node is in.
NodeContext createContext() const
void setDoc(const Doc &doc, bool replace=false)
Sets this Node's Doc to doc.
Node(NodeType type, Aggregate *parent, QString name)
Construct a node with the given type and having the given parent and name.
ThreadSafeness
An unsigned char that specifies the degree of thread-safeness of the element.
QString fullName(const Node *relative) const
Constructs and returns this node's full name.
virtual bool isPureVirtual() const
bool hasDoc() const
Returns true if this node is documented, or it represents a documented node read from the index ('had...
static Genus getGenus(NodeType t)
Determines the appropriate Genus value for the NodeType value t and returns that Genus value.
static FlagValue toFlagValue(bool b)
Converts the boolean value b to an enum representation of the boolean type, which includes an enum va...
bool isRelatedNonmember() const
Returns true if this is a related nonmember of something.
void setSince(const QString &since)
Sets the information about the project and version a node was introduced in, unless the version is lo...
virtual void setStatus(Status t)
Sets the node's status to t.
QString extractClassName(const QString &string) const
Extract a class name from the type string and return it.
void setDeprecated(const QString &sinceVersion)
Sets the Node status to Node::Deprecated, unless sinceVersion represents a future version.
static bool nodeSortKeyOrNameLessThan(const Node *n1, const Node *n2)
Returns true if node n1 is less than node n2 when comparing the sort keys, defined with.
static bool nodeNameOverloadLessThan(const Node *first, const Node *second)
QString qualifyWithParentName()
Return the name of this node qualified with the parent name and "::" if there is a parent name.
QString plainSignature() const
Constructs and returns the node's fully qualified signature by recursively ascending the parent links...
static bool nodeLessThan(const Node *first, const Node *second)
Returns true if the node n1 is less than node n2.