Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qv4resolvedtypereference_p.h
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant
4
5#ifndef QV4RESOLVEDTYPEREFERNCE_P_H
6#define QV4RESOLVEDTYPEREFERNCE_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQml/private/qtqmlglobal_p.h>
20#include <QtQml/private/qqmlrefcount_p.h>
21#include <QtQml/private/qqmlpropertycache_p.h>
22#include <QtQml/private/qqmltype_p.h>
23#include <QtQml/private/qv4compileddata_p.h>
24
25QT_BEGIN_NAMESPACE
26
27class QCryptographicHash;
28namespace QV4 {
29
31{
33public:
35
37 bool addToHash(QCryptographicHash *hash, QHash<quintptr, QByteArray> *checksums);
38
39 void doDynamicTypeCheck();
40
41 QQmlType type() const { return m_type; }
42 void setType(QQmlType type) { m_type = std::move(type); }
43
44 // The compilation unit is stored for all composite type references that aren't
45 // self-references. It is needed both for object creation and for dependency
46 // checksum computation. Cyclic references between compilation units cannot
47 // occur because the type loader detects circular dependencies at resolution
48 // time, before buildTypeResolutionCaches runs.
49 // If the reference points to a type from the same compilation unit, it won't
50 // hold a compilation unit since the object creator can just use the one it has already.
52 {
53 Q_ASSERT(!m_isSelfReference);
54 return m_compilationUnit;
55 }
56
57 void setCompilationUnit(const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &unit)
58 {
59 Q_ASSERT(!m_isSelfReference);
60 m_compilationUnit = unit;
61 }
62
63 QQmlPropertyCache::ConstPtr typePropertyCache() const { return m_typePropertyCache; }
64 void setTypePropertyCache(QQmlPropertyCache::ConstPtr cache)
65 {
66 m_typePropertyCache = std::move(cache);
67 }
68
69 QTypeRevision version() const { return m_version; }
70 void setVersion(QTypeRevision version) { m_version = version; }
71
72 bool isFullyDynamicType() const { return m_isFullyDynamicType; }
73 void setFullyDynamicType(bool fullyDynamic) { m_isFullyDynamicType = fullyDynamic; }
74
75 // Whether the reference points to a type from the same compilation unit. This doesn't
76 // have to be the top-level type but can also be an inline component.
77 bool isSelfReference() const { return m_isSelfReference; }
78 void setIsSelfReference(bool selfReference) { m_isSelfReference = selfReference; }
79
80private:
81 QQmlType m_type;
82 QQmlPropertyCache::ConstPtr m_typePropertyCache;
83 QQmlRefPointer<QV4::CompiledData::CompilationUnit> m_compilationUnit;
84
85 QTypeRevision m_version = QTypeRevision::zero();
86 // Types such as QQmlPropertyMap can add properties dynamically at run-time and
87 // therefore cannot have a property cache installed when instantiated.
88 bool m_isFullyDynamicType = false;
89 bool m_isSelfReference = false;
90};
91
92} // namespace QV4
93
94QT_END_NAMESPACE
95
96#endif // QV4RESOLVEDTYPEREFERNCE_P_H
QQmlPropertyCache::ConstPtr typePropertyCache() const
bool addToHash(QCryptographicHash *hash, QHash< quintptr, QByteArray > *checksums)
void setFullyDynamicType(bool fullyDynamic)
void setIsSelfReference(bool selfReference)
QQmlRefPointer< QV4::CompiledData::CompilationUnit > compilationUnit() const
void setTypePropertyCache(QQmlPropertyCache::ConstPtr cache)
void setCompilationUnit(const QQmlRefPointer< QV4::CompiledData::CompilationUnit > &unit)
void setVersion(QTypeRevision version)
QQmlPropertyCache::ConstPtr createPropertyCache()
Combined button and popup list for selecting options.
Definition qjsvalue.h:24
bool qtTypeInherits(const QMetaObject *mo)