diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-13 14:11:55 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-18 13:14:03 +0200 |
commit | 49aead7f236f8b8a6ab85adc4b5eace1c1e4dde6 (patch) | |
tree | 21b01c30b568bd79176a5dfe4ec2437e2545660e /src/qml/jsruntime/qv4runtime_p.h | |
parent | 2a43ec129a544d80c9cc3266b5eccce0f6ba66ef (diff) |
Extend the ReturnedValue mechanism to pointers to Managed objects
Add a Returned<T> that we can return instead of raw pointers
to Managed objects.
Start using the Returned<T> for a few methods.
Also clean up all our classes to use the Q_MANAGED macro instead
of manually defining their vtable.
Change-Id: I0a2962e47f3de955cd2cd8474f8f3fcc9e36d084
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4runtime_p.h | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/src/qml/jsruntime/qv4runtime_p.h b/src/qml/jsruntime/qv4runtime_p.h index 4b15c1a17d..6e578bcaca 100644 --- a/src/qml/jsruntime/qv4runtime_p.h +++ b/src/qml/jsruntime/qv4runtime_p.h @@ -172,7 +172,7 @@ QV4::ReturnedValue __qmljs_to_string(const ValueRef value, QV4::ExecutionContext Q_QML_EXPORT QV4::String *__qmljs_convert_to_string(QV4::ExecutionContext *ctx, const ValueRef value); void __qmljs_numberToString(QString *result, double num, int radix = 10); ReturnedValue __qmljs_to_object(QV4::ExecutionContext *ctx, const ValueRef value); -QV4::Object *__qmljs_convert_to_object(QV4::ExecutionContext *ctx, const ValueRef value); +Returned<Object> *__qmljs_convert_to_object(QV4::ExecutionContext *ctx, const ValueRef value); QV4::Bool __qmljs_equal_helper(const ValueRef x, const ValueRef y); Q_QML_EXPORT QV4::Bool __qmljs_strict_equal(const ValueRef x, const ValueRef y); @@ -294,21 +294,6 @@ inline double __qmljs_to_number(const ValueRef value) return value->toNumber(); } -inline QV4::ReturnedValue __qmljs_to_string(const QV4::ValueRef value, QV4::ExecutionContext *ctx) -{ - if (value->isString()) - return value.asReturnedValue(); - return __qmljs_convert_to_string(ctx, value)->asReturnedValue(); -} - -inline QV4::ReturnedValue __qmljs_to_object(QV4::ExecutionContext *ctx, const QV4::ValueRef value) -{ - if (value->isObject()) - return value.asReturnedValue(); - return Value::fromObject(__qmljs_convert_to_object(ctx, value)).asReturnedValue(); -} - - inline QV4::ReturnedValue __qmljs_uplus(const QV4::ValueRef value) { TRACE1(value); |