8#include <QtCore/qdebug.h>
12QMultiMap<
const Node *, Node *> QmlTypeNode::s_inheritedBy;
15
16
17
18
19
27
28
29
32 s_inheritedBy.clear();
36
37
38
43 if (!s_inheritedBy.contains(base, sub))
44 s_inheritedBy.insert(base, sub);
48
49
52 if (s_inheritedBy.count(base) > 0) {
54 for (
auto *sub : s_inheritedBy.values(base)) {
55 if (!subs.contains(sub)) {
57 QmlTypeNode::subclasses(sub, subs, recurse);
61 subs = s_inheritedBy.values(base);
66
67
68
69
74 result = m_qmlBaseNode->logicalModuleName() +
"::" + m_qmlBaseNode->name();
80
81
82
83
86 return (m_logicalModule ? m_logicalModule->logicalModuleName() : QString());
90
91
92
93
96 return (m_logicalModule ? m_logicalModule->logicalModuleVersion() : QString());
100
101
102
103
106 return (m_logicalModule ? m_logicalModule->logicalModuleIdentifier() : QString());
110
111
115 while (qtn !=
nullptr) {
124
125
126
127
128
131 if (m_qmlBaseNode || m_qmlBaseName.isEmpty())
134 auto *base =
static_cast<QmlTypeNode *>(previousSearches.value(m_qmlBaseName));
138 bool needsSearch = !previousSearches.contains(m_qmlBaseName);
143 for (
const auto &imp : std::as_const(m_importList)) {
144 base = QDocDatabase::qdocDB()->findQmlType(imp, m_qmlBaseName,
this);
149 if (m_qmlBaseName.contains(
':'))
150 base = QDocDatabase::qdocDB()->findQmlType(m_qmlBaseName,
this);
152 base = QDocDatabase::qdocDB()->findQmlType(QString(), m_qmlBaseName,
this);
155 if (!logicalModule())
156 previousSearches.insert(m_qmlBaseName, base);
161 m_qmlBaseNode = base;
164 if (base->isIndexNode())
165 base->resolveInheritance(previousSearches);
167 location().warning(QStringLiteral(
"Type is its own base type: '%1'").arg(name()));
171 location().report(QStringLiteral(
"Unknown base '%1' for QML type '%2'").arg(qmlBaseName(), name()));
175
176
180
187 while (qtn && hare) {
192
193
194 for (
int i = 0; i < 2; i++)
201 if (previous && qtn && hare && qtn == hare) {
202 location().warning(QStringLiteral(
"Cyclic type inheritance: '%1'").arg(previous->name()));
203 previous->m_qmlBaseNode =
nullptr;
static void terminate()
Clear the static maps so that subsequent runs don't try to use contents from a previous run.
QmlTypeNode(Aggregate *parent, const QString &name, NodeType type)
Constructs a Qml type.
QString qmlFullBaseName() const override
If this QML type node has a base type node, return the fully qualified name of that QML type,...
QString logicalModuleIdentifier() const override
If the QML type's QML module pointer is set, return the QML module identifier from the QML module nod...
static void subclasses(const Node *base, NodeList &subs, bool recurse=false)
Loads the list subs with the nodes of all the subclasses of base.
bool inherits(Aggregate *type)
Returns true if this QML type inherits type.
QString logicalModuleVersion() const override
If the QML type's QML module pointer is set, return the QML module version from the QML module node.
void resolveInheritance(NodeMap &previousSearches)
Recursively resolves the base node for this QML type when only the name of the base type is known.
static void addInheritedBy(const Node *base, Node *sub)
Record the fact that QML class base is inherited by QML class sub.
void checkInheritance()
Checks and warns about problems with the inheritance of this QML type.
QString logicalModuleName() const override
If the QML type's QML module pointer is set, return the QML module name from the QML module node.
QmlTypeNode * qmlBaseNode() const override
If this Aggregate is a QmlTypeNode, this function returns a pointer to the QmlTypeNode that is its ba...
CollectionNode * logicalModule() const override
If this is a QmlTypeNode, a pointer to its QML module is returned, which is a pointer to a Collection...
Combined button and popup list for selecting options.
QMap< QString, Node * > NodeMap
The Node class is the base class for all the nodes in QDoc's parse tree.
virtual bool isInternal() const
Returns true if the node's status is Internal, or if its parent is a class with Internal status.
const Location & location() const
If this node's definition location is empty, this function returns this node's declaration location.