29using namespace Qt::StringLiterals;
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
49
50
51
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
71
72
73
74
75
76
77
79 : m_camelCaseModuleName(camelCaseModuleName),
80 m_physicalModuleName(camelCaseModuleName.toLower()),
82 m_root(
nullptr, QString())
84 m_root.setPhysicalModuleName(m_physicalModuleName);
89
90
91
92
93
94
95
96
97
98
101 qDeleteAll(m_nodesByTargetRef);
102 m_nodesByTargetRef.clear();
103 m_nodesByTargetTitle.clear();
109
110
111
112
113
114Node *
Tree::findNodeForInclude(
const QStringList &path)
const
116 Node *n = findClassNode(path);
118 n = findNamespaceNode(path);
123
124
125
126
127
128
129
132 QStringList path = name.split(QLatin1String(
"::"));
133 return static_cast<Aggregate *>(findNodeRecursive(path, 0,
const_cast<NamespaceNode *>(root()),
134 &Node::isFirstClassAggregate));
138
139
140
141
142
145 if (start ==
nullptr)
147 return static_cast<ClassNode *>(findNodeRecursive(path, 0, start, &Node::isClassNode));
151
152
153
154
158 return static_cast<NamespaceNode *>(findNodeRecursive(path, 0, start, &Node::isNamespace));
162
163
164
165
166
167
168
169
170
171
172
175 Node *n = findNodeRecursive(path, 0, root(), &Node::isRelatableType);
176 return (((n !=
nullptr) && n->isAggregate()) ?
static_cast<Aggregate *>(n) :
nullptr);
180
181
182
183
184
185
186
187
188
189
190
191
192
195 if (!m_externalRelates.contains(node, target))
196 m_externalRelates.insert(node, target);
200
201
202
203
204
207
208
209
213 m_unresolvedPropertyMap[property].insert(funcRole, funcName);
217
218
219
220
221
222
223
226 for (
auto it = n->constBegin(); it != n->constEnd(); ++it) {
227 if ((*it)->isClassNode()) {
228 auto *cn =
static_cast<
ClassNode *>(*it);
229 QList<RelatedClass> &bases = cn->baseClasses_mutable();
230 for (
auto &base : bases) {
231 if (base.m_node ==
nullptr) {
232 Node *n = m_qdb->findClassNode(base.m_path);
234
235
236
237
238
239
240
241
242
244 Aggregate *parent = cn->parent();
245 if (parent !=
nullptr)
247 if (parent->isNamespace() && !parent->name().isEmpty())
248 n = findClassNode(base.m_path, parent);
251 auto *bcn =
static_cast<ClassNode *>(n);
253 bcn->addDerivedClass(base.m_access, cn);
257 resolveBaseClasses(cn);
258 }
else if ((*it)->isNamespace()) {
265
268 for (
auto node = n->constBegin(); node != n->constEnd(); ++node) {
269 if ((*node)->isClassNode()) {
270 auto *cn =
static_cast<
ClassNode *>(*node);
271 for (
auto property = cn->constBegin(); property != cn->constEnd(); ++property) {
272 if ((*property)->isProperty())
273 cn->resolvePropertyOverriddenFromPtrs(
static_cast<
PropertyNode *>(*property));
275 resolvePropertyOverriddenFromPtrs(cn);
276 }
else if ((*node)->isNamespace()) {
277 resolvePropertyOverriddenFromPtrs(
static_cast<
NamespaceNode *>(*node));
283
284
285
286
287
290 for (
auto propEntry = m_unresolvedPropertyMap.constBegin();
291 propEntry != m_unresolvedPropertyMap.constEnd(); ++propEntry) {
300 for (
auto it = parent->constBegin(); it != parent->constEnd(); ++it) {
301 if ((*it)->isFunction()) {
303 if (function->access() == property
->access()
304 && (function->status() == property
->status() || function->doc().isEmpty())) {
305 if (function->name() == getterName) {
307 }
else if (function->name() == setterName) {
309 }
else if (function->name() == resetterName) {
311 }
else if (function->name() == notifierName) {
313 }
else if (function->name() == bindableName) {
321 for (
auto propEntry = m_unresolvedPropertyMap.constBegin();
322 propEntry != m_unresolvedPropertyMap.constEnd(); ++propEntry) {
329 m_unresolvedPropertyMap.clear();
333
334
335
336
337
338
339
340
341
342
343
344void Tree::validatePropertyDocumentation(
const Aggregate *aggregate)
const
346 const auto &config = Config::instance();
347 const InclusionPolicy policy = config.createInclusionPolicy();
348 validatePropertyDocumentation(aggregate, policy);
352
353
354
355
356
357
358void Tree::validatePropertyDocumentation(
const Aggregate *aggregate,
const InclusionPolicy &policy)
const
360 for (
auto it = aggregate->constBegin(); it != aggregate->constEnd(); ++it) {
366 node
->location().warning(u"Undocumented property '%1'"_s.arg(node->plainFullName()));
370 validatePropertyDocumentation(
static_cast<Aggregate *>(node), policy);
375
376
377
378
379void Tree::resolveCppToQmlLinks()
382 const NodeList &children = m_root.childNodes();
383 for (
auto *child : children) {
384 if (child->isQmlType()) {
385 auto *qcn =
static_cast<QmlTypeNode *>(child);
386 auto *cn =
const_cast<ClassNode *>(qcn->classNode());
388 cn->insertQmlNativeType(qcn);
394
395
396
397
398
399
400
401
404 for (
auto *child : aggregate.childNodes()) {
407 if (child->isEnumType())
408 resolveEnumValueSince(
static_cast<EnumNode&>(*child));
409 if (!child->isAggregate())
411 if (!child->since().isEmpty())
414 if (
const auto collectionNode = m_qdb->getModuleNode(child))
415 child->setSince(collectionNode->since());
417 resolveSince(
static_cast<Aggregate&>(*child));
422
423
424
425
426
427
428
429
432 const QStringList enumItems{en
.doc().enumItemNames()};
433 const Atom *atom = en
.doc().body().firstAtom();
439 if (
const auto &val = atom->string(); enumItems.contains(val)) {
447
448
449
450
451
452
453
454
457 if (rootNode ==
nullptr)
460 for (
auto node = rootNode->constBegin(); node != rootNode->constEnd(); ++node) {
461 if ((*node)->isClassNode())
463 else if ((*node)->isNamespace())
464 removePrivateAndInternalBases(
static_cast<
NamespaceNode *>(*node));
469
473 const auto &baseClasses = classNode->baseClasses();
474 for (
const auto &relatedClass : baseClasses) {
475 if (relatedClass.m_node !=
nullptr) {
476 result += relatedClass.m_node;
477 result += allBaseClasses(relatedClass.m_node);
484
485
486
487
488
489
492 return findNodeRecursive(path, 0, root(), isMatch);
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511Node *
Tree::findNodeRecursive(
const QStringList &path,
int pathIndex,
const Node *start,
512 bool (Node::*isMatch)()
const)
const
514 if (start ==
nullptr || path.isEmpty())
516 Node *node =
const_cast<
Node *>(start);
518 return ((pathIndex >= path.size()) ? node :
nullptr);
519 auto *current =
static_cast<Aggregate *>(node);
520 const NodeList &children = current->childNodes();
521 const QString &name = path.at(pathIndex);
522 for (
auto *node : children) {
525 if (node->name() == name) {
526 if (pathIndex + 1 >= path.size()) {
527 if ((node->*(isMatch))())
531 node = findNodeRecursive(path, pathIndex + 1, node, isMatch);
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556const Node *
Tree::findNodeForTarget(
const QStringList &path,
const QString &target,
557 const Node *start,
int flags, Genus genus,
560 const Node *node =
nullptr;
564 auto set_ref_from_target = [
this, &ref, &target](
const Node *n) ->
const Node* {
565 if (!target.isEmpty()) {
566 if (ref = getRef(target, n); ref.isEmpty())
572 if (genus == Genus::DontCare || genus == Genus::DOC) {
573 if (node = findPageNodeByTitle(path.at(0)); node) {
574 if (node = set_ref_from_target(node); node)
580
581
582
583
584
585
586
587
588
590 const bool prioritizeHierarchy = scope &&
591 ((scope
->isClassNode() && (genus == Genus::CPP || genus == Genus::DontCare)) ||
592 (scope
->isQmlType() && (genus == Genus::QML || genus == Genus::DontCare)));
595 if (!prioritizeHierarchy) {
596 result = findUnambiguousTarget(path.join(QLatin1String(
"::")), genus, start);
599 if (node = set_ref_from_target(result
->m_node); node) {
612 const Node *current = start ? start : root();
614
615
616
617
618
620 if ((genus == Genus::QML || genus == Genus::DontCare)
621 && path.size() >= 2 && !path[0].isEmpty()) {
622 if (
auto *qcn = lookupQmlType(path.sliced(0, 2).join(QLatin1String(
"::")), start); qcn) {
625 if (path.size() == 2)
626 return set_ref_from_target(qcn);
633 if (
const Node *match = matchPathAndTarget(
634 path, path_idx, target, current, flags, genus, ref);
643 if (prioritizeHierarchy) {
644 result = findUnambiguousTarget(path.join(QLatin1String(
"::")), genus, start);
647 if (node = set_ref_from_target(result
->m_node); node) {
655 if (node && result) {
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684const Node *
Tree::matchPathAndTarget(
const QStringList &path,
int idx,
const QString &target,
685 const Node *node,
int flags, Genus genus,
686 QString &ref,
int duplicates)
const
689
690
691
692
693
694 if (idx == path.size()) {
695 if (!target.isEmpty()) {
696 ref = getRef(target, node);
721 QString name = path.at(idx);
724 static_cast<
const Aggregate *>(node)->findChildren(name, nodes);
725 for (
const auto *child : std::as_const(nodes)) {
726 if (genus != Genus::DontCare && !(hasCommonGenusType(genus, child->genus())))
728 const Node *t = matchPathAndTarget(path, idx + 1, target, child, flags, genus, ref, nodes.count() - 1);
729 if (t && !t->isPrivate() && !t->isInternal())
734 const auto *enumNode = node->isAggregate() ?
735 findEnumNode(
nullptr, node, path, idx) :
736 findEnumNode(node,
nullptr, path, idx);
740 if (((genus == Genus::CPP) || (genus == Genus::DontCare)) && node
->isClassNode()
742 const ClassList bases = allBaseClasses(
static_cast<
const ClassNode *>(node));
743 for (
const auto *base : bases) {
744 const Node *t = matchPathAndTarget(path, idx, target, base, flags, genus, ref);
745 if (t && !t->isPrivate() && !t->isInternal())
747 if (target.isEmpty() && (flags & SearchEnumValues)) {
748 if ((t = findEnumNode(base->findChildNode(path.at(idx), genus, flags), base, path, idx)))
753 if (((genus == Genus::QML) || (genus == Genus::DontCare)) && node
->isQmlType()
755 const QmlTypeNode *qtn =
static_cast<
const QmlTypeNode *>(node);
758 const Node *t = matchPathAndTarget(path, idx, target, qtn, flags, genus, ref);
767
768
769
770
771
772const Node *
Tree::findNode(
const QStringList &path,
const Node *start,
int flags,
775 const Node *current = start;
776 if (current ==
nullptr)
780 const Node *node = current;
785
786
787
788
789
790
791
792 if (((genus == Genus::QML) || (genus == Genus::DontCare)) && (path.size() >= 2)
793 && !path[0].isEmpty()) {
794 QmlTypeNode *qcn = lookupQmlType(QString(path[0] +
"::" + path[1]), start);
795 if (qcn !=
nullptr) {
797 if (path.size() == 2)
803 for (i = start_idx; i < path.size(); ++i) {
812 const Node *next =
static_cast<
const Aggregate *>(node)->findChildNode(path.at(i),
814 const Node *enumNode = (flags & SearchEnumValues) ?
815 findEnumNode(next, node, path, i) :
nullptr;
821 if (!next && ((genus == Genus::CPP) || (genus == Genus::DontCare))
823 const ClassList bases = allBaseClasses(
static_cast<
const ClassNode *>(node));
824 for (
const auto *base : bases) {
825 next = base->findChildNode(path.at(i), genus, tmpFlags);
826 if (flags & SearchEnumValues)
827 if ((enumNode = findEnumNode(next, base, path, i)))
833 if (!next && ((genus == Genus::QML) || (genus == Genus::DontCare))
835 const QmlTypeNode *qtn =
static_cast<
const QmlTypeNode *>(node);
838 next = qtn->findChildNode(path.at(i), genus, tmpFlags);
843 if ((node !=
nullptr) && i == path.size())
846 }
while (current !=
nullptr);
853
854
855
856
857
858
859
860const Node *
Tree::findEnumNode(
const Node *node,
const Node *aggregate,
const QStringList &path,
int offset)
const
864 const auto *en =
static_cast<
const EnumNode*>(node);
865 if (en->hasItem(path.last()))
870 return (!node && aggregate && offset == path.size() - 1) ?
871 static_cast<
const Aggregate *>(aggregate)->findEnumNodeForValue(path.last()) :
876
877
878
879
880
881QString
Tree::getRef(
const QString &target,
const Node *node)
const
883 auto it = m_nodesByTargetTitle.constFind(target);
884 if (it != m_nodesByTargetTitle.constEnd()) {
886 if (it.value()->m_node == node)
887 return it.value()->m_ref;
889 }
while (it != m_nodesByTargetTitle.constEnd() && it.key() == target);
891 QString key = TextUtils::asAsciiPrintable(target);
892 it = m_nodesByTargetRef.constFind(key);
893 if (it != m_nodesByTargetRef.constEnd()) {
895 if (it.value()->m_node == node)
896 return it.value()->m_ref;
898 }
while (it != m_nodesByTargetRef.constEnd() && it.key() == key);
904
905
906
907
908
910 Node *node,
int priority)
912 auto *target =
new TargetRec(name, type, node, priority);
913 m_nodesByTargetRef.insert(name, target);
914 m_nodesByTargetTitle.insert(title, target);
918
919
920
921
922
923
924
927 for (
auto *child : root->childNodes()) {
928 addToPageNodeByTitleMap(child);
929 populateTocSectionTargetMap(child);
930 addKeywordsToTargetMaps(child);
931 addTargetsToTargetMap(child);
933 if (child->isAggregate())
934 resolveTargets(
static_cast<Aggregate *>(child));
941
942
943
944
945void Tree::addTargetsToTargetMap(
Node *node) {
949 QSet<QString> usedRefs;
950 for (
const Atom *heading : node->doc().tableOfContents())
951 usedRefs.insert(refForAtom(heading));
953 usedRefs.insert(
"details"_L1);
955 for (Atom *i : std::as_const(node->doc().targets())) {
956 QString ref = refForAtom(i);
957 const QString title = i->string();
958 if (!ref.isEmpty() && !title.isEmpty()) {
959 const QString rawRef = TextUtils::asAsciiPrintable(title);
962 if (i->count() == 1 && usedRefs.contains(rawRef)
963 && (!nextSection(i) || ref != rawRef)) {
964 const QString base = rawRef +
"-target"_L1;
966 for (
int n = 2; usedRefs.contains(ref); ++n)
967 ref = base +
'-'_L1 + QString::number(n);
970 usedRefs.insert(ref);
971 QString key = TextUtils::asAsciiPrintable(title);
972 auto *target =
new TargetRec(std::move(ref), TargetRec::Target, node, 2);
973 m_nodesByTargetRef.insert(key, target);
974 m_nodesByTargetTitle.insert(title, target);
980
981
982
983
992
993
994
995
996void Tree::addKeywordsToTargetMaps(
Node *node) {
1000 for (Atom *i : std::as_const(node->doc().keywords())) {
1001 QString ref = refForAtom(i);
1002 QString title = i->string();
1003 if (!ref.isEmpty() && !title.isEmpty()) {
1004 auto *target =
new TargetRec(ref, nextSection(i) ? TargetRec::ContentsKeyword : TargetRec::Keyword, node, 1);
1005 m_nodesByTargetRef.insert(TextUtils::asAsciiPrintable(title), target);
1006 m_nodesByTargetTitle.insert(title, target);
1007 if (!target->isEmpty())
1008 i->append(target->m_ref);
1014
1015
1016
1017
1018
1019void Tree::populateTocSectionTargetMap(
Node *node) {
1023 QStack<Atom *> tocLevels;
1024 QSet<QString> anchors;
1027 QString memberRef = node
->isPageNode() ? QString() : computeAnchorId(node);
1029 const auto *shared =
static_cast<
const SharedCommentNode *>(node);
1030 if (!shared->collective().isEmpty())
1031 memberRef = computeAnchorId(shared->collective().first());
1034 qsizetype index = 0;
1036 for (Atom *atom: std::as_const(node->doc().tableOfContents())) {
1037 while (!tocLevels.isEmpty() && tocLevels.top()->string().toInt() >= atom->string().toInt())
1040 tocLevels.push(atom);
1042 QString ref = refForAtom(atom);
1043 const QString &title = Text::sectionHeading(atom).toString();
1044 if (ref.isEmpty() || title.isEmpty())
1047 if (!memberRef.isEmpty() && node->parent() && node->parent()->isAggregate()) {
1048 const auto *page =
static_cast<
const Aggregate *>(node->parent());
1049 bool collides =
false;
1050 for (
const Node *sibling : page->childNodes()) {
1051 if (sibling == node)
1053 for (
const Atom *heading : sibling->doc().tableOfContents()) {
1054 if (TextUtils::asAsciiPrintable(Text::sectionHeading(heading).toString()) == ref) {
1063 ref = memberRef +
'-'_L1 + ref;
1064 }
else if (node->isAggregate()) {
1066 const auto *aggregate =
static_cast<
const Aggregate *>(node);
1067 for (
const Node *child : aggregate->childNodes()) {
1068 if (computeAnchorId(child) == ref) {
1069 ref +=
"-section"_L1;
1077 if (ref ==
"details"_L1 && node->isPageNode()) {
1078 ref +=
"-section"_L1;
1079 }
else if (ref ==
"signals"_L1 && node->isAggregate()) {
1080 const auto *aggregate =
static_cast<
const Aggregate *>(node);
1081 for (
const Node *child : aggregate->childNodes()) {
1082 if (child->isFunction() &&
static_cast<
const FunctionNode *>(child)->isSignal()) {
1083 ref +=
"-section"_L1;
1089 if (anchors.contains(ref)) {
1090 QStringList refParts;
1091 for (
const auto tocLevel : tocLevels)
1092 refParts << refForAtom(tocLevel);
1094 refParts << QString::number(index);
1095 ref = refParts.join(QLatin1Char(
'-'));
1098 anchors.insert(ref);
1099 if (atom->next(Atom::SectionHeadingLeft) && atom->next()->count() == 1)
1100 atom->next()->append(ref);
1103 const QString &key = TextUtils::asAsciiPrintable(title);
1104 auto *target =
new TargetRec(ref, TargetRec::Contents, node, 3);
1105 m_nodesByTargetRef.insert(key, target);
1106 m_nodesByTargetTitle.insert(title, target);
1111
1112
1113
1114
1115
1116void Tree::addToPageNodeByTitleMap(
Node *node) {
1120 auto *pageNode =
static_cast<PageNode *>(node);
1121 QString key = pageNode->title();
1125 if (key.contains(QChar(
' ')))
1126 key = TextUtils::asAsciiPrintable(key);
1127 const QList<PageNode *> nodes = m_pageNodesByTitle.values(key);
1129 bool alreadyThere =
std::any_of(nodes.cbegin(), nodes.cend(), [&](
const auto &knownNode) {
1130 return knownNode->isExternalPage() && knownNode->name() == pageNode->name();
1134 m_pageNodesByTitle.insert(key, pageNode);
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154const TargetRec *
Tree::findUnambiguousTarget(
const QString &target, Genus genus,
const Node *start)
const
1157 auto closelyRelated = [](
const Node *n1,
const Node *n2) {
1160 return (n1 == n2) || (n1->parent() == n2) || (n1 == n2->parent());
1163 enum class TargetCategory { Keyword, Nearby, Other };
1165 auto rank = [&](
const TargetRec *candidate) {
1166 auto category = TargetCategory::Other;
1168 category = TargetCategory::Keyword;
1169 }
else if (closelyRelated(candidate
->m_node, start)) {
1170 category = TargetCategory::Nearby;
1173 return std::pair{category, candidate->m_priority};
1176 auto findBestCandidate = [&](
const TargetMap &tgtMap,
const QString &key) {
1178 auto [it, end] = tgtMap.equal_range(key);
1181 if ((genus == Genus::DontCare) || hasCommonGenusType(genus, candidate
->genus())) {
1182 if (!best || rank(candidate) < rank(best))
1190 TargetRec *bestTarget = findBestCandidate(m_nodesByTargetTitle, target);
1192 bestTarget = findBestCandidate(m_nodesByTargetRef, TextUtils::asAsciiPrintable(target));
1198
1199
1200const PageNode *
Tree::findPageNodeByTitle(
const QString &title)
const
1202 PageNodeMultiMap::const_iterator it;
1203 if (title.contains(QChar(
' ')))
1204 it = m_pageNodesByTitle.constFind(TextUtils::asAsciiPrintable(title));
1206 it = m_pageNodesByTitle.constFind(title);
1207 if (it != m_pageNodesByTitle.constEnd()) {
1209
1210
1211
1212
1213 PageNodeMultiMap::const_iterator j = it;
1215 if (j != m_pageNodesByTitle.constEnd() && j.key() == it.key()) {
1216 while (j != m_pageNodesByTitle.constEnd()) {
1217 if (j.key() == it.key() && j.value()->url().isEmpty()) {
1222 if (j != m_pageNodesByTitle.cend()) {
1223 it.value()->location().warning(
"This page title exists in more than one file: "
1225 j.value()->location().warning(
"[It also exists here]");
1234
1235
1236
1237
1238
1239
1249 if (atom->count() >= 2)
1250 return atom->string(1);
1255 if (atom->count() >= 2)
1256 return atom->string(1);
1257 if (
const auto *section = nextSection(atom))
1258 return refForAtom(section);
1259 return TextUtils::asAsciiPrintable(atom->string());
1266
1267
1268
1269
1272
1273
1274
1275
1278
1279
1280
1281
1284
1285
1286
1295 return &m_qmlModules;
1305
1306
1307
1308
1309
1312 CNMap *map = getCollectionMap(type);
1314 auto it = map->constFind(name);
1315 if (it != map->cend())
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1337 CNMap *m = getCollectionMap(type);
1340 auto it = m->constFind(name);
1341 if (it != m->cend())
1345 m->insert(name, cn);
1350
1351
1352
1353
1354
1355
1356
1359
1360
1361
1362
1363
1364
1365
1368
1369
1370
1371
1372
1373
1374
1377
1378
1379
1380
1381
1382
1385
1386
1387
1388
1389
1390
1393
1394
1395
1396
1397
1398
1401
1402
1403
1404
1405
1406
1407
1408
1414 node->appendGroupName(name);
1420
1421
1422
1423
1424
1425
1430 node->setPhysicalModuleName(name);
1435
1436
1437
1438
1439
1443 QStringList dotSplit;
1444 QStringList blankSplit = name.split(QLatin1Char(
' '));
1445 qmid.append(blankSplit[0]);
1446 if (blankSplit.size() > 1) {
1447 qmid.append(blankSplit[0] + blankSplit[1]);
1448 dotSplit = blankSplit[1].split(QLatin1Char(
'.'));
1449 qmid.append(blankSplit[0] + dotSplit[0]);
1456 QmlTypeNode *n =
static_cast<QmlTypeNode *>(node);
1457 for (
int i = 0; i < qmid.size(); ++i) {
1458 QString key = qmid[i] +
"::" + node->name();
1459 insertQmlType(key, n);
1462 insertQmlType(node->name(), n);
1468
1469
1470
1471
1474 m_qmlTypeMap.insert(key, n);
1478
1479
1480
1481
1482
1485 auto values = m_qmlTypeMap.values(name);
1486 if (values.isEmpty())
1490 if (!relative || values.size() == 1)
1491 return values.first();
1495 const auto *relativeQmlType =
static_cast<
const QmlTypeNode *>(relative);
1496 const CollectionNode *relativeModule = relativeQmlType->logicalModule();
1498 for (
auto *candidate : values) {
1499 if (candidate->logicalModule() == relativeModule)
1505 return values.first();
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1521 const Node *relative, Genus genus)
const
1523 if (path.size() == 3 && !path[0].isEmpty()
1524 && ((genus == Genus::QML) || (genus == Genus::DontCare))) {
1525 QmlTypeNode *qcn = lookupQmlType(QString(path[0] +
"::" + path[1]), relative);
1526 if (qcn ==
nullptr) {
1527 QStringList p(path[1]);
1528 Node *n = findNodeByNameAndType(p, &Node::isQmlType);
1530 qcn =
static_cast<QmlTypeNode *>(n);
1536 if (relative ==
nullptr)
1538 else if (genus != Genus::DontCare) {
1539 if (!(hasCommonGenusType(genus, relative
->genus())))
1544 Node *node =
const_cast<
Node *>(relative);
1547 for (i = 0; i < path.size(); ++i) {
1551 Aggregate *aggregate =
static_cast<Aggregate *>(node);
1552 Node *next =
nullptr;
1553 if (i == path.size() - 1)
1556 next = aggregate->findChildNode(path.at(i), genus);
1559 const ClassList bases = allBaseClasses(
static_cast<
const ClassNode *>(aggregate));
1560 for (
auto *base : bases) {
1561 if (i == path.size() - 1)
1562 next = base->findFunctionChild(path.at(i), parameters);
1564 next = base->findChildNode(path.at(i), genus);
1566 if (next !=
nullptr)
1582 const FunctionNode *fn =
static_cast<
const FunctionNode *>(node);
1584 while (FN
->isPrivate() && !FN->overridesThis().isEmpty()) {
1585 QStringList path = FN->overridesThis().split(
"::");
1586 FN = m_qdb->findFunctionNode(path, parameters, relative, genus);
1600
1601
1602
1603
1606 if (parent ==
nullptr)
1609 for (Node *n : children) {
1610 if (n !=
nullptr && n->isFunction() && n->hasTag(tag))
1611 return static_cast<FunctionNode *>(n);
1613 for (Node *n : children) {
1614 if (n !=
nullptr && n->isAggregate()) {
1615 n = findFunctionNodeForTag(tag,
static_cast<Aggregate *>(n));
1617 return static_cast<FunctionNode *>(n);
1624
1625
1626
1629 if (parent ==
nullptr)
1632 for (Node *n : children) {
1633 if (n !=
nullptr && (n->isMacro() || n->isFunction()) && n->name() == t)
1634 return static_cast<FunctionNode *>(n);
1636 for (Node *n : children) {
1637 if (n !=
nullptr && n->isAggregate()) {
1638 FunctionNode *fn = findMacroNode(t,
static_cast<Aggregate *>(n));
1647
1648
1649
1652 arg.remove(QChar(
'('));
1653 arg.remove(QChar(
')'));
1654 QString t = arg.simplified();
1655 QStringList sl = t.split(QChar(
' '));
1658 for (
const QString &s : sl) {
1659 if (!m_dontDocumentMap.contains(s))
1660 m_dontDocumentMap.insert(s,
nullptr);
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1679 for (
auto it = m_dontDocumentMap.begin(); it != m_dontDocumentMap.end(); ++it) {
1680 Aggregate *node = findAggregate(it.key());
1681 if (node !=
nullptr)
FunctionNode * findFunctionChild(const FunctionNode *clone)
Returns the function node that is a child of this node, such that the function described has the same...
const NodeList & childNodes() const
Returns a const reference to the child list.
The Atom class is the fundamental unit for representing documents internally.
AtomType type() const
Return the type of this atom.
const Atom * next() const
Return the next atom in the atom list.
const Atom * next(AtomType t) const
Return the next Atom in the list if it is of AtomType t.
The ClassNode represents a C++ class.
void removePrivateAndInternalBases()
Remove private and internal bases classes from this class's list of base classes.
A class for holding the members of a collection of doc pages.
void addMember(Node *node) override
Appends node to the collection node's member list and updates the new member's status.
bool hasTableOfContents() const
This node is used to represent any kind of function being documented.
static bool requiresDocumentation(const InclusionPolicy &policy, const NodeContext &context)
This class represents a C++ namespace.
A PageNode is a Node that generates a documentation page.
This class describes one instance of using the Q_PROPERTY macro.
const PropertyNode * overriddenFrom() const
void addFunction(FunctionNode *function, FunctionRole role)
void setOverriddenFrom(const PropertyNode *baseProperty)
Sets this property's {overridden from} property to baseProperty, which indicates that this property o...
void addSignal(FunctionNode *function, FunctionRole role)
This class provides exclusive access to the qdoc database, which consists of a forrest of trees and a...
Status
Specifies the status of the QQmlIncubator.
QmlTypeNode * qmlBaseNode() const override
If this Aggregate is a QmlTypeNode, this function returns a pointer to the QmlTypeNode that is its ba...
static Text sectionHeading(const Atom *sectionBegin)
This class constructs and maintains a tree of instances of the subclasses of Node.
void addExternalRelates(Node *node, const QString &target)
Records that node is related to the aggregate named target, which is documented in a different module...
void markDontDocumentNodes()
The {don't document} map has been loaded with the names of classes and structs in the current module ...
void addToDontDocumentMap(QString &arg)
Add the class and struct names in arg to the {don't document} map.
Node * findNodeByNameAndType(const QStringList &path, bool(Node::*isMatch)() const) const
Find the node with the specified path name that is of the specified type and subtype.
void resolveProperties()
Resolves access functions associated with each PropertyNode stored in m_unresolvedPropertyMap,...
void addPropertyFunction(PropertyNode *property, const QString &funcName, PropertyNode::FunctionRole funcRole)
Inserts function name funcName and function role funcRole into the property function map for the spec...
Combined button and popup list for selecting options.
QList< ClassNode * > ClassList
QList< Node * > NodeVector
QMap< QString, CollectionNode * > CNMap
The Node class is the base class for all the nodes in QDoc's parse tree.
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 void setQmlModule(CollectionNode *)
If this is a QmlTypeNode, this function sets the QML type's QML module pointer to the CollectionNode ...
bool isQmlType() const
Returns true if the node type is QmlType or QmlValueType.
bool isSharedCommentNode() const
Returns true if the node type is SharedComment.
virtual bool isInternal() const
Returns true if the node's status is Internal, or if its parent is a class with Internal status.
Genus genus() const override
Returns this node's Genus.
virtual bool isPageNode() const
Returns true if this node represents something that generates a documentation page.
bool isEnumType() const
Returns true if the node type is Enum.
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.
virtual bool isAttached() const
Returns true if the QML property or QML method node is marked as attached.
Aggregate * parent() const
Returns the node's parent pointer, that is, the aggregate under which the node is documented.
virtual bool isAggregate() const
Returns true if this node is an aggregate, which means it inherits Aggregate and can therefore have c...
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.
bool isProperty() const
Returns true if the node type is Property.
NodeContext createContext() const
bool hasDoc() const
Returns true if this node is documented, or it represents a documented node read from the index ('had...
virtual bool isClassNode() const
Returns true if this is an instance of ClassNode.
virtual void setStatus(Status t)
Sets the node's status to t.
bool isQmlProperty() const
Returns true if the node type is QmlProperty.
A class for parsing and managing a function parameter list.
A record of a linkable target within the documentation.
TargetType
A type of a linkable target record.
static const Atom * nextSection(const Atom *a)
QMultiMap< QString, TargetRec * > TargetMap