diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-11 16:28:17 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-18 13:13:33 +0200 |
commit | bdb27b96acbd38531879378c48959a5a1cd60963 (patch) | |
tree | 056f2c8c35be97a9564dee5d0ea65bed7265b7ce /src/qml/jsruntime/qv4managed_p.h | |
parent | 8d26084ae56ba5aedd73ab733553dbf9cb3eb672 (diff) |
Use ReturnedValue for Managed::get().
Change-Id: Ia8f35d227b69d32e1f6a041283abbbd083aa34ca
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4managed_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4managed_p.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4managed_p.h b/src/qml/jsruntime/qv4managed_p.h index 44d809c605..e72cf10bf8 100644 --- a/src/qml/jsruntime/qv4managed_p.h +++ b/src/qml/jsruntime/qv4managed_p.h @@ -97,7 +97,7 @@ struct ManagedVTable void (*destroy)(Managed *); void (*collectDeletables)(Managed *, GCDeletable **deletable); bool (*hasInstance)(Managed *, const Value &value); - Value (*get)(Managed *, String *name, bool *hasProperty); + ReturnedValue (*get)(Managed *, String *name, bool *hasProperty); Value (*getIndexed)(Managed *, uint index, bool *hasProperty); void (*put)(Managed *, String *name, const Value &value); void (*putIndexed)(Managed *, uint index, const Value &value); @@ -223,6 +223,14 @@ public: return vtbl == &T::static_vtbl ? static_cast<const T *>(this) : 0; } + template<typename T> + static T *cast(const Value &v) { + return v.as<T>(); + } + static Managed *cast(const Value &v) { + return v.asManaged(); + } + ArrayObject *asArrayObject() { return type == Type_ArrayObject ? reinterpret_cast<ArrayObject *>(this) : 0; } FunctionObject *asFunctionObject() { return type == Type_FunctionObject ? reinterpret_cast<FunctionObject *>(this) : 0; } BooleanObject *asBooleanObject() { return type == Type_BooleanObject ? reinterpret_cast<BooleanObject *>(this) : 0; } @@ -254,7 +262,7 @@ public: } ReturnedValue construct(CallData *d); ReturnedValue call(CallData *d); - Value get(String *name, bool *hasProperty = 0); + ReturnedValue get(String *name, bool *hasProperty = 0); Value getIndexed(uint index, bool *hasProperty = 0); void put(String *name, const Value &value) { vtbl->put(this, name, value); } |