#include "qv8debugservice_p.h"
#include "qqmldebugservice_p_p.h"
-#include <private/qjsconverter_p.h>
#include <private/qv8engine_p.h>
#include <QtCore/QHash>
#include "qv8profilerservice_p.h"
#include "qqmldebugservice_p_p.h"
-#include "private/qjsconverter_p.h"
#include <private/qv8profiler_p.h>
+#include <private/qv8_p.h>
#include <QtCore/QHash>
#include <QtCore/QMutex>
v8::Handle<v8::Value> QQmlDateExtension::fromLocaleString(const v8::Arguments& args)
{
+ QV4::ExecutionEngine *engine = args.GetIsolate()->GetEngine();
if (args.Length() == 1 && args[0]->IsString()) {
QLocale locale;
- QString dateString = args[0]->v4Value().toString(args.GetIsolate()->GetEngine()->current)->toQString();
+ QString dateString = args[0]->v4Value().toString(engine->current)->toQString();
QDateTime dt = locale.toDateTime(dateString);
- return QV4::Value::fromObject(QJSConverter::toDateTime(dt));
+ return QV4::Value::fromObject(engine->newDateObject(dt));
}
if (args.Length() < 1 || args.Length() > 3 || !isLocaleObject(args[0]))
dt = r->locale.toDateTime(dateString, enumFormat);
}
- return QV4::Value::fromObject(QJSConverter::toDateTime(dt));
+ return QV4::Value::fromObject(engine->newDateObject(dt));
}
v8::Handle<v8::Value> QQmlDateExtension::fromLocaleTimeString(const v8::Arguments& args)
{
+ QV4::ExecutionEngine *engine = args.GetIsolate()->GetEngine();
+
if (args.Length() == 1 && args[0]->IsString()) {
QLocale locale;
- QString timeString = args[0]->v4Value().toString(args.GetIsolate()->GetEngine()->current)->toQString();
+ QString timeString = args[0]->v4Value().toString(engine->current)->toQString();
QTime time = locale.toTime(timeString);
QDateTime dt = QDateTime::currentDateTime();
dt.setTime(time);
- return QV4::Value::fromObject(QJSConverter::toDateTime(dt));
+ return QV4::Value::fromObject(engine->newDateObject(dt));
}
if (args.Length() < 1 || args.Length() > 3 || !isLocaleObject(args[0]))
QDateTime dt = QDateTime::currentDateTime();
dt.setTime(tm);
- return QV4::Value::fromObject(QJSConverter::toDateTime(dt));
+ return QV4::Value::fromObject(engine->newDateObject(dt));
}
v8::Handle<v8::Value> QQmlDateExtension::fromLocaleDateString(const v8::Arguments& args)
{
+ QV4::ExecutionEngine *engine = args.GetIsolate()->GetEngine();
+
if (args.Length() == 1 && args[0]->IsString()) {
QLocale locale;
- QString dateString = args[0]->v4Value().toString(args.GetIsolate()->GetEngine()->current)->toQString();
+ QString dateString = args[0]->v4Value().toString(engine->current)->toQString();
QDate date = locale.toDate(dateString);
- return QV4::Value::fromObject(QJSConverter::toDateTime(QDateTime(date)));
+ return QV4::Value::fromObject(engine->newDateObject(QDateTime(date)));
}
if (args.Length() < 1 || args.Length() > 3 || !isLocaleObject(args[0]))
dt = r->locale.toDate(dateString, enumFormat);
}
- return QV4::Value::fromObject(QJSConverter::toDateTime(QDateTime(dt)));
+ return QV4::Value::fromObject(engine->newDateObject(QDateTime(dt)));
}
v8::Handle<v8::Value> QQmlDateExtension::timeZoneUpdated(const v8::Arguments& args)
#endif
}
+DateObject::DateObject(ExecutionEngine *engine, const QDateTime &date)
+ : Object(engine)
+{
+ value = Value::fromDouble(FromDateTime(date));
+}
+
+QDateTime DateObject::toQDateTime() const
+{
+ return ToDateTime(value.asDouble(), Qt::LocalTime);
+}
+
DEFINE_MANAGED_VTABLE(DateCtor);
DateCtor::DateCtor(ExecutionContext *scope)
defineDefaultProperty(ctx, QStringLiteral("toJSON"), method_toJSON, 1);
}
-double DatePrototype::toJSDate(const QDateTime &dateTime)
-{
- return FromDateTime(dateTime);
-}
-
-QDateTime DatePrototype::toQDateTime(double d)
-{
- return ToDateTime(d, Qt::LocalTime);
-}
-
double DatePrototype::getThisDate(ExecutionContext *ctx)
{
if (DateObject *thisObject = ctx->thisObject.asDateObject())
struct DateObject: Object {
Value value;
DateObject(ExecutionEngine *engine, const Value &value): Object(engine), value(value) { type = Type_DateObject; }
+ DateObject(ExecutionEngine *engine, const QDateTime &value);
+
+ QDateTime toQDateTime() const;
};
struct DateCtor: FunctionObject
DatePrototype(ExecutionEngine *engine): DateObject(engine, Value::fromDouble(qSNaN())) {}
void init(ExecutionContext *ctx, const Value &ctor);
- static double toJSDate(const QDateTime &dateTime);
- static QDateTime toQDateTime(double d);
-
static double getThisDate(ExecutionContext *ctx);
static Value method_parse(SimpleCallContext *ctx);
return object;
}
-Object *ExecutionEngine::newFunctionObject(ExecutionContext *scope)
+ArrayObject *ExecutionEngine::newArrayObject()
{
- Object *object = new (memoryManager) FunctionObject(scope);
- object->prototype = functionPrototype;
+ ArrayObject *object = new (memoryManager) ArrayObject(this);
+ object->prototype = arrayPrototype;
return object;
}
-ArrayObject *ExecutionEngine::newArrayObject()
+ArrayObject *ExecutionEngine::newArrayObject(const QStringList &list)
{
- ArrayObject *object = new (memoryManager) ArrayObject(this);
+ ArrayObject *object = new (memoryManager) ArrayObject(this, list);
object->prototype = arrayPrototype;
return object;
}
return object;
}
+DateObject *ExecutionEngine::newDateObject(const QDateTime &dt)
+{
+ DateObject *object = new (memoryManager) DateObject(this, dt);
+ object->prototype = datePrototype;
+ return object;
+}
+
RegExpObject *ExecutionEngine::newRegExpObject(const QString &pattern, int flags)
{
bool global = (flags & QQmlJS::V4IR::RegExp::RegExp_Global);
return object;
}
+RegExpObject *ExecutionEngine::newRegExpObject(const QRegExp &re)
+{
+ RegExpObject *object = new (memoryManager) RegExpObject(this, re);
+ object->prototype = regExpPrototype;
+ return object;
+}
+
Object *ExecutionEngine::newErrorObject(const Value &value)
{
ErrorObject *object = new (memoryManager) ErrorObject(this, value);
Object *newStringObject(const Value &value);
Object *newNumberObject(const Value &value);
Object *newBooleanObject(const Value &value);
- Object *newFunctionObject(ExecutionContext *scope);
ArrayObject *newArrayObject();
+ ArrayObject *newArrayObject(const QStringList &list);
DateObject *newDateObject(const Value &value);
+ DateObject *newDateObject(const QDateTime &dt);
RegExpObject *newRegExpObject(const QString &pattern, int flags);
RegExpObject *newRegExpObject(RegExp* re, bool global);
+ RegExpObject *newRegExpObject(const QRegExp &re);
Object *newErrorObject(const Value &value);
Object *newSyntaxErrorObject(ExecutionContext *ctx, DiagnosticMessage *message);
}
}
+ArrayObject::ArrayObject(ExecutionEngine *engine, const QStringList &list)
+ : Object(engine)
+{
+ // Converts a QStringList to JS.
+ // The result is a new Array object with length equal to the length
+ // of the QStringList, and the elements being the QStringList's
+ // elements converted to JS Strings.
+ int len = list.count();
+ arrayReserve(len);
+ for (int ii = 0; ii < len; ++ii)
+ arrayData[ii].value = Value::fromString(engine->newString(list.at(ii)));
+ setArrayLengthUnchecked(len);
+}
+
void ArrayObject::init(ExecutionEngine *engine)
{
type = Type_ArrayObject;
memberData[LengthPropertyIndex].value = Value::fromInt32(0);
}
+QStringList ArrayObject::toQStringList() const
+{
+ QStringList result;
+
+ QV4::ExecutionEngine *engine = internalClass->engine;
+
+ uint32_t length = arrayLength();
+ for (uint32_t i = 0; i < length; ++i)
+ result.append(const_cast<ArrayObject *>(this)->getIndexed(engine->current, i).toString(engine->current)->toQString());
+ return result;
+}
+
DEFINE_MANAGED_VTABLE(ForEachIteratorObject);
};
ArrayObject(ExecutionEngine *engine) : Object(engine) { init(engine); }
+ ArrayObject(ExecutionEngine *engine, const QStringList &list);
void init(ExecutionEngine *engine);
+
+ QStringList toQStringList() const;
};
inline uint Object::arrayLength() const
#include <QtCore/qmath.h>
#include <QtCore/QDebug>
+#include <QtCore/qregexp.h>
#include <cassert>
#include <typeinfo>
#include <iostream>
#include "qv4alloca_p.h"
+Q_CORE_EXPORT QString qt_regexp_toCanonical(const QString &, QRegExp::PatternSyntax);
+
using namespace QV4;
DEFINE_MANAGED_VTABLE(RegExpObject);
defineReadonlyProperty(engine->newIdentifier(QStringLiteral("multiline")), Value::fromBoolean(this->value->multiLine()));
}
+// Converts a QRegExp to a JS RegExp.
+// The conversion is not 100% exact since ECMA regexp and QRegExp
+// have different semantics/flags, but we try to do our best.
+RegExpObject::RegExpObject(ExecutionEngine *engine, const QRegExp &re)
+ : Object(engine)
+ , value(0)
+ , global(false)
+{
+ // Convert the pattern to a ECMAScript pattern.
+ QString pattern = qt_regexp_toCanonical(re.pattern(), re.patternSyntax());
+ if (re.isMinimal()) {
+ QString ecmaPattern;
+ int len = pattern.length();
+ ecmaPattern.reserve(len);
+ int i = 0;
+ const QChar *wc = pattern.unicode();
+ bool inBracket = false;
+ while (i < len) {
+ QChar c = wc[i++];
+ ecmaPattern += c;
+ switch (c.unicode()) {
+ case '?':
+ case '+':
+ case '*':
+ case '}':
+ if (!inBracket)
+ ecmaPattern += QLatin1Char('?');
+ break;
+ case '\\':
+ if (i < len)
+ ecmaPattern += wc[i++];
+ break;
+ case '[':
+ inBracket = true;
+ break;
+ case ']':
+ inBracket = false;
+ break;
+ default:
+ break;
+ }
+ }
+ pattern = ecmaPattern;
+ }
+
+ value = RegExp::create(engine, pattern, re.caseSensitivity() == Qt::CaseInsensitive, false);
+}
+
void RegExpObject::destroy(Managed *that)
{
static_cast<RegExpObject *>(that)->~RegExpObject();
return &memberData[0];
}
+// Converts a JS RegExp to a QRegExp.
+// The conversion is not 100% exact since ECMA regexp and QRegExp
+// have different semantics/flags, but we try to do our best.
+QRegExp RegExpObject::toQRegExp() const
+{
+ Qt::CaseSensitivity caseSensitivity = value->ignoreCase() ? Qt::CaseInsensitive : Qt::CaseSensitive;
+ return QRegExp(value->pattern(), caseSensitivity, QRegExp::RegExp2);
+}
+
+
DEFINE_MANAGED_VTABLE(RegExpCtor);
RegExpCtor::RegExpCtor(ExecutionContext *scope)
Property *lastIndexProperty(ExecutionContext *ctx);
bool global;
RegExpObject(ExecutionEngine *engine, RegExp* value, bool global);
+ RegExpObject(ExecutionEngine *engine, const QRegExp &re);
~RegExpObject() {}
+ QRegExp toQRegExp() const;
+
protected:
static const ManagedVTable static_vtbl;
static void destroy(Managed *that);
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qjsconverter_p.h"
-#include <stdlib.h>
-
-#include <private/qv4jsir_p.h>
-#include <private/qv4regexpobject_p.h>
-#include <private/qv4dateobject_p.h>
-
-#ifndef QJSCONVERTER_IMPL_P_H
-#define QJSCONVERTER_IMPL_P_H
-
-#ifdef Q_OS_QNX
-#include <malloc.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-extern char *qdtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve, char **digits_str);
-Q_CORE_EXPORT QString qt_regexp_toCanonical(const QString &, QRegExp::PatternSyntax);
-
-// Converts a JS RegExp to a QRegExp.
-// The conversion is not 100% exact since ECMA regexp and QRegExp
-// have different semantics/flags, but we try to do our best.
-QRegExp QJSConverter::toRegExp(const QV4::RegExpObject *jsRegExp)
-{
- QV4::RegExp *re = jsRegExp->value;
- QString pattern = re->pattern();
- Qt::CaseSensitivity caseSensitivity = re->ignoreCase() ? Qt::CaseInsensitive : Qt::CaseSensitive;
- return QRegExp(pattern, caseSensitivity, QRegExp::RegExp2);
-}
-
-// Converts a QRegExp to a JS RegExp.
-// The conversion is not 100% exact since ECMA regexp and QRegExp
-// have different semantics/flags, but we try to do our best.
-QV4::RegExpObject *QJSConverter::toRegExp(const QRegExp &re)
-{
- // Convert the pattern to a ECMAScript pattern.
- QString pattern = qt_regexp_toCanonical(re.pattern(), re.patternSyntax());
- if (re.isMinimal()) {
- QString ecmaPattern;
- int len = pattern.length();
- ecmaPattern.reserve(len);
- int i = 0;
- const QChar *wc = pattern.unicode();
- bool inBracket = false;
- while (i < len) {
- QChar c = wc[i++];
- ecmaPattern += c;
- switch (c.unicode()) {
- case '?':
- case '+':
- case '*':
- case '}':
- if (!inBracket)
- ecmaPattern += QLatin1Char('?');
- break;
- case '\\':
- if (i < len)
- ecmaPattern += wc[i++];
- break;
- case '[':
- inBracket = true;
- break;
- case ']':
- inBracket = false;
- break;
- default:
- break;
- }
- }
- pattern = ecmaPattern;
- }
-
- int flags = 0;
- if (re.caseSensitivity() == Qt::CaseInsensitive)
- flags |= QQmlJS::V4IR::RegExp::RegExp_IgnoreCase;
-
- QV4::ExecutionEngine *e = v8::Isolate::GetCurrent()->GetEngine();
- return e->newRegExpObject(pattern, flags);
-}
-
-// Converts a QStringList to JS.
-// The result is a new Array object with length equal to the length
-// of the QStringList, and the elements being the QStringList's
-// elements converted to JS Strings.
-QV4::Value QJSConverter::toStringList(const QStringList &list)
-{
- QV4::ExecutionEngine *e = v8::Isolate::GetCurrent()->GetEngine();
- QV4::ArrayObject *a = e->newArrayObject();
- int len = list.count();
- a->arrayReserve(len);
- for (int ii = 0; ii < len; ++ii)
- a->arrayData[ii].value = QV4::Value::fromString(e->newString(list.at(ii)));
- a->setArrayLengthUnchecked(len);
- return QV4::Value::fromObject(a);
-}
-
-// Converts a JS Array object to a QStringList.
-// The result is a QStringList with length equal to the length
-// of the JS Array, and elements being the JS Array's elements
-// converted to QStrings.
-QStringList QJSConverter::toStringList(const QV4::Value &jsArray)
-{
- QStringList result;
-
- QV4::ArrayObject *a = jsArray.asArrayObject();
- if (!a)
- return result;
- QV4::ExecutionEngine *e = a->internalClass->engine;
-
- uint32_t length = a->arrayLength();
- for (uint32_t i = 0; i < length; ++i)
- result.append(a->getIndexed(e->current, i).toString(e->current)->toQString());
- return result;
-}
-
-
-// Converts a JS Date to a QDateTime.
-QDateTime QJSConverter::toDateTime(QV4::DateObject *jsDate)
-{
- return QDateTime::fromMSecsSinceEpoch(jsDate->value.doubleValue());
-}
-
-// Converts a QDateTime to a JS Date.
-QV4::DateObject *QJSConverter::toDateTime(const QDateTime &dt)
-{
- double date;
- if (!dt.isValid())
- date = qSNaN();
- else
- date = dt.toMSecsSinceEpoch();
- QV4::ExecutionEngine *e = v8::Isolate::GetCurrent()->GetEngine();
- return e->newDateObject(QV4::Value::fromDouble(date));
-}
-
-QT_END_NAMESPACE
-
-#endif // QJSCONVERTER_IMPL_P_H
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QJSCONVERTER_P_H
-#define QJSCONVERTER_P_H
-
-#include "qjsvalue_p.h"
-#include <QtCore/qglobal.h>
-#include <QtCore/qnumeric.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qvarlengtharray.h>
-#include <QtCore/qregexp.h>
-#include <QtCore/qdatetime.h>
-
-#include <private/qv8_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QV4 {
-struct RegExpObject;
-struct DateObject;
-struct Value;
-}
-
-/*
- \internal
- \class QJSConverter
- QJSValue and QJSEngine helper class. This class's responsibility is to convert values
- between JS values and Qt/C++ values.
-
- This is a nice way to inline these functions in both QJSValue and QJSEngine.
-*/
-class QJSConverter {
-public:
- // Converts a JS RegExp to a QRegExp.
- // The conversion is not 100% exact since ECMA regexp and QRegExp
- // have different semantics/flags, but we try to do our best.
- static QRegExp toRegExp(const QV4::RegExpObject *jsRegExp);
-
- // Converts a QRegExp to a JS RegExp.
- // The conversion is not 100% exact since ECMA regexp and QRegExp
- // have different semantics/flags, but we try to do our best.
- static QV4::RegExpObject *toRegExp(const QRegExp &re);
-
- // Converts a QStringList to JS.
- // The result is a new Array object with length equal to the length
- // of the QStringList, and the elements being the QStringList's
- // elements converted to JS Strings.
- static QV4::Value toStringList(const QStringList &list);
-
- // Converts a JS Array object to a QStringList.
- // The result is a QStringList with length equal to the length
- // of the JS Array, and elements being the JS Array's elements
- // converted to QStrings.
- static QStringList toStringList(const QV4::Value &jsArray);
-
- // Converts a JS Date to a QDateTime.
- static QDateTime toDateTime(QV4::DateObject *jsDate);
-
- // Converts a QDateTime to a JS Date.
- static QV4::DateObject *toDateTime(const QDateTime &dt);
-};
-
-QT_END_NAMESPACE
-
-#endif
QV4::DateObject *date = d->value.asDateObject();
if (!date)
return QDateTime();
- return QV4::DatePrototype::toQDateTime(date->value.toNumber());
+ return date->toQDateTime();
}
/*!
#include <private/qqmlstringconverters_p.h>
#include <private/qqmllocale_p.h>
#include <private/qv8engine_p.h>
-#include <private/qjsconverter_p.h>
#include <private/qv8profilerservice_p.h>
#include <private/qqmlprofilerservice_p.h>
#include "private/qv4engine_p.h"
#include "private/qv4object_p.h"
#include "private/qv4objectiterator_p.h"
-#include "qjsconverter_p.h"
QT_BEGIN_NAMESPACE
#include <private/qqmlglobal_p.h>
#include <private/qqmlmemoryprofiler_p.h>
#include <private/qqmlplatform_p.h>
-#include <private/qjsconverter_p.h>
+#include <private/qjsvalue_p.h>
#include "qv4domerrors_p.h"
#include "qv4sqlerrors_p.h"
case QMetaType::QChar:
return QV4::Value::fromInt32((*reinterpret_cast<const QChar*>(ptr)).unicode());
case QMetaType::QDateTime:
- return QV4::Value::fromObject(QJSConverter::toDateTime(*reinterpret_cast<const QDateTime *>(ptr)));
+ return QV4::Value::fromObject(m_v4Engine->newDateObject(*reinterpret_cast<const QDateTime *>(ptr)));
case QMetaType::QDate:
- return QV4::Value::fromObject(QJSConverter::toDateTime(QDateTime(*reinterpret_cast<const QDate *>(ptr))));
+ return QV4::Value::fromObject(m_v4Engine->newDateObject(QDateTime(*reinterpret_cast<const QDate *>(ptr))));
case QMetaType::QTime:
- return QV4::Value::fromObject(QJSConverter::toDateTime(QDateTime(QDate(1970,1,1), *reinterpret_cast<const QTime *>(ptr))));
+ return QV4::Value::fromObject(m_v4Engine->newDateObject(QDateTime(QDate(1970,1,1), *reinterpret_cast<const QTime *>(ptr))));
case QMetaType::QRegExp:
- return QV4::Value::fromObject(QJSConverter::toRegExp(*reinterpret_cast<const QRegExp *>(ptr)));
+ return QV4::Value::fromObject(m_v4Engine->newRegExpObject(*reinterpret_cast<const QRegExp *>(ptr)));
case QMetaType::QObjectStar:
return newQObject(*reinterpret_cast<QObject* const *>(ptr));
case QMetaType::QStringList:
Q_ASSERT(value.isObject());
if (QV4::RegExpObject *re = value.asRegExpObject())
- return QJSConverter::toRegExp(re);
+ return re->toQRegExp();
if (QV4::ArrayObject *a = value.asArrayObject()) {
QVariantList rv;
case QMetaType::QChar:
return QV4::Value::fromUInt32((*reinterpret_cast<const QChar*>(data)).unicode());
case QMetaType::QStringList:
- result = QJSConverter::toStringList(*reinterpret_cast<const QStringList *>(data));
+ result = QV4::Value::fromObject(m_v4Engine->newArrayObject(*reinterpret_cast<const QStringList *>(data)));
break;
case QMetaType::QVariantList:
result = variantListToJS(*reinterpret_cast<const QVariantList *>(data));
result = variantMapToJS(*reinterpret_cast<const QVariantMap *>(data));
break;
case QMetaType::QDateTime:
- result = QV4::Value::fromObject(QJSConverter::toDateTime(*reinterpret_cast<const QDateTime *>(data)));
+ result = QV4::Value::fromObject(m_v4Engine->newDateObject(*reinterpret_cast<const QDateTime *>(data)));
break;
case QMetaType::QDate:
- result = QV4::Value::fromObject(QJSConverter::toDateTime(QDateTime(*reinterpret_cast<const QDate *>(data))));
+ result = QV4::Value::fromObject(m_v4Engine->newDateObject(QDateTime(*reinterpret_cast<const QDate *>(data))));
break;
case QMetaType::QRegExp:
- result = QV4::Value::fromObject(QJSConverter::toRegExp(*reinterpret_cast<const QRegExp *>(data)));
+ result = QV4::Value::fromObject(m_v4Engine->newRegExpObject(*reinterpret_cast<const QRegExp *>(data)));
break;
case QMetaType::QObjectStar:
result = newQObject(*reinterpret_cast<QObject* const *>(data));
return true;
case QMetaType::QDateTime:
if (QV4::DateObject *d = value.asDateObject()) {
- *reinterpret_cast<QDateTime *>(data) = QV4::DatePrototype::toQDateTime(d->value.doubleValue());
+ *reinterpret_cast<QDateTime *>(data) = d->toQDateTime();
return true;
} break;
case QMetaType::QDate:
if (QV4::DateObject *d = value.asDateObject()) {
- *reinterpret_cast<QDate *>(data) = QV4::DatePrototype::toQDateTime(d->value.doubleValue()).date();
+ *reinterpret_cast<QDate *>(data) = d->toQDateTime().date();
return true;
} break;
case QMetaType::QRegExp:
if (QV4::RegExpObject *r = value.asRegExpObject()) {
- *reinterpret_cast<QRegExp *>(data) = QJSConverter::toRegExp(r);
+ *reinterpret_cast<QRegExp *>(data) = r->toQRegExp();
return true;
} break;
case QMetaType::QObjectStar: {
}
case QMetaType::QStringList:
if (QV4::ArrayObject *a = value.asArrayObject()) {
- *reinterpret_cast<QStringList *>(data) = QJSConverter::toStringList(value);
+ *reinterpret_cast<QStringList *>(data) = a->toQStringList();
return true;
} break;
case QMetaType::QVariantList:
if (QV4::ArrayObject *a = value.asArrayObject())
return variantListFromJS(a, visitedObjects);
if (QV4::DateObject *d = value.asDateObject())
- return QJSConverter::toDateTime(d);
+ return d->toQDateTime();
if (QV4::RegExpObject *re = value.asRegExpObject())
- return QJSConverter::toRegExp(re);
+ return re->toQRegExp();
if (isVariant(value))
return variantWrapper()->variantValue(v8::Value::fromV4Value(value));
if (isQObject(value))
$$PWD/qjsvalue.h \
$$PWD/qjsvalue_p.h \
$$PWD/qjsvalueiterator.h \
- $$PWD/qjsconverter_p.h \
- $$PWD/qjsconverter_impl_p.h \
$$PWD/qscriptisolate_p.h \
$$PWD/qjsvalueiterator_p.h