diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2009-06-16 16:18:58 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-06-16 16:18:59 (GMT) |
commit | d612b4789f7ec891ada16afbbbf1c13ab0f0e575 (patch) | |
tree | 0e25f0dd66abbe087220c3de9c258bc6215db639 /src/script/bridge/qscriptfunction_p.h | |
parent | 94e39aff7dd02d4a631d5c40c6f5a5f6fa424035 (diff) | |
download | Qt-d612b4789f7ec891ada16afbbbf1c13ab0f0e575.zip Qt-d612b4789f7ec891ada16afbbbf1c13ab0f0e575.tar.gz Qt-d612b4789f7ec891ada16afbbbf1c13ab0f0e575.tar.bz2 |
Import JSC-based Qt Script from Kent's tree.
Diffstat (limited to 'src/script/bridge/qscriptfunction_p.h')
-rw-r--r-- | src/script/bridge/qscriptfunction_p.h | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/src/script/bridge/qscriptfunction_p.h b/src/script/bridge/qscriptfunction_p.h new file mode 100644 index 0000000..87e3d59 --- /dev/null +++ b/src/script/bridge/qscriptfunction_p.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $TROLLTECH_DUAL_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCRIPTFUNCTION_P_H +#define QSCRIPTFUNCTIOn_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_SCRIPT + +#include "qscriptengine.h" + +#include "PrototypeFunction.h" + +QT_BEGIN_NAMESPACE + +namespace QScript +{ + +class FunctionWrapper : public JSC::PrototypeFunction // ### subclass InternalFunction instead +{ +public: + // work around CELL_SIZE limitation + struct Data + { + QScriptEngine *engine; + QScriptEngine::FunctionSignature function; + }; + + FunctionWrapper(QScriptEngine *, int length, const JSC::Identifier&, QScriptEngine::FunctionSignature); + ~FunctionWrapper(); + +private: + virtual JSC::ConstructType getConstructData(JSC::ConstructData&); + + static JSC::JSValue JSC_HOST_CALL proxyCall(JSC::ExecState *, JSC::JSObject *, JSC::JSValue, const JSC::ArgList &); + static JSC::JSObject* proxyConstruct(JSC::ExecState *, JSC::JSObject *, const JSC::ArgList &); + +private: + Data *data; +}; + +class FunctionWithArgWrapper : public JSC::PrototypeFunction +{ +public: + // work around CELL_SIZE limitation + struct Data + { + QScriptEngine *engine; + QScriptEngine::FunctionWithArgSignature function; + void *arg; + }; + + FunctionWithArgWrapper(QScriptEngine *, int length, const JSC::Identifier&, QScriptEngine::FunctionWithArgSignature, void *); + ~FunctionWithArgWrapper(); + +private: + virtual JSC::ConstructType getConstructData(JSC::ConstructData&); + + static JSC::JSValue proxyCall(JSC::ExecState *, JSC::JSObject *, JSC::JSValue , const JSC::ArgList &); + static JSC::JSObject* proxyConstruct(JSC::ExecState *, JSC::JSObject *, const JSC::ArgList &); + +private: + Data *data; +}; + +} // namespace QScript + +QT_END_NAMESPACE + +#endif // QT_NO_SCRIPT + +#endif |