aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlpropertycachevector_p.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2020-03-04 14:54:54 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2020-04-03 12:35:23 +0200
commit448b2a5d838d082c66ab649cc7b71c31761bf409 (patch)
tree17888b90b9e03eb52e2ba03611146a66a87e31a1 /src/qml/qml/qqmlpropertycachevector_p.h
parentf1fd2b982a2ceae92da9b4a3875c65ed8a49560d (diff)
Replace QFlagPointer with QTaggedPointer
The latter has the advantage of allowing the use of a real type for the tag, instead of the generic flag/flag2 boolean accessors. Change-Id: Icc9e854ce4af3eb5808a4bed45aa22f377e223da Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlpropertycachevector_p.h')
-rw-r--r--src/qml/qml/qqmlpropertycachevector_p.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/qml/qml/qqmlpropertycachevector_p.h b/src/qml/qml/qqmlpropertycachevector_p.h
index 1dff7c61a6..2e09423206 100644
--- a/src/qml/qml/qqmlpropertycachevector_p.h
+++ b/src/qml/qml/qqmlpropertycachevector_p.h
@@ -54,16 +54,23 @@
#include <private/qflagpointer_p.h>
#include <private/qqmlpropertycache_p.h>
+#include <QtCore/qtaggedpointer.h>
+
QT_BEGIN_NAMESPACE
class QQmlPropertyCacheVector
{
public:
+ enum Tag {
+ NoTag,
+ CacheNeedsVMEMetaObject
+ };
+
QQmlPropertyCacheVector() {}
QQmlPropertyCacheVector(QQmlPropertyCacheVector &&other)
: data(std::move(other.data)) {}
QQmlPropertyCacheVector &operator=(QQmlPropertyCacheVector &&other) {
- QVector<QFlagPointer<QQmlPropertyCache>> moved(std::move(other.data));
+ QVector<QTaggedPointer<QQmlPropertyCache, Tag>> moved(std::move(other.data));
data.swap(moved);
return *this;
}
@@ -80,7 +87,7 @@ public:
data.clear();
}
- void append(QQmlPropertyCache *cache) { cache->addref(); data.append(cache); }
+ void append(QQmlPropertyCache *cache) { cache->addref(); data.append(QTaggedPointer<QQmlPropertyCache, Tag>(cache)); }
QQmlPropertyCache *at(int index) const { return data.at(index).data(); }
void set(int index, const QQmlRefPointer<QQmlPropertyCache> &replacement) {
if (QQmlPropertyCache *oldCache = data.at(index).data()) {
@@ -92,11 +99,11 @@ public:
replacement->addref();
}
- void setNeedsVMEMetaObject(int index) { data[index].setFlag(); }
- bool needsVMEMetaObject(int index) const { return data.at(index).flag(); }
+ void setNeedsVMEMetaObject(int index) { data[index].setTag(CacheNeedsVMEMetaObject); }
+ bool needsVMEMetaObject(int index) const { return data.at(index).tag() == CacheNeedsVMEMetaObject; }
private:
Q_DISABLE_COPY(QQmlPropertyCacheVector)
- QVector<QFlagPointer<QQmlPropertyCache>> data;
+ QVector<QTaggedPointer<QQmlPropertyCache, Tag>> data;
};
QT_END_NAMESPACE