From c2916f627373ae79bfe1407d1b7c2b41d06989eb Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 4 Jul 2019 16:26:16 +0200 Subject: Minor internal API cleanup Move Property::Type out into a standalone BuiltinType enum class, as it's also used in the signal parameters (and more in the future). Change-Id: I1125c954f6e45c7a1ce6fe2aae77c5f0e68455f5 Reviewed-by: Ulf Hermann --- src/qml/qml/qqmlvmemetaobject.cpp | 92 +++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 46 deletions(-) (limited to 'src/qml/qml/qqmlvmemetaobject.cpp') diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp index d210b049df..458f26b465 100644 --- a/src/qml/qml/qqmlvmemetaobject.cpp +++ b/src/qml/qml/qqmlvmemetaobject.cpp @@ -640,7 +640,7 @@ int QQmlVMEMetaObject::metaCall(QObject *o, QMetaObject::Call c, int _id, void * if (id < propertyCount) { const QV4::CompiledData::Property &property = compiledObject->propertyTable()[id]; - const QV4::CompiledData::Property::Type t = property.builtinType(); + const QV4::CompiledData::BuiltinType t = property.builtinType(); // the context can be null if accessing var properties from cpp after re-parenting an item. QQmlEnginePrivate *ep = (ctxt == nullptr || ctxt->engine == nullptr) ? nullptr : QQmlEnginePrivate::get(ctxt->engine); @@ -649,47 +649,47 @@ int QQmlVMEMetaObject::metaCall(QObject *o, QMetaObject::Call c, int _id, void * if (c == QMetaObject::ReadProperty) { switch (t) { - case QV4::CompiledData::Property::Int: + case QV4::CompiledData::BuiltinType::Int: *reinterpret_cast(a[0]) = readPropertyAsInt(id); break; - case QV4::CompiledData::Property::Bool: + case QV4::CompiledData::BuiltinType::Bool: *reinterpret_cast(a[0]) = readPropertyAsBool(id); break; - case QV4::CompiledData::Property::Real: + case QV4::CompiledData::BuiltinType::Real: *reinterpret_cast(a[0]) = readPropertyAsDouble(id); break; - case QV4::CompiledData::Property::String: + case QV4::CompiledData::BuiltinType::String: *reinterpret_cast(a[0]) = readPropertyAsString(id); break; - case QV4::CompiledData::Property::Url: + case QV4::CompiledData::BuiltinType::Url: *reinterpret_cast(a[0]) = readPropertyAsUrl(id); break; - case QV4::CompiledData::Property::Date: + case QV4::CompiledData::BuiltinType::Date: *reinterpret_cast(a[0]) = readPropertyAsDate(id); break; - case QV4::CompiledData::Property::DateTime: + case QV4::CompiledData::BuiltinType::DateTime: *reinterpret_cast(a[0]) = readPropertyAsDateTime(id); break; - case QV4::CompiledData::Property::Rect: + case QV4::CompiledData::BuiltinType::Rect: *reinterpret_cast(a[0]) = readPropertyAsRectF(id); break; - case QV4::CompiledData::Property::Size: + case QV4::CompiledData::BuiltinType::Size: *reinterpret_cast(a[0]) = readPropertyAsSizeF(id); break; - case QV4::CompiledData::Property::Point: + case QV4::CompiledData::BuiltinType::Point: *reinterpret_cast(a[0]) = readPropertyAsPointF(id); break; - case QV4::CompiledData::Property::Variant: + case QV4::CompiledData::BuiltinType::Variant: *reinterpret_cast(a[0]) = readPropertyAsVariant(id); break; - case QV4::CompiledData::Property::Font: - case QV4::CompiledData::Property::Time: - case QV4::CompiledData::Property::Color: - case QV4::CompiledData::Property::Vector2D: - case QV4::CompiledData::Property::Vector3D: - case QV4::CompiledData::Property::Vector4D: - case QV4::CompiledData::Property::Matrix4x4: - case QV4::CompiledData::Property::Quaternion: + case QV4::CompiledData::BuiltinType::Font: + case QV4::CompiledData::BuiltinType::Time: + case QV4::CompiledData::BuiltinType::Color: + case QV4::CompiledData::BuiltinType::Vector2D: + case QV4::CompiledData::BuiltinType::Vector3D: + case QV4::CompiledData::BuiltinType::Vector4D: + case QV4::CompiledData::BuiltinType::Matrix4x4: + case QV4::CompiledData::BuiltinType::Quaternion: Q_ASSERT(fallbackMetaType != QMetaType::UnknownType); if (QV4::MemberData *md = propertyAndMethodStorageAsMemberData()) { QVariant propertyAsVariant; @@ -698,7 +698,7 @@ int QQmlVMEMetaObject::metaCall(QObject *o, QMetaObject::Call c, int _id, void * QQml_valueTypeProvider()->readValueType(propertyAsVariant, a[0], fallbackMetaType); } break; - case QV4::CompiledData::Property::Var: + case QV4::CompiledData::BuiltinType::Var: if (ep) { *reinterpret_cast(a[0]) = readPropertyAsVariant(id); } else { @@ -706,7 +706,7 @@ int QQmlVMEMetaObject::metaCall(QObject *o, QMetaObject::Call c, int _id, void * *reinterpret_cast(a[0]) = QVariant(); } break; - case QV4::CompiledData::Property::InvalidBuiltin: + case QV4::CompiledData::BuiltinType::InvalidBuiltin: if (property.isList) { QList *list = readPropertyAsList(id); QQmlListProperty *p = static_cast *>(a[0]); @@ -723,57 +723,57 @@ int QQmlVMEMetaObject::metaCall(QObject *o, QMetaObject::Call c, int _id, void * } else if (c == QMetaObject::WriteProperty) { bool needActivate = false; switch (t) { - case QV4::CompiledData::Property::Int: + case QV4::CompiledData::BuiltinType::Int: needActivate = *reinterpret_cast(a[0]) != readPropertyAsInt(id); writeProperty(id, *reinterpret_cast(a[0])); break; - case QV4::CompiledData::Property::Bool: + case QV4::CompiledData::BuiltinType::Bool: needActivate = *reinterpret_cast(a[0]) != readPropertyAsBool(id); writeProperty(id, *reinterpret_cast(a[0])); break; - case QV4::CompiledData::Property::Real: + case QV4::CompiledData::BuiltinType::Real: needActivate = *reinterpret_cast(a[0]) != readPropertyAsDouble(id); writeProperty(id, *reinterpret_cast(a[0])); break; - case QV4::CompiledData::Property::String: + case QV4::CompiledData::BuiltinType::String: needActivate = *reinterpret_cast(a[0]) != readPropertyAsString(id); writeProperty(id, *reinterpret_cast(a[0])); break; - case QV4::CompiledData::Property::Url: + case QV4::CompiledData::BuiltinType::Url: needActivate = *reinterpret_cast(a[0]) != readPropertyAsUrl(id); writeProperty(id, *reinterpret_cast(a[0])); break; - case QV4::CompiledData::Property::Date: + case QV4::CompiledData::BuiltinType::Date: needActivate = *reinterpret_cast(a[0]) != readPropertyAsDate(id); writeProperty(id, *reinterpret_cast(a[0])); break; - case QV4::CompiledData::Property::DateTime: + case QV4::CompiledData::BuiltinType::DateTime: needActivate = *reinterpret_cast(a[0]) != readPropertyAsDateTime(id); writeProperty(id, *reinterpret_cast(a[0])); break; - case QV4::CompiledData::Property::Rect: + case QV4::CompiledData::BuiltinType::Rect: needActivate = *reinterpret_cast(a[0]) != readPropertyAsRectF(id); writeProperty(id, *reinterpret_cast(a[0])); break; - case QV4::CompiledData::Property::Size: + case QV4::CompiledData::BuiltinType::Size: needActivate = *reinterpret_cast(a[0]) != readPropertyAsSizeF(id); writeProperty(id, *reinterpret_cast(a[0])); break; - case QV4::CompiledData::Property::Point: + case QV4::CompiledData::BuiltinType::Point: needActivate = *reinterpret_cast(a[0]) != readPropertyAsPointF(id); writeProperty(id, *reinterpret_cast(a[0])); break; - case QV4::CompiledData::Property::Variant: + case QV4::CompiledData::BuiltinType::Variant: writeProperty(id, *reinterpret_cast(a[0])); break; - case QV4::CompiledData::Property::Font: - case QV4::CompiledData::Property::Time: - case QV4::CompiledData::Property::Color: - case QV4::CompiledData::Property::Vector2D: - case QV4::CompiledData::Property::Vector3D: - case QV4::CompiledData::Property::Vector4D: - case QV4::CompiledData::Property::Matrix4x4: - case QV4::CompiledData::Property::Quaternion: + case QV4::CompiledData::BuiltinType::Font: + case QV4::CompiledData::BuiltinType::Time: + case QV4::CompiledData::BuiltinType::Color: + case QV4::CompiledData::BuiltinType::Vector2D: + case QV4::CompiledData::BuiltinType::Vector3D: + case QV4::CompiledData::BuiltinType::Vector4D: + case QV4::CompiledData::BuiltinType::Matrix4x4: + case QV4::CompiledData::BuiltinType::Quaternion: Q_ASSERT(fallbackMetaType != QMetaType::UnknownType); if (QV4::MemberData *md = propertyAndMethodStorageAsMemberData()) { const QV4::VariantObject *v = (md->data() + id)->as(); @@ -786,11 +786,11 @@ int QQmlVMEMetaObject::metaCall(QObject *o, QMetaObject::Call c, int _id, void * QQml_valueTypeProvider()->writeValueType(fallbackMetaType, a[0], v->d()->data()); } break; - case QV4::CompiledData::Property::Var: + case QV4::CompiledData::BuiltinType::Var: if (ep) writeProperty(id, *reinterpret_cast(a[0])); break; - case QV4::CompiledData::Property::InvalidBuiltin: + case QV4::CompiledData::BuiltinType::InvalidBuiltin: if (property.isList) { // Writing such a property is not supported. Content is added through the list property // methods. @@ -966,7 +966,7 @@ QV4::ReturnedValue QQmlVMEMetaObject::method(int index) const QV4::ReturnedValue QQmlVMEMetaObject::readVarProperty(int id) const { - Q_ASSERT(compiledObject && compiledObject->propertyTable()[id].builtinType() == QV4::CompiledData::Property::Var); + Q_ASSERT(compiledObject && compiledObject->propertyTable()[id].builtinType() == QV4::CompiledData::BuiltinType::Var); QV4::MemberData *md = propertyAndMethodStorageAsMemberData(); if (md) @@ -991,7 +991,7 @@ QVariant QQmlVMEMetaObject::readPropertyAsVariant(int id) const void QQmlVMEMetaObject::writeVarProperty(int id, const QV4::Value &value) { - Q_ASSERT(compiledObject && compiledObject->propertyTable()[id].builtinType() == QV4::CompiledData::Property::Var); + Q_ASSERT(compiledObject && compiledObject->propertyTable()[id].builtinType() == QV4::CompiledData::BuiltinType::Var); QV4::MemberData *md = propertyAndMethodStorageAsMemberData(); if (!md) @@ -1031,7 +1031,7 @@ void QQmlVMEMetaObject::writeVarProperty(int id, const QV4::Value &value) void QQmlVMEMetaObject::writeProperty(int id, const QVariant &value) { - if (compiledObject && compiledObject->propertyTable()[id].builtinType() == QV4::CompiledData::Property::Var) { + if (compiledObject && compiledObject->propertyTable()[id].builtinType() == QV4::CompiledData::BuiltinType::Var) { QV4::MemberData *md = propertyAndMethodStorageAsMemberData(); if (!md) return; -- cgit v1.2.3