9#include <QtCore/qdebug.h>
13QMultiMap<
const Node *, Node *> QmlTypeNode::s_inheritedBy;
16
17
18
19
20
28
29
30
39
40
41
44 s_inheritedBy.clear();
48
49
50
55 if (!s_inheritedBy.contains(base, sub))
56 s_inheritedBy.insert(base, sub);
60
61
64 if (s_inheritedBy.count(base) > 0) {
66 for (
auto *sub : s_inheritedBy.values(base)) {
67 if (!subs.contains(sub)) {
69 QmlTypeNode::subclasses(sub, subs, recurse);
73 subs = s_inheritedBy.values(base);
78
79
80
81
86 result = m_qmlBaseNode->logicalModuleName() +
"::" + m_qmlBaseNode->name();
92
93
94
95
98 return (m_logicalModule ? m_logicalModule->logicalModuleName() : QString());
102
103
104
105
108 return (m_logicalModule ? m_logicalModule->logicalModuleVersion() : QString());
112
113
114
115
118 return (m_logicalModule ? m_logicalModule->logicalModuleIdentifier() : QString());
122
123
127 while (qtn !=
nullptr) {
136
137
138
139
140
143 if (m_qmlBaseNode || m_qmlBaseName.isEmpty())
146 auto *base =
static_cast<
QmlTypeNode *>(previousSearches.value(m_qmlBaseName));
150 bool needsSearch = !previousSearches.contains(m_qmlBaseName);
155 for (
const auto &imp : std::as_const(m_importList)) {
156 base = QDocDatabase::qdocDB()->findQmlType(imp, m_qmlBaseName,
this);
161 if (m_qmlBaseName.contains(
':'))
168 previousSearches.insert(m_qmlBaseName, base);
173 m_qmlBaseNode = base;
176 if (base->isIndexNode())
177 base->resolveInheritance(previousSearches);
179 location().warning(QStringLiteral(
"Type is its own base type: '%1'").arg(name()));
183 location().report(QStringLiteral(
"Unknown base '%1' for QML type '%2'").arg(qmlBaseName(), name()));
187
188
192
199 while (qtn && hare) {
204
205
206 for (
int i = 0; i < 2; i++)
213 if (previous && qtn && hare && qtn == hare) {
214 location().warning(QStringLiteral(
"Cyclic type inheritance: '%1'").arg(previous->name()));
215 previous->m_qmlBaseNode =
nullptr;
The ClassNode represents a C++ class.
QmlNativeTypeAttribute qmlNativeTypeAttribute() 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.
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,...
bool inherits(const Aggregate *type) const
Returns true if this QML type inherits 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.
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...
void setClassNode(ClassNode *cn) override
Set ClassNode cn as this QML type's {native type}, and adopts its attribute if not set explicitly.
CollectionNode * logicalModule() const override
If this is a QmlTypeNode, a pointer to its QML module is returned, which is a pointer to a Collection...
QmlNativeTypeAttribute
Defines QML-specific attributes affecting QmlTypeNode instances.
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.