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#define LT_RETURN_IF_NOT_EQUAL(a, b)
60#define LT_RETURN_IF_NOT_EQUAL_QSTR(a, b)
62 return QString::compare(a, b) < 0
;
65
66
67
68
69
70
71
72
73
74
75
76
77
86 f2->signature(Node::SignatureReturnType));
100
101
102
103
104
105
106
107
108
109
136
137
138
139
140
141
142
143
144
145
146
147
150 const QString default_sortkey{QChar{QChar::LastValidCodePoint}};
153 if (
auto cmp = QString::compare(
154 n1_metamap ? n1_metamap->value(u"sortkey"_s, default_sortkey) : default_sortkey,
155 n2_metamap ? n2_metamap->value(u"sortkey"_s, default_sortkey) : default_sortkey); cmp != 0) {
175
176
177
178
179
180
181
184
185
186
187
188
189
190
193
194
195
196
197
198
199
200
203
204
205
206
207
208
209
210
211
212
213
216
217
218
219
220
221
222
223
224
227
228
229
230
231
232
233
234
235
238
239
240
241
242
243
244
245
246
247
248
251
252
253
254
255
258
259
262
263
266
267
270
271
274
275
278
279
282
283
286
290
291
294
295
298
299
302
303
306
307
310
311
314
315
318
319
322
323
326
327
330
331
334
335
338
339
342
343
346
347
350
351
354
355
358
359
362
363
366
367
370
371
374
375
378
379
382
383
386
387
390
391
394
395
398
399
400
403
404
407
408
411
412
415
416
419
420
423
424
427
428
429
432
433
434
435
438
439
440
441
444
445
446
447
450
451
452
455
456
459
460
463
464
465
466
469 if (isFunction() && !isMacro())
470 return m_name + QLatin1String(
"()");
475
476
477
478
479
480
483 if (m_name.isEmpty())
484 return QLatin1String(
"global");
489 const Node *node =
this;
491 parts.prepend(node->plainName());
496 return parts.join(QLatin1String(
"::"));
500
501
502
503
504
507 if (m_name.isEmpty())
508 return QLatin1String(
"global");
511 const Node *node =
this;
516 fullName.prepend(QLatin1String(
"::"));
523
524
525
526
529 if ((isTextPageNode() || isGroup()) && !title().isEmpty())
531 return plainFullName(relative);
535
536
537
538
539
540
541
545 doc
.location().warning(QStringLiteral(
"Overrides a previous doc"),
546 QStringLiteral(
"from here: %1").arg(m_doc
.location().toString()));
552
553
554
555
564 const InclusionPolicy policy = Config::instance().createInclusionPolicy();
570 m_url = QStringLiteral(
"");
578
579
580
581
584 m_indexNodeFlag(
false),
585 m_relatedNonmember(
false),
597
598
599
600
601
602
603
604
636 return Genus::DontCare;
641
642
643
644
645
646
647
650
651
652
653
654
655
656
657
660
661
662
666 const auto *fn =
static_cast<
const FunctionNode *>(
this);
667 return fn->kindString();
669 return nodeTypeString(nodeType());
673
674
675
680 return QLatin1String(
"namespace");
682 return QLatin1String(
"class");
684 return QLatin1String(
"struct");
686 return QLatin1String(
"union");
688 return QLatin1String(
"header");
690 return QLatin1String(
"page");
692 return QLatin1String(
"enum");
694 return QLatin1String(
"example");
696 return QLatin1String(
"external page");
699 return QLatin1String(
"typedef");
701 return QLatin1String(
"function");
703 return QLatin1String(
"property");
705 return QLatin1String(
"proxy");
707 return QLatin1String(
"variable");
709 return QLatin1String(
"group");
711 return QLatin1String(
"module");
714 return QLatin1String(
"QML type");
716 return QLatin1String(
"QML value type");
718 return QLatin1String(
"QML module");
720 return QLatin1String(
"QML property");
723 return QLatin1String(
"shared comment");
725 return QLatin1String(
"collection");
733
734
735
742
743
744
745
746
760
761
762
763
764void Node::setLink(LinkType linkType,
const QString &link,
const QString &desc)
766 std::pair<QString, QString> linkPair;
767 linkPair.first =
std::move(link);
768 linkPair.second =
std::move(desc);
769 m_linkMap[linkType] = std::move(linkPair);
773
774
775
776
779 QStringList parts = since.split(QLatin1Char(
' '));
781 if (parts.size() > 1)
782 project = Config::dot + parts.first();
784 QVersionNumber cutoff =
785 QVersionNumber::fromString(Config::instance().get(
CONFIG_IGNORESINCE + project).asString())
788 if (!cutoff.isNull() && QVersionNumber::fromString(parts.last()).normalized() < cutoff)
791 m_since = parts.join(QLatin1Char(
' '));
795
796
800 for (
int i = 0; i <= string.size(); ++i) {
802 if (i != string.size())
805 QChar lower = ch.toLower();
806 if ((lower >= QLatin1Char(
'a') && lower <= QLatin1Char(
'z')) || ch.digitValue() >= 0
807 || ch == QLatin1Char(
'_') || ch == QLatin1Char(
':')) {
809 }
else if (!result.isEmpty()) {
810 if (result != QLatin1String(
"const"))
819
820
821
822
823
824
833
834
835
836
845
846
847
856
857
860
861
873
874
881
882
883
884
887 QString suffix = t.fileSuffix();
890 else if (suffix ==
"cpp")
899
900
901
902
903
904
913 return (m_sharedCommentNode && m_sharedCommentNode
->hasDoc());
917
918
919
922 if (m_parent && m_parent->isNamespace() && !m_parent->name().isEmpty())
923 return m_parent->name() +
"::" + m_name;
928
929
930
933 if (m_parent && !m_parent->name().isEmpty())
934 return m_parent->name() +
"::" + m_name;
939
940
941
944 return logicalModuleName() +
"::" + m_name;
948
949
950
951
954 return m_parent !=
nullptr && m_parent
->isWrapper();
958
959
963 const Node *n =
this;
966 if (!n->name().isEmpty())
967 pieces.insert(0, n->name());
970 pieces.insert(0, n->logicalModuleName());
985 QString concatenator =
"::";
987 concatenator = QLatin1Char(
'.');
990 concatenator = QLatin1Char(
'#');
992 return pieces.join(concatenator);
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1010 if (!m_deprecatedSince.isEmpty())
1011 qCWarning(lcQdoc) << QStringLiteral(
1012 "Setting deprecated since version for %1 to %2 even though it "
1013 "was already set to %3. This is very unexpected.")
1014 .arg(
this->m_name, sinceVersion,
this->m_deprecatedSince);
1015 m_deprecatedSince = sinceVersion;
1017 if (!sinceVersion.isEmpty()) {
1018 QVersionNumber since = QVersionNumber::fromString(sinceVersion).normalized();
1019 QVersionNumber current = QVersionNumber::fromString(
1022 if (!current.isNull() && !since.isNull()) {
1023 if (current < since)
1031
1032
1033
1034
1035
1036
1037
1038
1041
1042
1043
1044
1047
1048
1049
1050
1053
1054
1057
1058
1059
1060
1061
1062
1063
1064
1067
1068
1069
1072
1073
1074
1075
1078
1079
1080
1083
1084
1085
1086
1089
1090
1091
1092
1095
1096
1099
1100
1101
1102
1105
1106
1107
1108
1109
1110
1113
1114
1115
1116
1117
1118
1119
1122
1123
1124
1127
1128
1129
1132
1133
1134
1137
1138
1139
1142
1143
1144
1147
1148
1149
1152
1153
1154
1155
1158
1159
1160
1161
1162
1165
1166
1167
1168
1169
1172
1173
1174
1175
1178
1179
1180
1181
1182
1183
1184
1185
1188
1189
1190
1191
1192
1195
1196
1197
1198
1199
1202
1203
1204
1205
1206
1207
1210
1211
1212
1213
1214
1215
1216
1219
1220
1221
1222
1223
1224
1225
1226
1229
1230
1231
1234
1235
1236
1239
1240
1243
1244
1247
1248
1249
1250
1253
1254
1255
1256
1259
1260
1261
1262
1265
1266
1267
1268
1269
1272
1273
1274
1277
1278
1279
1280
1281
1284
1285
1286
1287
1288
1289
1290
1293
1294
1295
1296
1297
1298
1301
1302
1303
1304
1307
1308
1309
1310
1313
1314
1317
1318
1319
1322
1323
1324
1325
1326
1329
1330
1331
1332
1335
1336
1337
1340
1341
1342
1345
1346
1347
1350
1351
1352
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1381
1382
1383
1384
1387
1388
1389
1392
1393
1394
1395
1398
1399
1400
1401
1404
1405
1406
1407
1408
1409
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.
int lineNo() const
Returns the current line number.
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.
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...
static bool nodeLessThan(const Node *first, const Node *second)
Returns true if the node n1 is less than node n2.