diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-03-24 18:21:15 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-03-25 10:51:47 +0100 |
commit | 3f0c9122c5971090d0256bda4e9fb53da4a76ea0 (patch) | |
tree | ca51902e6fb457e61da574d55ebee72d7a28ca7a /src/qml/jsruntime/qv4resolvedtypereference_p.h | |
parent | d9eeab6e2c699761115d9acbca292c16762eb8f3 (diff) |
Encapsulate QV4::ResolvedTypeReference
It's used all over the place. We need a proper interface.
Change-Id: Iebe254ef3bf35503bf3fdd3639979a5db2b3449e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4resolvedtypereference_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4resolvedtypereference_p.h | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4resolvedtypereference_p.h b/src/qml/jsruntime/qv4resolvedtypereference_p.h new file mode 100644 index 0000000000..88b77cf2a8 --- /dev/null +++ b/src/qml/jsruntime/qv4resolvedtypereference_p.h @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QV4RESOLVEDTYPEREFERNCE_P_H +#define QV4RESOLVEDTYPEREFERNCE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtQml/private/qtqmlglobal_p.h> +#include <QtQml/private/qqmlrefcount_p.h> +#include <QtQml/private/qqmlpropertycache_p.h> +#include <QtQml/private/qqmltype_p.h> +#include <QtQml/private/qv4executablecompilationunit_p.h> + +QT_BEGIN_NAMESPACE + +class QCryptographicHash; +namespace QV4 { + +class ResolvedTypeReference +{ + Q_DISABLE_COPY_MOVE(ResolvedTypeReference) +public: + ResolvedTypeReference() = default; + + QQmlRefPointer<QQmlPropertyCache> propertyCache() const; + QQmlRefPointer<QQmlPropertyCache> createPropertyCache(QQmlEngine *); + bool addToHash(QCryptographicHash *hash, QQmlEngine *engine); + + void doDynamicTypeCheck(); + + QQmlType type() const { return m_type; } + void setType(QQmlType type) { m_type = std::move(type); } + + QQmlRefPointer<QV4::ExecutableCompilationUnit> compilationUnit() { return m_compilationUnit; } + void setCompilationUnit(QQmlRefPointer<QV4::ExecutableCompilationUnit> unit) + { + m_compilationUnit = std::move(unit); + } + + QQmlRefPointer<QQmlPropertyCache> typePropertyCache() const { return m_typePropertyCache; } + void setTypePropertyCache(QQmlRefPointer<QQmlPropertyCache> cache) + { + m_typePropertyCache = std::move(cache); + } + + QTypeRevision version() const { return m_version; } + void setVersion(QTypeRevision version) { m_version = version; } + + bool isFullyDynamicType() const { return m_isFullyDynamicType; } + void setFullyDynamicType(bool fullyDynamic) { m_isFullyDynamicType = fullyDynamic; } + +private: + QQmlType m_type; + QQmlRefPointer<QQmlPropertyCache> m_typePropertyCache; + QQmlRefPointer<QV4::ExecutableCompilationUnit> m_compilationUnit; + + QTypeRevision m_version = QTypeRevision::zero(); + // Types such as QQmlPropertyMap can add properties dynamically at run-time and + // therefore cannot have a property cache installed when instantiated. + bool m_isFullyDynamicType = false; +}; + +} // namespace QV4 + +QT_END_NAMESPACE + +#endif // QV4RESOLVEDTYPEREFERNCE_P_H |