diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-05-31 13:05:37 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-05-31 15:46:27 +0200 |
commit | e14b9dbee1260f799d1d2e175d106dbed79b6c49 (patch) | |
tree | 127bd9fb574a5d62155e93ead4fdcffc3314e664 /src/qml/qml/qqmllistwrapper.cpp | |
parent | 0ced7dfd6991cd33222e7c5a3c05e56d2c67e9d5 (diff) |
Start converting casting of Managed to subtypes to a better scheme
There is now a template based as<Foo>() method available in
Managed, that'll allow casting to the proper subclass. It uses
the pointer to the vtable and compares it to the classes static
vtable for type checking. Like this we can avoid that Managed has
to know about all subclasses.
Change-Id: Ic966bbe00d85224b8d96cc0ff00f69a6ac67129e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmllistwrapper.cpp')
-rw-r--r-- | src/qml/qml/qqmllistwrapper.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qml/qml/qqmllistwrapper.cpp b/src/qml/qml/qqmllistwrapper.cpp index ff878c0d9c..e8bc053ec1 100644 --- a/src/qml/qml/qqmllistwrapper.cpp +++ b/src/qml/qml/qqmllistwrapper.cpp @@ -100,7 +100,7 @@ QVariant QmlListWrapper::toVariant() const Value QmlListWrapper::get(Managed *m, ExecutionContext *ctx, String *name, bool *hasProperty) { - QmlListWrapper *w = m->asQmlListWrapper(); + QmlListWrapper *w = m->as<QmlListWrapper>(); if (!w) ctx->throwTypeError(); @@ -114,7 +114,7 @@ Value QmlListWrapper::get(Managed *m, ExecutionContext *ctx, String *name, bool Value QmlListWrapper::getIndexed(Managed *m, ExecutionContext *ctx, uint index, bool *hasProperty) { - QmlListWrapper *w = m->asQmlListWrapper(); + QmlListWrapper *w = m->as<QmlListWrapper>(); if (!w) ctx->throwTypeError(); @@ -136,7 +136,7 @@ void QmlListWrapper::put(Managed *m, ExecutionContext *ctx, String *name, const void QmlListWrapper::destroy(Managed *that) { - QmlListWrapper *w = that->asQmlListWrapper(); + QmlListWrapper *w = that->as<QmlListWrapper>(); w->~QmlListWrapper(); } |