diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-09-11 11:07:32 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-09-17 07:47:09 +0000 |
commit | 1dac47c1418b44cf4a56b42bfca2b277795fd213 (patch) | |
tree | 26727943c30628340662a66d7cbe9f52d75c5b58 /src/qml/jsapi | |
parent | d89d5cffe79bd060a1b04a2c47a3d728bffbe195 (diff) |
Cleanups in Value/Primitive
Get rid of Primitive and move the corresponding methods
directly into Value. Mark many methods in Value as
constexpr and turn Value into a POD type again.
Keep Primitive as a pure alias to Value for source
compatibility of other modules that might be using it.
Change-Id: Icb47458947dd3482c8852e95782123ea4346f5ec
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsapi')
-rw-r--r-- | src/qml/jsapi/qjsengine.cpp | 18 | ||||
-rw-r--r-- | src/qml/jsapi/qjsvalue.cpp | 4 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp index f96414ea3f..4aa7c4b45d 100644 --- a/src/qml/jsapi/qjsengine.cpp +++ b/src/qml/jsapi/qjsengine.cpp @@ -726,16 +726,16 @@ bool QJSEngine::convertV2(const QJSValue &value, int type, void *ptr) double d = QV4::RuntimeHelpers::stringToNumber(string); switch (type) { case QMetaType::Int: - *reinterpret_cast<int*>(ptr) = QV4::Primitive::toInt32(d); + *reinterpret_cast<int*>(ptr) = QV4::Value::toInt32(d); return true; case QMetaType::UInt: - *reinterpret_cast<uint*>(ptr) = QV4::Primitive::toUInt32(d); + *reinterpret_cast<uint*>(ptr) = QV4::Value::toUInt32(d); return true; case QMetaType::LongLong: - *reinterpret_cast<qlonglong*>(ptr) = QV4::Primitive::toInteger(d); + *reinterpret_cast<qlonglong*>(ptr) = QV4::Value::toInteger(d); return true; case QMetaType::ULongLong: - *reinterpret_cast<qulonglong*>(ptr) = QV4::Primitive::toInteger(d); + *reinterpret_cast<qulonglong*>(ptr) = QV4::Value::toInteger(d); return true; case QMetaType::Double: *reinterpret_cast<double*>(ptr) = d; @@ -744,19 +744,19 @@ bool QJSEngine::convertV2(const QJSValue &value, int type, void *ptr) *reinterpret_cast<float*>(ptr) = d; return true; case QMetaType::Short: - *reinterpret_cast<short*>(ptr) = QV4::Primitive::toInt32(d); + *reinterpret_cast<short*>(ptr) = QV4::Value::toInt32(d); return true; case QMetaType::UShort: - *reinterpret_cast<unsigned short*>(ptr) = QV4::Primitive::toUInt32(d); + *reinterpret_cast<unsigned short*>(ptr) = QV4::Value::toUInt32(d); return true; case QMetaType::Char: - *reinterpret_cast<char*>(ptr) = QV4::Primitive::toInt32(d); + *reinterpret_cast<char*>(ptr) = QV4::Value::toInt32(d); return true; case QMetaType::UChar: - *reinterpret_cast<unsigned char*>(ptr) = QV4::Primitive::toUInt32(d); + *reinterpret_cast<unsigned char*>(ptr) = QV4::Value::toUInt32(d); return true; case QMetaType::QChar: - *reinterpret_cast<QChar*>(ptr) = QV4::Primitive::toUInt32(d); + *reinterpret_cast<QChar*>(ptr) = QV4::Value::toUInt32(d); return true; default: return false; diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp index bf8000bdd8..9671e82187 100644 --- a/src/qml/jsapi/qjsvalue.cpp +++ b/src/qml/jsapi/qjsvalue.cpp @@ -569,7 +569,7 @@ qint32 QJSValue::toInt() const if (!val) { QVariant *variant = QJSValuePrivate::getVariant(this); if (variant->userType() == QMetaType::QString) - return QV4::Primitive::toInt32(RuntimeHelpers::stringToNumber(variant->toString())); + return QV4::Value::toInt32(RuntimeHelpers::stringToNumber(variant->toString())); else return variant->toInt(); } @@ -603,7 +603,7 @@ quint32 QJSValue::toUInt() const if (!val) { QVariant *variant = QJSValuePrivate::getVariant(this); if (variant->userType() == QMetaType::QString) - return QV4::Primitive::toUInt32(RuntimeHelpers::stringToNumber(variant->toString())); + return QV4::Value::toUInt32(RuntimeHelpers::stringToNumber(variant->toString())); else return variant->toUInt(); } |