1 | // Copyright (C) 2021 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
3 | |
4 | #ifndef QMLTYPENODE_H |
5 | #define QMLTYPENODE_H |
6 | |
7 | #include "importrec.h" |
8 | #include "aggregate.h" |
9 | |
10 | #include <QtCore/qglobal.h> |
11 | #include <QtCore/qlist.h> |
12 | #include <QtCore/qstring.h> |
13 | |
14 | QT_BEGIN_NAMESPACE |
15 | |
16 | class ClassNode; |
17 | class CollectionNode; |
18 | |
19 | typedef QList<ImportRec> ImportList; |
20 | |
21 | class QmlTypeNode : public Aggregate |
22 | { |
23 | public: |
24 | QmlTypeNode(Aggregate *parent, const QString &name, Node::NodeType type); |
25 | [[nodiscard]] bool isFirstClassAggregate() const override { return true; } |
26 | [[nodiscard]] bool isQtQuickNode() const override |
27 | { |
28 | return (logicalModuleName() == QLatin1String("QtQuick")); |
29 | } |
30 | ClassNode *classNode() override { return m_classNode; } |
31 | void setClassNode(ClassNode *cn) override { m_classNode = cn; } |
32 | [[nodiscard]] bool isAbstract() const override { return m_abstract; } |
33 | [[nodiscard]] bool isWrapper() const override { return m_wrapper; } |
34 | void setAbstract(bool b) override { m_abstract = b; } |
35 | void setWrapper() override { m_wrapper = true; } |
36 | [[nodiscard]] bool isInternal() const override { return (status() == Internal); } |
37 | [[nodiscard]] QString qmlFullBaseName() const override; |
38 | [[nodiscard]] QString logicalModuleName() const override; |
39 | [[nodiscard]] QString logicalModuleVersion() const override; |
40 | [[nodiscard]] QString logicalModuleIdentifier() const override; |
41 | [[nodiscard]] CollectionNode *logicalModule() const override { return m_logicalModule; } |
42 | void setQmlModule(CollectionNode *t) override { m_logicalModule = t; } |
43 | |
44 | void setImportList(const ImportList &il) { m_importList = il; } |
45 | [[nodiscard]] const QString &qmlBaseName() const { return m_qmlBaseName; } |
46 | void setQmlBaseName(const QString &name) { m_qmlBaseName = name; } |
47 | [[nodiscard]] QmlTypeNode *qmlBaseNode() const override { return m_qmlBaseNode; } |
48 | void resolveInheritance(NodeMap &previousSearches); |
49 | static void addInheritedBy(const Node *base, Node *sub); |
50 | static void subclasses(const Node *base, NodeList &subs); |
51 | static void terminate(); |
52 | bool inherits(Aggregate *type); |
53 | |
54 | public: |
55 | static QMultiMap<const Node *, Node *> s_inheritedBy; |
56 | |
57 | private: |
58 | bool m_abstract { false }; |
59 | bool m_wrapper { false }; |
60 | ClassNode *m_classNode { nullptr }; |
61 | QString m_qmlBaseName {}; |
62 | CollectionNode *m_logicalModule { nullptr }; |
63 | QmlTypeNode *m_qmlBaseNode { nullptr }; |
64 | ImportList m_importList {}; |
65 | }; |
66 | |
67 | QT_END_NAMESPACE |
68 | |
69 | #endif // QMLTYPENODE_H |
70 |