15using namespace Qt::Literals::StringLiterals;
20
21
24
25
26
27
28
31
32
33
34
35
38 for (
auto &child : m_children) {
41 if (child->parent() !=
this)
43 else if (child->isAggregate())
44 static_cast<Aggregate*>(child)->dropNonRelatedMembers();
49
50
54 if (isNamespace() && name().isEmpty())
55 dropNonRelatedMembers();
57 m_enumChildren.clear();
58 m_nonfunctionMap.clear();
59 m_functionMap.clear();
65
66
67
68
69
70
71
72
73
77 Node *node = m_nonfunctionMap.value(name);
81 const NodeList &nodes = m_nonfunctionMap.values(name);
82 for (
auto *node : nodes) {
83 if (genus & node->genus()) {
84 if (findFlags & TypesOnly) {
85 if (!node->isTypedef() && !node->isClassNode()
86 && !node->isQmlType() && !node->isEnumType())
88 }
else if (findFlags & IgnoreModules && node->isModule())
97 auto it = m_functionMap.find(name);
98 return it != m_functionMap.end() ? (*(*it).begin()) :
nullptr;
102
103
104
108 const auto &functions = m_functionMap.value(name);
109 nodes.reserve(functions.size() + m_nonfunctionMap.count(name));
110 for (
auto f : functions)
111 nodes.emplace_back(f);
112 auto [it, end] = m_nonfunctionMap.equal_range(name);
114 nodes.emplace_back(*it);
120
121
122
123
124
125
128 const NodeList &nodes = m_nonfunctionMap.values(name);
129 for (
auto *node : nodes) {
130 if ((node->*(isMatch))())
137
138
139
140
141
142
143
144
147 auto map_it = m_functionMap.find(name);
148 if (map_it == m_functionMap.end())
151 auto match_it =
std::find_if((*map_it).begin(), (*map_it).end(),
157 for (
int i = 0; i < parameters
.count(); ++i)
163 if (match_it != (*map_it).end())
168 auto *fn = (*(*map_it).begin());
169 return (parameters
.isEmpty() && !fn->isInternal()) ? fn :
nullptr;
173
174
175
176
177
178
181 auto funcs_it = m_functionMap.find(clone->name());
182 if (funcs_it == m_functionMap.end())
185 auto func_it =
std::find_if((*funcs_it).begin(), (*funcs_it).end(),
190 return func_it != (*funcs_it).end() ? *func_it :
nullptr;
194
195
196
197
200 for (
auto *child : std::as_const(m_children)) {
201 if (!child->hasDoc() && !child->isDontDocument()) {
202 if (!child->docMustBeGenerated()) {
203 if (child->isFunction()) {
204 if (
static_cast<FunctionNode *>(child)->hasAssociatedProperties())
206 }
else if (child->isTypedef()) {
207 if (
static_cast<TypedefNode *>(child)->hasAssociatedEnum())
210 child->setAccess(Access::Private);
211 child->setStatus(Node::Internal);
214 if (child->isAggregate()) {
215 static_cast<Aggregate *>(child)->markUndocumentedChildrenInternal();
221
222
223
224
225
226
227
232 for (
auto *node : m_children) {
233 if (node->isRelatedNonmember())
235 if (node->genus() != Node::CPP)
238 if (!node->isAggregate()) {
239 const auto &relates_args = node->doc().metaCommandArgs(
"relates"_L1);
240 if (relates_args.isEmpty())
243 auto *aggregate = database->findRelatesNode(relates_args[0].first.split(
"::"_L1));
245 aggregate =
new ProxyNode(
this, relates_args[0].first);
246 else if (node->parent() == aggregate)
249 aggregate->adoptChild(node);
250 node->setRelatedNonmember(
true);
252 static_cast<Aggregate*>(node)->resolveRelates();
258
259
260
261
262
263
264
265
266
267
270 for (
auto map_it = m_functionMap.begin(); map_it != m_functionMap.end(); ++map_it) {
271 if ((*map_it).size() > 1) {
272 std::sort((*map_it).begin(), (*map_it).end(),
285 for (
auto *fn : (*map_it))
286 fn->setOverloadNumber(n++);
290 for (
auto *node : std::as_const(m_children)) {
291 if (node->isAggregate())
292 static_cast<Aggregate *>(node)->normalizeOverloads();
297
298
299
300
303 m_nonfunctionList = m_nonfunctionMap.values();
305 m_nonfunctionList.erase(
std::unique(m_nonfunctionList.begin(), m_nonfunctionList.end()),
306 m_nonfunctionList.end());
307 return m_nonfunctionList;
311
312
313
316
317
318
319
320
323 for (
const auto *node : m_enumChildren) {
324 const auto *en =
static_cast<
const EnumNode *>(node);
325 if (en->hasItem(enumValue))
332
333
334
335
336
339 m_nonfunctionMap.insert(title, child);
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
364 child->setUrl(QString());
368 m_functionMap[child->name()].emplace_back(
static_cast<FunctionNode *>(child));
369 }
else if (!child->name().isEmpty()) {
370 m_nonfunctionMap.insert(child->name(), child);
372 m_enumChildren.append(child);
377
378
379
380
381
382
383
390 m_functionMap[child->name()].emplace_back(
static_cast<FunctionNode *>(child));
391 }
else if (!child->name().isEmpty()) {
392 m_nonfunctionMap.insert(child->name(), child);
394 m_enumChildren.append(child);
398 for (Node *n : scn->collective())
405
406
407
411 for (
auto *child : std::as_const(m_children)) {
412 if (child->nodeType() == goal) {
413 if (child->name() == n)
414 return static_cast<QmlPropertyNode *>(child);
421
422
423
427 for (
auto *child : std::as_const(m_children)) {
428 if (child->nodeType() == goal) {
429 if (child->name() == n && child->isAttached() == attached)
430 return static_cast<QmlPropertyNode *>(child);
437
438
439
440
441
444 auto it = m_functionMap.find(fn->name());
445 return !(it == m_functionMap.end()) && (it.value().size() > 1);
449
450
451
452
453
454
455
464
465
466
467
468
469
470
473 for (
auto functions : m_functionMap) {
474 std::for_each(functions.begin(), functions.end(),
475 [&functionIndex](FunctionNode *fn) {
477 functionIndex[fn->name()].insert(fn->parent()->fullDocumentName(), fn);
482 for (Node *node : std::as_const(m_children)) {
483 if (node->isAggregate() && !node->isPrivate() && !node->isDontDocument())
484 static_cast<Aggregate *>(node)->findAllFunctions(functionIndex);
489
490
491
492
493
494
495
496
497
498
499
500
501
504 for (
auto *node : std::as_const(m_children)) {
505 if (node->isAggregate() && !node->isPrivate()) {
506 if (node->isNamespace() && !node->name().isEmpty())
507 namespaces.insert(node->name(), node);
508 static_cast<Aggregate *>(node)->findAllNamespaces(namespaces);
514
515
516
519 for (
const auto *node : m_children)
520 if (!node->isPrivate() && node->isDeprecated()) {
521 if (node->isFunction() || node->isProperty() || node->isEnumType() || node->isTypedef()
522 || node->isTypeAlias() || node->isVariable() || node->isQmlProperty())
529
530
531
532
533
536 for (
auto *node : std::as_const(m_children)) {
537 if (!node->isPrivate()) {
538 if (node->isDeprecated()) {
539 if (node->isClassNode())
540 QDocDatabase::obsoleteClasses().insert(node->qualifyCppName(), node);
541 else if (node->isQmlType())
542 QDocDatabase::obsoleteQmlTypes().insert(node->qualifyQmlName(), node);
543 }
else if (node->isClassNode()) {
544 auto *a =
static_cast<Aggregate *>(node);
545 if (a->hasObsoleteMembers())
546 QDocDatabase::classesWithObsoleteMembers().insert(node->qualifyCppName(), node);
547 }
else if (node->isQmlType()) {
548 auto *a =
static_cast<Aggregate *>(node);
549 if (a->hasObsoleteMembers())
550 QDocDatabase::qmlTypesWithObsoleteMembers().insert(node->qualifyQmlName(),
552 }
else if (node->isAggregate()) {
553 static_cast<Aggregate *>(node)->findAllObsoleteThings();
560
561
562
563
566 for (
auto *node : std::as_const(m_children)) {
567 if (!node->isPrivate() && !node->isInternal() && !node->isDontDocument()
568 && node->tree()->camelCaseModuleName() != QString(
"QDoc")) {
569 if (node->isClassNode()) {
570 QDocDatabase::cppClasses().insert(node->qualifyCppName().toLower(), node);
571 }
else if (node->isQmlType()) {
572 QString name = node->name().toLower();
573 QDocDatabase::qmlTypes().insert(name, node);
575 if (node->isQmlBasicType())
576 QDocDatabase::qmlBasicTypes().insert(name, node);
577 }
else if (node->isExample()) {
579 QString title = node->tree()->indexTitle();
580 if (!QDocDatabase::examples().contains(title, node))
581 QDocDatabase::examples().insert(title, node);
582 }
else if (node->isAggregate()) {
583 static_cast<Aggregate *>(node)->findAllClasses();
590
591
592
595 for (
auto *node : std::as_const(m_children)) {
596 if (!node->isPrivate()) {
597 if (node->isPageNode() &&
static_cast<PageNode*>(node)->isAttribution())
598 attributions.insert(node->tree()->indexTitle(), node);
599 else if (node->isAggregate())
600 static_cast<Aggregate *>(node)->findAllAttributions(attributions);
606
607
608
609
610
611
612
615 for (
auto *node : std::as_const(m_children)) {
616 if (node->isRelatedNonmember() && node->parent() !=
this)
618 QString sinceString = node->since();
620 if (node->isInAPI() && !sinceString.isEmpty()) {
623 auto &nsmap = QDocDatabase::newSinceMaps()[sinceString];
624 auto &ncmap = QDocDatabase::newClassMaps()[sinceString];
625 auto &nqcmap = QDocDatabase::newQmlTypeMaps()[sinceString];
627 if (node->isFunction()) {
629 auto *fn =
static_cast<FunctionNode *>(node);
630 if (!fn->isDeprecated() && !fn->isSomeCtor() && !fn->isDtor())
631 nsmap.insert(fn->name(), fn);
632 }
else if (node->isClassNode()) {
634 QString name = node->qualifyWithParentName();
635 nsmap.insert(name, node);
636 ncmap.insert(name, node);
637 }
else if (node->isQmlType()) {
639 QString name = node->qualifyWithParentName();
640 nsmap.insert(name, node);
641 nqcmap.insert(name, node);
642 }
else if (node->isQmlProperty()) {
644 nsmap.insert(node->name(), node);
647 QString name = node->qualifyWithParentName();
648 nsmap.insert(name, node);
652 if (node->isInAPI() && node->isEnumType()) {
653 for (
const auto &val :
static_cast<EnumNode *>(node)->items()) {
654 sinceString = val.since();
655 if (sinceString.isEmpty())
658 QDocDatabase::newEnumValueMaps()[sinceString].insert(
659 node->name() +
"::" + val.name(), node);
663 QDocDatabase::newSinceMaps()[sinceString].replace(QString(), node);
668 if (node->isAggregate())
669 static_cast<Aggregate *>(node)->findAllSince();
674
675
676
680 for (
auto *child : std::as_const(m_children)) {
681 if (!child->isQmlType())
683 static_cast<QmlTypeNode *>(child)->resolveInheritance(previousSearches);
688
689
690
691
702 case Node::Namespace:
703 return "Namespace"_L1;
715 case Node::Namespace:
716 return "namespace"_L1;
725
726
729
730
733
734
737
738
741
742
743
744
745
748
749
750
751
754
755
756
757
758
761
762
763
764
765
766
767
static bool keep(FunctionNode *fn)
void resolveRelates()
Adopts each non-aggregate C++ node (function/macro, typedef, enum, variable, or a shared comment node...
void adoptChild(Node *child)
This Aggregate becomes the adoptive parent of child.
QString typeWord(bool cap) const
Returns a word representing the kind of Aggregate this node is.
void resolveQmlInheritance()
Resolves the inheritance information for all QML type children of this aggregate.
void addChildByTitle(Node *child, const QString &title)
Adds the child to this node's child map using title as the key.
QmlPropertyNode * hasQmlProperty(const QString &) const
If this node has a child that is a QML property named n, return a pointer to that child.
bool hasOverloads(const FunctionNode *fn) const
Returns true if this aggregate has multiple function overloads matching the name of fn.
Node * findChildNode(const QString &name, Node::Genus genus, int findFlags=0) const
If genus is {Node::DontCare}, find the first node in this node's child list that has the given name.
void findAllObsoleteThings()
Finds all the obsolete C++ classes and QML types in this aggregate and all the C++ classes and QML ty...
~Aggregate() override
Destroys this Aggregate; deletes each child.
void findChildren(const QString &name, NodeVector &nodes) const
Find all the child nodes of this node that are named name and return them in nodes.
bool hasObsoleteMembers() const
Returns true if this aggregate contains at least one child that is marked obsolete.
FunctionNode * findFunctionChild(const QString &name, const Parameters ¶meters)
Find a function node that is a child of this node, such that the function node has the specified name...
void findAllSince()
Finds all the nodes in this node where a {since} command appeared in the qdoc comment and sorts them ...
void normalizeOverloads()
Sorts the lists of overloads in the function map and assigns overload numbers.
Node * findNonfunctionChild(const QString &name, bool(Node::*)() const)
This function searches for a child node of this Aggregate, such that the child node has the spacified...
void findAllFunctions(NodeMapMap &functionIndex)
Insert all functions declared in this aggregate into the functionIndex.
void findAllNamespaces(NodeMultiMap &namespaces)
For each child of this node, if the child is a namespace node, insert the child into the namespaces m...
void markUndocumentedChildrenInternal()
Mark all child nodes that have no documentation as having private access and internal status.
void addChild(Node *child)
Adds the child to this node's child list and sets the child's parent pointer to this Aggregate.
FunctionNode * findFunctionChild(const FunctionNode *clone)
Returns the function node that is a child of this node, such that the function described has the same...
QmlPropertyNode * hasQmlProperty(const QString &, bool attached) const
If this node has a child that is a QML property named n and that also matches attached,...
const NodeList & nonfunctionList()
Returns a const reference to the list of child nodes of this aggregate that are not function nodes.
void findAllClasses()
Finds all the C++ classes, QML types, QML basic types, and examples in this aggregate and inserts the...
void findAllAttributions(NodeMultiMap &attributions)
Find all the attribution pages in this node and insert them into attributions.
const EnumNode * findEnumNodeForValue(const QString &enumValue) const
Finds the enum type node that has enumValue as one of its enum values and returns a pointer to it.
This node is used to represent any kind of function being documented.
const Parameters & parameters() const
bool isDeprecated() const override
\reimp
friend int compare(const FunctionNode *f1, const FunctionNode *f2)
Compares FunctionNode f1 with f2, assumed to have identical names.
bool isPrivate() const
Returns true if this node's access is Private.
void setIndexNodeFlag(bool isIndexNode=true)
Sets a flag in this Node that indicates the node was created for something in an index file.
NodeType
An unsigned char value that identifies an object as a particular subclass of Node.
bool isFunction(Genus g=DontCare) const
Returns true if this is a FunctionNode and its Genus is set to g.
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.
bool isEnumType() const
Returns true if the node type is Enum.
Aggregate * parent() const
Returns the node's parent pointer.
NodeType nodeType() const
Returns this node's type.
static bool nodeNameLessThan(const Node *first, const Node *second)
Returns true if the node n1 is less than node n2.
Genus
An unsigned char value that specifies whether the Node represents a C++ element, a QML element,...
Genus genus() const
Returns this node's Genus.
bool hasDoc() const
Returns true if this node is documented, or it represents a documented node read from the index ('had...
void setParent(Aggregate *n)
Sets the node's parent pointer to n.
LinkType
An unsigned char value that probably should be moved out of the Node base class.
bool isIndexNode() const
Returns true if this node was created from something in an index file.
A class for parsing and managing a function parameter list.
const Parameter & at(int i) const
This class provides exclusive access to the qdoc database, which consists of a forrest of trees and a...
static QDocDatabase * qdocDB()
Creates the singleton.
QList< Node * > NodeVector
QMap< QString, Node * > NodeMap
QMap< QString, NodeMap > NodeMapMap
QMultiMap< QString, Node * > NodeMultiMap