22#include <QtCore/quuid.h>
23#include <QtCore/qversionnumber.h>
29using namespace Qt::StringLiterals;
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
55
56
57
58
61#define LT_RETURN_IF_NOT_EQUAL(a, b)
90
91
92
93
94
95
96
97
98
99
100
101
104 const QString default_sortkey{QChar{QChar::LastValidCodePoint}};
107 if (
auto cmp = QString::compare(
108 n1_metamap ? n1_metamap->value(u"sortkey"_s, default_sortkey) : default_sortkey,
109 n2_metamap ? n2_metamap->value(u"sortkey"_s, default_sortkey) : default_sortkey); cmp != 0) {
129
130
131
132
133
134
135
138
139
140
141
142
143
144
147
148
149
150
151
152
153
154
157
158
159
160
161
162
163
164
165
166
167
170
171
172
173
174
175
176
177
178
181
182
183
184
185
186
187
188
189
192
193
194
195
196
197
198
199
200
201
202
205
206
207
208
209
212
213
216
217
220
221
224
225
228
229
232
233
236
237
240
241
244
245
248
249
252
253
256
257
260
261
264
265
268
269
272
273
276
277
280
281
284
285
288
289
292
293
296
297
300
301
304
305
308
309
312
313
316
317
320
321
324
325
328
329
332
333
336
337
340
341
344
345
348
349
352
353
354
357
358
361
362
365
366
369
370
373
374
377
378
381
382
383
386
387
388
389
392
393
394
395
398
399
400
401
404
405
406
409
410
413
414
417
418
419
420
423 if (isFunction() && !isMacro())
424 return m_name + QLatin1String(
"()");
429
430
431
432
433
434
437 if (m_name.isEmpty())
438 return QLatin1String(
"global");
443 const Node *node =
this;
445 parts.prepend(node->plainName());
450 return parts.join(QLatin1String(
"::"));
454
455
456
457
458
461 if (m_name.isEmpty())
462 return QLatin1String(
"global");
465 const Node *node =
this;
470 fullName.prepend(QLatin1String(
"::"));
477
478
479
480
483 if ((isTextPageNode() || isGroup()) && !title().isEmpty())
485 return plainFullName(relative);
489
490
491
492
493
494
495
499 doc
.location().warning(QStringLiteral(
"Overrides a previous doc"),
500 QStringLiteral(
"from here: %1").arg(m_doc
.location().toString()));
506
507
508
509
518 const InclusionPolicy policy = Config::instance().createInclusionPolicy();
524 m_url = QStringLiteral(
"");
532
533
534
535
538 m_indexNodeFlag(
false),
539 m_relatedNonmember(
false),
551
552
553
554
555
556
557
558
590 return Genus::DontCare;
595
596
597
598
599
600
601
604
605
606
607
608
609
610
611
614
615
616
620 const auto *fn =
static_cast<
const FunctionNode *>(
this);
621 return fn->kindString();
623 return nodeTypeString(nodeType());
627
628
629
634 return QLatin1String(
"namespace");
636 return QLatin1String(
"class");
638 return QLatin1String(
"struct");
640 return QLatin1String(
"union");
642 return QLatin1String(
"header");
644 return QLatin1String(
"page");
646 return QLatin1String(
"enum");
648 return QLatin1String(
"example");
650 return QLatin1String(
"external page");
653 return QLatin1String(
"typedef");
655 return QLatin1String(
"function");
657 return QLatin1String(
"property");
659 return QLatin1String(
"proxy");
661 return QLatin1String(
"variable");
663 return QLatin1String(
"group");
665 return QLatin1String(
"module");
668 return QLatin1String(
"QML type");
670 return QLatin1String(
"QML value type");
672 return QLatin1String(
"QML module");
674 return QLatin1String(
"QML property");
677 return QLatin1String(
"shared comment");
679 return QLatin1String(
"collection");
687
688
689
696
697
698
699
700
714
715
716
717
718void Node::setLink(LinkType linkType,
const QString &link,
const QString &desc)
720 std::pair<QString, QString> linkPair;
721 linkPair.first =
std::move(link);
722 linkPair.second =
std::move(desc);
723 m_linkMap[linkType] = std::move(linkPair);
727
728
729
730
733 QStringList parts = since.split(QLatin1Char(
' '));
735 if (parts.size() > 1)
736 project = Config::dot + parts.first();
738 QVersionNumber cutoff =
739 QVersionNumber::fromString(Config::instance().get(
CONFIG_IGNORESINCE + project).asString())
742 if (!cutoff.isNull() && QVersionNumber::fromString(parts.last()).normalized() < cutoff)
745 m_since = parts.join(QLatin1Char(
' '));
749
750
754 for (
int i = 0; i <= string.size(); ++i) {
756 if (i != string.size())
759 QChar lower = ch.toLower();
760 if ((lower >= QLatin1Char(
'a') && lower <= QLatin1Char(
'z')) || ch.digitValue() >= 0
761 || ch == QLatin1Char(
'_') || ch == QLatin1Char(
':')) {
763 }
else if (!result.isEmpty()) {
764 if (result != QLatin1String(
"const"))
773
774
775
776
777
778
787
788
789
790
799
800
801
810
811
814
815
827
828
835
836
837
838
841 QString suffix = t.fileSuffix();
844 else if (suffix ==
"cpp")
853
854
855
856
857
858
867 return (m_sharedCommentNode && m_sharedCommentNode
->hasDoc());
871
872
873
876 if (m_parent && m_parent->isNamespace() && !m_parent->name().isEmpty())
877 return m_parent->name() +
"::" + m_name;
882
883
884
887 if (m_parent && !m_parent->name().isEmpty())
888 return m_parent->name() +
"::" + m_name;
893
894
895
898 return logicalModuleName() +
"::" + m_name;
902
903
904
905
908 return m_parent !=
nullptr && m_parent
->isWrapper();
912
913
917 const Node *n =
this;
920 if (!n->name().isEmpty())
921 pieces.insert(0, n->name());
924 pieces.insert(0, n->logicalModuleName());
939 QString concatenator =
"::";
941 concatenator = QLatin1Char(
'.');
944 concatenator = QLatin1Char(
'#');
946 return pieces.join(concatenator);
950
951
952
953
954
955
956
957
958
959
960
964 if (!m_deprecatedSince.isEmpty())
965 qCWarning(lcQdoc) << QStringLiteral(
966 "Setting deprecated since version for %1 to %2 even though it "
967 "was already set to %3. This is very unexpected.")
968 .arg(
this->m_name, sinceVersion,
this->m_deprecatedSince);
969 m_deprecatedSince = sinceVersion;
971 if (!sinceVersion.isEmpty()) {
972 QVersionNumber since = QVersionNumber::fromString(sinceVersion).normalized();
973 QVersionNumber current = QVersionNumber::fromString(
976 if (!current.isNull() && !since.isNull()) {
985
986
987
988
989
990
991
992
995
996
997
998
1001
1002
1003
1004
1007
1008
1011
1012
1013
1014
1015
1016
1017
1018
1021
1022
1023
1026
1027
1028
1029
1032
1033
1034
1037
1038
1039
1040
1043
1044
1045
1046
1049
1050
1053
1054
1055
1056
1059
1060
1061
1062
1063
1064
1067
1068
1069
1070
1071
1072
1073
1076
1077
1078
1081
1082
1083
1086
1087
1088
1091
1092
1093
1096
1097
1098
1101
1102
1103
1106
1107
1108
1109
1112
1113
1114
1115
1116
1119
1120
1121
1122
1123
1126
1127
1128
1129
1132
1133
1134
1135
1136
1137
1138
1139
1142
1143
1144
1145
1146
1149
1150
1151
1152
1153
1156
1157
1158
1159
1160
1161
1164
1165
1166
1167
1168
1169
1170
1173
1174
1175
1176
1177
1178
1179
1180
1183
1184
1185
1188
1189
1190
1193
1194
1197
1198
1201
1202
1203
1204
1207
1208
1209
1210
1213
1214
1215
1216
1219
1220
1221
1222
1223
1226
1227
1228
1231
1232
1233
1234
1235
1238
1239
1240
1241
1242
1243
1244
1247
1248
1249
1250
1251
1252
1255
1256
1257
1258
1261
1262
1263
1264
1267
1268
1271
1272
1273
1276
1277
1278
1279
1280
1283
1284
1285
1286
1289
1290
1291
1294
1295
1296
1299
1300
1301
1304
1305
1306
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1335
1336
1337
1338
1341
1342
1343
1346
1347
1348
1349
1352
1353
1354
1355
1358
1359
1360
1361
1362
1363
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}.
QStringMultiMap * metaTagMap() const
This node is used to represent any kind of function being documented.
static bool processInternalDocs(const InclusionPolicy &policy)
The Location class provides a way to mark a location in a file.
This class constructs and maintains a tree of instances of the subclasses of Node.
#define CONFIG_IGNORESINCE
#define LT_RETURN_IF_NOT_EQUAL(a, b)
The Node class is the base class for all the nodes in QDoc's parse tree.
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 ...
virtual bool isAggregate() const
Returns true if this node is an aggregate, which means it inherits Aggregate and can therefore have c...
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 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.
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...
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.
Status
An unsigned char that specifies the status of the documentation element in the documentation set.
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...