diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2010-02-18 11:59:48 (GMT) |
---|---|---|
committer | Kent Hansen <kent.hansen@nokia.com> | 2010-02-18 16:35:45 (GMT) |
commit | d65299511f80c67be4c326a91106ae273aad6d66 (patch) | |
tree | 43d561a467e16b695783c2d8fd2352b072c2d5e4 /src/script/api/qscriptengine_p.h | |
parent | 0cad410d78758c79126d15664ec3d527883a9496 (diff) | |
download | Qt-d65299511f80c67be4c326a91106ae273aad6d66.zip Qt-d65299511f80c67be4c326a91106ae273aad6d66.tar.gz Qt-d65299511f80c67be4c326a91106ae273aad6d66.tar.bz2 |
Move implementation of QScriptValue construction functions to private class
In preparation of getting rid of QScriptValue construction internally;
the implementation should only call the private functions that operate
directly on JSC::JSValues.
Reviewed-by: Jedrzej Nowacki
Diffstat (limited to 'src/script/api/qscriptengine_p.h')
-rw-r--r-- | src/script/api/qscriptengine_p.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index f55dc27..46df429 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -41,10 +41,15 @@ #include <QtCore/qset.h> #include "qscriptvalue_p.h" #include "qscriptstring_p.h" +#include "bridge/qscriptobject_p.h" +#include "utils/qscriptdate_p.h" +#include "DateConstructor.h" #include "Debugger.h" +#include "JSArray.h" #include "Lexer.h" #include "RefPtr.h" +#include "RegExpConstructor.h" #include "SourceProvider.h" #include "Structure.h" #include "JSGlobalObject.h" @@ -203,6 +208,18 @@ public: inline void unregisterScriptString(QScriptStringPrivate *value); void detachAllRegisteredScriptStrings(); + static inline JSC::JSValue newArray(JSC::ExecState *, uint length); + static inline JSC::JSValue newDate(JSC::ExecState *, qsreal value); + static inline JSC::JSValue newDate(JSC::ExecState *, const QDateTime &); + inline JSC::JSValue newObject(); + +#ifndef QT_NO_REGEXP + static JSC::JSValue newRegExp(JSC::ExecState *, const QRegExp &); +#endif + + static JSC::JSValue newRegExp(JSC::ExecState *, const QString &pattern, const QString &flags); + JSC::JSValue newVariant(const QVariant &); + #ifndef QT_NO_QOBJECT JSC::JSValue newQObject(QObject *object, QScriptEngine::ValueOwnership ownership = QScriptEngine::QtOwnership, @@ -587,6 +604,28 @@ inline JSC::ExecState *QScriptEnginePrivate::globalExec() const return originalGlobalObject()->globalExec(); } +inline JSC::JSValue QScriptEnginePrivate::newArray(JSC::ExecState *exec, uint length) +{ + return JSC::constructEmptyArray(exec, length); +} + +inline JSC::JSValue QScriptEnginePrivate::newDate(JSC::ExecState *exec, qsreal value) +{ + JSC::JSValue val = JSC::jsNumber(exec, value); + JSC::ArgList args(&val, 1); + return JSC::constructDate(exec, args); +} + +inline JSC::JSValue QScriptEnginePrivate::newDate(JSC::ExecState *exec, const QDateTime &value) +{ + return newDate(exec, QScript::FromDateTime(value)); +} + +inline JSC::JSValue QScriptEnginePrivate::newObject() +{ + return new (currentFrame)QScriptObject(scriptObjectStructure); +} + QT_END_NAMESPACE #endif |