diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-05-08 22:27:23 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-07-22 13:49:17 +0200 |
commit | 45f7120d42f628e86ae2bf3bd2789fdb190490e0 (patch) | |
tree | 5a90ec2c80f46d20124cf4adac14704777301f46 /src/qml/qml | |
parent | 4632c0bfff911fa84f00aab9721519427cfa9921 (diff) |
Convert regexps
Change-Id: I5b62a265a7ce363a16b1e14ae93cadbb1ab0cb5b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqmlcomponent.cpp | 37 | ||||
-rw-r--r-- | src/qml/qml/qqmllocale.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmllocale_p.h | 16 |
3 files changed, 27 insertions, 28 deletions
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index ce9771fac0..716aa31fdc 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -1074,9 +1074,10 @@ void QQmlComponent::create(QQmlIncubator &incubator, QQmlContext *context, class QQmlComponentIncubator; -class QmlIncubatorObject : public QV4::Object +struct QmlIncubatorObject : public QV4::Object { struct Data : QV4::Object::Data { + Data(QV8Engine *engine, QQmlIncubator::IncubationMode = QQmlIncubator::Asynchronous); QScopedPointer<QQmlComponentIncubator> incubator; QV8Engine *v8; QPointer<QObject> parent; @@ -1094,8 +1095,6 @@ class QmlIncubatorObject : public QV4::Object } __data; V4_OBJECT -public: - QmlIncubatorObject(QV8Engine *engine, QQmlIncubator::IncubationMode = QQmlIncubator::Asynchronous); static QV4::ReturnedValue method_get_statusChanged(QV4::CallContext *ctx); static QV4::ReturnedValue method_set_statusChanged(QV4::CallContext *ctx); @@ -1115,20 +1114,24 @@ DEFINE_OBJECT_VTABLE(QmlIncubatorObject); class QQmlComponentIncubator : public QQmlIncubator { public: - QQmlComponentIncubator(QmlIncubatorObject *inc, IncubationMode mode) + QQmlComponentIncubator(QmlIncubatorObject::Data *inc, IncubationMode mode) : QQmlIncubator(mode) , incubatorObject(inc) {} virtual void statusChanged(Status s) { - incubatorObject->statusChanged(s); + QV4::Scope scope(incubatorObject->internalClass->engine); + QV4::Scoped<QmlIncubatorObject> i(scope, incubatorObject); + i->statusChanged(s); } virtual void setInitialState(QObject *o) { - incubatorObject->setInitialState(o); + QV4::Scope scope(incubatorObject->internalClass->engine); + QV4::Scoped<QmlIncubatorObject> i(scope, incubatorObject); + i->setInitialState(o); } - QmlIncubatorObject *incubatorObject; + QmlIncubatorObject::Data *incubatorObject; }; @@ -1364,7 +1367,7 @@ void QQmlComponent::incubateObject(QQmlV4Function *args) QQmlComponentExtension *e = componentExtension(args->engine()); - QV4::Scoped<QmlIncubatorObject> r(scope, new (v4->memoryManager) QmlIncubatorObject(args->engine(), mode)); + QV4::Scoped<QmlIncubatorObject> r(scope, new (v4) QmlIncubatorObject::Data(args->engine(), mode)); QV4::ScopedObject p(scope, e->incubationProto.value()); r->setPrototype(p.getPointer()); @@ -1479,16 +1482,16 @@ QQmlComponentExtension::~QQmlComponentExtension() { } -QmlIncubatorObject::QmlIncubatorObject(QV8Engine *engine, QQmlIncubator::IncubationMode m) - : Object(QV8Engine::getV4(engine)) +QmlIncubatorObject::Data::Data(QV8Engine *engine, QQmlIncubator::IncubationMode m) + : Object::Data(QV8Engine::getV4(engine)) + , v8(engine) + , valuemap(QV4::Primitive::undefinedValue()) + , qmlGlobal(QV4::Primitive::undefinedValue()) + , statusChanged(QV4::Primitive::undefinedValue()) { setVTable(staticVTable()); - d()->incubator.reset(new QQmlComponentIncubator(this, m)); - d()->v8 = engine; - d()->valuemap = QV4::Primitive::undefinedValue(); - d()->qmlGlobal = QV4::Primitive::undefinedValue(); - d()->statusChanged = QV4::Primitive::undefinedValue(); + incubator.reset(new QQmlComponentIncubator(this, m)); } void QmlIncubatorObject::setInitialState(QObject *o) @@ -1510,9 +1513,7 @@ void QmlIncubatorObject::setInitialState(QObject *o) void QmlIncubatorObject::destroy(Managed *that) { - QmlIncubatorObject *o = that->as<QmlIncubatorObject>(); - Q_ASSERT(o); - o->~QmlIncubatorObject(); + that->as<QmlIncubatorObject>()->d()->~Data(); } void QmlIncubatorObject::markObjects(QV4::Managed *that, QV4::ExecutionEngine *e) diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp index c66b5920d9..7687c17e82 100644 --- a/src/qml/qml/qqmllocale.cpp +++ b/src/qml/qml/qqmllocale.cpp @@ -814,7 +814,7 @@ QV4::ReturnedValue QQmlLocale::wrap(QV8Engine *engine, const QLocale &locale) QV8LocaleDataDeletable *d = localeV8Data(engine); QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine); QV4::Scope scope(v4); - QV4::Scoped<QQmlLocaleData> wrapper(scope, new (v4->memoryManager) QQmlLocaleData(v4)); + QV4::Scoped<QQmlLocaleData> wrapper(scope, new (v4) QQmlLocaleData::Data(v4)); wrapper->d()->locale = locale; QV4::ScopedObject p(scope, d->prototype.value()); wrapper->setPrototype(p.getPointer()); diff --git a/src/qml/qml/qqmllocale_p.h b/src/qml/qml/qqmllocale_p.h index 02877d79c8..d5812ef78a 100644 --- a/src/qml/qml/qqmllocale_p.h +++ b/src/qml/qml/qqmllocale_p.h @@ -129,9 +129,14 @@ private: static QV4::ReturnedValue method_localeCompare(QV4::CallContext *ctx); }; -class QQmlLocaleData : public QV4::Object +struct QQmlLocaleData : public QV4::Object { - struct Data : QV4::Object::Data { + struct Data : Object::Data { + Data(QV4::ExecutionEngine *engine) + : Object::Data(engine) + { + setVTable(staticVTable()); + } QLocale locale; }; struct { @@ -139,13 +144,6 @@ class QQmlLocaleData : public QV4::Object } __data; V4_OBJECT -public: - QQmlLocaleData(QV4::ExecutionEngine *engine) - : QV4::Object(engine) - { - setVTable(staticVTable()); - } - static QLocale *getThisLocale(QV4::CallContext *ctx) { QQmlLocaleData *thisObject = ctx->d()->callData->thisObject.asObject()->as<QQmlLocaleData>(); |