diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2010-03-01 10:11:30 (GMT) |
---|---|---|
committer | Kent Hansen <kent.hansen@nokia.com> | 2010-03-01 14:37:26 (GMT) |
commit | 9d38d8005876d808f499591d1427b227f4b9764f (patch) | |
tree | a8a7119f30c762be04df15e537507fa1351d9644 /src | |
parent | 2fa8c8d4ddc162297a05f2908e0d86eb2c738153 (diff) | |
download | Qt-9d38d8005876d808f499591d1427b227f4b9764f.zip Qt-9d38d8005876d808f499591d1427b227f4b9764f.tar.gz Qt-9d38d8005876d808f499591d1427b227f4b9764f.tar.bz2 |
Avoid conversion between JavaScriptCore String type and QString
Use JSC::UString internally. Only when the public API demands it
should a JSC::UString be converted to a QString.
Reviewed-by: Jedrzej Nowacki
Diffstat (limited to 'src')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 10 | ||||
-rw-r--r-- | src/script/api/qscriptengine_p.h | 20 | ||||
-rw-r--r-- | src/script/api/qscriptvalue.cpp | 2 | ||||
-rw-r--r-- | src/script/api/qscriptvalue_p.h | 4 |
4 files changed, 18 insertions, 18 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index d2e96d1..a9d6fb1 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -563,7 +563,7 @@ JSC::JSValue JSC_HOST_CALL functionDisconnect(JSC::ExecState *exec, JSC::JSObjec slot = arg1; else { QScript::SaveFrameHelper saveFrame(engine, exec); - QString propertyName(QScriptEnginePrivate::toString(exec, arg1)); + JSC::UString propertyName = QScriptEnginePrivate::toString(exec, arg1); slot = QScriptEnginePrivate::property(exec, arg0, propertyName, QScriptValue::ResolvePrototype); } } @@ -645,7 +645,7 @@ JSC::JSValue JSC_HOST_CALL functionConnect(JSC::ExecState *exec, JSC::JSObject * slot = arg1; else { QScript::SaveFrameHelper saveFrame(engine, exec); - QString propertyName = QScriptEnginePrivate::toString(exec, arg1); + JSC::UString propertyName = QScriptEnginePrivate::toString(exec, arg1); slot = QScriptEnginePrivate::property(exec, arg0, propertyName, QScriptValue::ResolvePrototype); } } @@ -1580,9 +1580,9 @@ QRegExp QScriptEnginePrivate::toRegExp(JSC::ExecState *exec, JSC::JSValue value) { if (!isRegExp(value)) return QRegExp(); - QString pattern = toString(exec, property(exec, value, QLatin1String("source"), QScriptValue::ResolvePrototype)); + QString pattern = toString(exec, property(exec, value, "source", QScriptValue::ResolvePrototype)); Qt::CaseSensitivity kase = Qt::CaseSensitive; - if (toBool(exec, property(exec, value, QLatin1String("ignoreCase"), QScriptValue::ResolvePrototype))) + if (toBool(exec, property(exec, value, "ignoreCase", QScriptValue::ResolvePrototype))) kase = Qt::CaseInsensitive; return QRegExp(pattern, kase, QRegExp::RegExp2); } @@ -1637,7 +1637,7 @@ JSC::JSValue QScriptEnginePrivate::propertyHelper(JSC::ExecState *exec, JSC::JSV } if (!result && (resolveMode & QScriptValue::ResolveScope)) { // ### check if it's a function object and look in the scope chain - JSC::JSValue scope = property(exec, value, QString::fromLatin1("__qt_scope__"), QScriptValue::ResolveLocal); + JSC::JSValue scope = property(exec, value, "__qt_scope__", QScriptValue::ResolveLocal); if (isObject(scope)) result = property(exec, scope, id, resolveMode); } diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index d0d020a..a05e12c 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -165,7 +165,7 @@ public: static inline qint32 toInt32(JSC::ExecState *, JSC::JSValue); static inline quint32 toUInt32(JSC::ExecState *, JSC::JSValue); static inline quint16 toUInt16(JSC::ExecState *, JSC::JSValue); - static inline QString toString(JSC::ExecState *, JSC::JSValue); + static inline JSC::UString toString(JSC::ExecState *, JSC::JSValue); static inline QDateTime toDateTime(JSC::ExecState *, JSC::JSValue); #ifndef QT_NO_REGEXP @@ -181,8 +181,8 @@ public: static inline JSC::JSValue property(JSC::ExecState*, JSC::JSValue, quint32 index, int resolveMode = QScriptValue::ResolvePrototype); static JSC::JSValue propertyHelper(JSC::ExecState*, JSC::JSValue, quint32, int resolveMode); - static inline JSC::JSValue property(JSC::ExecState*, JSC::JSValue, const QString &, int resolveMode); - static inline void setProperty(JSC::ExecState*, JSC::JSValue object, const QString &name, JSC::JSValue, + static inline JSC::JSValue property(JSC::ExecState*, JSC::JSValue, const JSC::UString &, int resolveMode); + static inline void setProperty(JSC::ExecState*, JSC::JSValue object, const JSC::UString &name, JSC::JSValue, const QScriptValue::PropertyFlags &flags = QScriptValue::KeepExistingFlags); static void setProperty(JSC::ExecState*, JSC::JSValue object, const JSC::Identifier &id, JSC::JSValue, const QScriptValue::PropertyFlags &flags = QScriptValue::KeepExistingFlags); @@ -191,7 +191,7 @@ public: static QScriptValue::PropertyFlags propertyFlags(JSC::ExecState*, JSC::JSValue value, const JSC::Identifier &id, const QScriptValue::ResolveFlags &mode); static inline QScriptValue::PropertyFlags propertyFlags(JSC::ExecState*, JSC::JSValue value, - const QString &name, const QScriptValue::ResolveFlags &mode); + const JSC::UString &name, const QScriptValue::ResolveFlags &mode); static bool convertValue(JSC::ExecState*, JSC::JSValue value, int type, void *ptr); @@ -629,7 +629,7 @@ inline void QScriptValuePrivate::initFrom(const QString &value) engine->registerScriptValue(this); } -inline JSC::JSValue QScriptEnginePrivate::property(JSC::ExecState *exec, JSC::JSValue value, const QString &name, int resolveMode) +inline JSC::JSValue QScriptEnginePrivate::property(JSC::ExecState *exec, JSC::JSValue value, const JSC::UString &name, int resolveMode) { return property(exec, value, JSC::Identifier(exec, name), resolveMode); } @@ -655,13 +655,13 @@ inline JSC::JSValue QScriptEnginePrivate::property(JSC::ExecState *exec, JSC::JS } inline QScriptValue::PropertyFlags QScriptEnginePrivate::propertyFlags(JSC::ExecState *exec, JSC::JSValue value, - const QString &name, + const JSC::UString &name, const QScriptValue::ResolveFlags &mode) { return propertyFlags(exec, value, JSC::Identifier(exec, name), mode); } -inline void QScriptEnginePrivate::setProperty(JSC::ExecState *exec, JSC::JSValue objectValue, const QString &name, +inline void QScriptEnginePrivate::setProperty(JSC::ExecState *exec, JSC::JSValue objectValue, const JSC::UString &name, JSC::JSValue value, const QScriptValue::PropertyFlags &flags) { setProperty(exec, objectValue, JSC::Identifier(exec, name), value, flags); @@ -677,7 +677,7 @@ inline JSC::JSValue QScriptValuePrivate::property(quint32 index, int resolveMode return QScriptEnginePrivate::property(engine->currentFrame, jscValue, index, resolveMode); } -inline JSC::JSValue QScriptValuePrivate::property(const QString &name, int resolveMode) const +inline JSC::JSValue QScriptValuePrivate::property(const JSC::UString &name, int resolveMode) const { JSC::ExecState *exec = engine->currentFrame; return QScriptEnginePrivate::property(exec, jscValue, JSC::Identifier(exec, name), resolveMode); @@ -701,7 +701,7 @@ inline void QScriptValuePrivate::setProperty(quint32 index, const JSC::JSValue & QScriptEnginePrivate::setProperty(engine->currentFrame, jscValue, index, value, flags); } -inline void QScriptValuePrivate::setProperty(const QString &name, const JSC::JSValue &value, +inline void QScriptValuePrivate::setProperty(const JSC::UString &name, const JSC::JSValue &value, const QScriptValue::PropertyFlags &flags) { JSC::ExecState *exec = engine->currentFrame; @@ -919,7 +919,7 @@ inline quint16 QScriptEnginePrivate::toUInt16(JSC::ExecState *exec, JSC::JSValue return QScript::ToUInt16(toNumber(exec, value)); } -inline QString QScriptEnginePrivate::toString(JSC::ExecState *exec, JSC::JSValue value) +inline JSC::UString QScriptEnginePrivate::toString(JSC::ExecState *exec, JSC::JSValue value) { JSC::JSValue savedException; saveException(exec, &savedException); diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 7f1fdaa..414a45c 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -562,7 +562,7 @@ QScriptValue QScriptValue::scope() const if (!d || !d->isObject()) return QScriptValue(); // ### make hidden property - JSC::JSValue result = d->property(QLatin1String("__qt_scope__"), QScriptValue::ResolveLocal); + JSC::JSValue result = d->property("__qt_scope__", QScriptValue::ResolveLocal); return d->engine->scriptValueFromJSCValue(result); } diff --git a/src/script/api/qscriptvalue_p.h b/src/script/api/qscriptvalue_p.h index 77b7330..089b923 100644 --- a/src/script/api/qscriptvalue_p.h +++ b/src/script/api/qscriptvalue_p.h @@ -88,8 +88,8 @@ public: inline JSC::JSValue property(const JSC::Identifier &id, int resolveMode) const; inline JSC::JSValue property(quint32 index, int resolveMode) const; - inline JSC::JSValue property(const QString &, int resolveMode) const; - inline void setProperty(const QString &name, const JSC::JSValue &value, + inline JSC::JSValue property(const JSC::UString &, int resolveMode) const; + inline void setProperty(const JSC::UString &name, const JSC::JSValue &value, const QScriptValue::PropertyFlags &flags); inline void setProperty(const JSC::Identifier &id, const JSC::JSValue &value, const QScriptValue::PropertyFlags &flags); |