| 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 | #include "genustypes.h" |
| 10 | |
| 11 | #include <QtCore/qglobal.h> |
| 12 | #include <QtCore/qlist.h> |
| 13 | #include <QtCore/qstring.h> |
| 14 | |
| 15 | QT_BEGIN_NAMESPACE |
| 16 | |
| 17 | class ClassNode; |
| 18 | class CollectionNode; |
| 19 | |
| 20 | typedef QList<ImportRec> ImportList; |
| 21 | |
| 22 | class QmlTypeNode : public Aggregate |
| 23 | { |
| 24 | public: |
| 25 | QmlTypeNode(Aggregate *parent, const QString &name, NodeType type); |
| 26 | [[nodiscard]] bool isFirstClassAggregate() const override { return true; } |
| 27 | ClassNode *classNode() override { return m_classNode; } |
| 28 | void setClassNode(ClassNode *cn) override { m_classNode = cn; } |
| 29 | [[nodiscard]] bool isAbstract() const override { return m_abstract; } |
| 30 | [[nodiscard]] bool isWrapper() const override { return m_wrapper; } |
| 31 | void setAbstract(bool b) override { m_abstract = b; } |
| 32 | void setWrapper() override { m_wrapper = true; } |
| 33 | [[nodiscard]] bool isInternal() const override { return (status() == Internal); } |
| 34 | [[nodiscard]] QString qmlFullBaseName() const override; |
| 35 | [[nodiscard]] QString logicalModuleName() const override; |
| 36 | [[nodiscard]] QString logicalModuleVersion() const override; |
| 37 | [[nodiscard]] QString logicalModuleIdentifier() const override; |
| 38 | [[nodiscard]] CollectionNode *logicalModule() const override { return m_logicalModule; } |
| 39 | void setQmlModule(CollectionNode *t) override { m_logicalModule = t; } |
| 40 | |
| 41 | void setImportList(const ImportList &il) { m_importList = il; } |
| 42 | [[nodiscard]] const QString &qmlBaseName() const { return m_qmlBaseName; } |
| 43 | void setQmlBaseName(const QString &name) { m_qmlBaseName = name; } |
| 44 | [[nodiscard]] QmlTypeNode *qmlBaseNode() const override { return m_qmlBaseNode; } |
| 45 | void resolveInheritance(NodeMap &previousSearches); |
| 46 | void checkInheritance(); |
| 47 | static void addInheritedBy(const Node *base, Node *sub); |
| 48 | static void subclasses(const Node *base, NodeList &subs); |
| 49 | static void terminate(); |
| 50 | bool inherits(Aggregate *type); |
| 51 | |
| 52 | public: |
| 53 | static QMultiMap<const Node *, Node *> s_inheritedBy; |
| 54 | |
| 55 | private: |
| 56 | bool m_abstract { false }; |
| 57 | bool m_wrapper { false }; |
| 58 | ClassNode *m_classNode { nullptr }; |
| 59 | QString m_qmlBaseName {}; |
| 60 | CollectionNode *m_logicalModule { nullptr }; |
| 61 | QmlTypeNode *m_qmlBaseNode { nullptr }; |
| 62 | ImportList m_importList {}; |
| 63 | }; |
| 64 | |
| 65 | QT_END_NAMESPACE |
| 66 | |
| 67 | #endif // QMLTYPENODE_H |
| 68 |
