diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-12-09 20:10:42 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-12-12 20:26:22 +0100 |
commit | 83b8c11bd012ca99b51aaa61bae5b4cce0d78f5b (patch) | |
tree | 09bfbd513053ff2c1773439a48359a6aee7d0064 /src/qmlcompiler/qqmljsscope_p.h | |
parent | 75df19165e5f8a4702ce465f5e56d667f16324ea (diff) |
Rename QQmlJSImporter::CacheKey to QQmlJSScope::Import
That's what it is, after all: A thing a QML scope can import. It
correlates nicely with QQmlJSScope::Export.
Change-Id: Ibcc71e753332eed4dc0532670a9156c4f2355379
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsscope_p.h')
-rw-r--r-- | src/qmlcompiler/qqmljsscope_p.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/qmlcompiler/qqmljsscope_p.h b/src/qmlcompiler/qqmljsscope_p.h index 8e45ccc32d..be34033b6d 100644 --- a/src/qmlcompiler/qqmljsscope_p.h +++ b/src/qmlcompiler/qqmljsscope_p.h @@ -127,6 +127,40 @@ public: Q_DECLARE_FLAGS(Flags, Flag) Q_FLAGS(Flags); + class Import + { + public: + Import() = default; + Import(QString prefix, QString name, QTypeRevision version, bool isFile, bool isDependency); + + bool isValid() const; + + QString prefix() const { return m_prefix; } + QString name() const { return m_name; } + QTypeRevision version() const { return m_version; } + bool isFile() const { return m_isFile; } + bool isDependency() const { return m_isDependency; } + + private: + QString m_prefix; + QString m_name; + QTypeRevision m_version; + bool m_isFile = false; + bool m_isDependency = false; + + friend inline size_t qHash(const Import &key, size_t seed = 0) noexcept + { + return qHashMulti(seed, key.m_prefix, key.m_name, key.m_version, + key.m_isFile, key.m_isDependency); + } + + friend inline bool operator==(const Import &a, const Import &b) + { + return a.m_prefix == b.m_prefix && a.m_name == b.m_name && a.m_version == b.m_version + && a.m_isFile == b.m_isFile && a.m_isDependency == b.m_isDependency; + } + }; + class Export { public: Export() = default; |