Qt 4.8
Classes | Public Functions | Static Public Variables | Private Functions | Static Private Functions | Properties | List of all members
QScript::FunctionWithArgWrapper Class Reference

#include <qscriptfunction_p.h>

Inheritance diagram for QScript::FunctionWithArgWrapper:

Classes

struct  Data
 

Public Functions

void * arg () const
 
virtual const JSC::ClassInfo * classInfo () const
 
QScriptEngine::FunctionWithArgSignature function () const
 
 FunctionWithArgWrapper (JSC::ExecState *, int length, const JSC::Identifier &, QScriptEngine::FunctionWithArgSignature, void *)
 
 ~FunctionWithArgWrapper ()
 

Static Public Variables

static const JSC::ClassInfo info = { "QtNativeFunctionWithArgWrapper", &PrototypeFunction::info, 0, 0 }
 

Private Functions

virtual JSC::ConstructType getConstructData (JSC::ConstructData &)
 

Static Private Functions

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 &)
 

Properties

Datadata
 

Detailed Description

Definition at line 80 of file qscriptfunction_p.h.

Constructors and Destructors

◆ FunctionWithArgWrapper()

QScript::FunctionWithArgWrapper::FunctionWithArgWrapper ( JSC::ExecState *  exec,
int  length,
const JSC::Identifier &  name,
QScriptEngine::FunctionWithArgSignature  function,
void *  arg 
)

Definition at line 116 of file qscriptfunction.cpp.

118  : JSC::PrototypeFunction(exec, length, name, proxyCall),
119  data(new Data())
120 {
121  data->function = function;
122  data->arg = arg;
123 }
const char * name
QScriptEngine::FunctionWithArgSignature function
static JSC::JSValue JSC_HOST_CALL proxyCall(JSC::ExecState *, JSC::JSObject *, JSC::JSValue, const JSC::ArgList &)

◆ ~FunctionWithArgWrapper()

QScript::FunctionWithArgWrapper::~FunctionWithArgWrapper ( )

Definition at line 125 of file qscriptfunction.cpp.

126 {
127  delete data;
128 }

Functions

◆ arg()

void* QScript::FunctionWithArgWrapper::arg ( ) const
inline

◆ classInfo()

virtual const JSC::ClassInfo* QScript::FunctionWithArgWrapper::classInfo ( ) const
inlinevirtual

Definition at line 94 of file qscriptfunction_p.h.

94 { return &info; }
static const JSC::ClassInfo info

◆ function()

QScriptEngine::FunctionWithArgSignature QScript::FunctionWithArgWrapper::function ( ) const
inline

Definition at line 97 of file qscriptfunction_p.h.

Referenced by QScript::QMetaObjectWrapperObject::execute().

98  { return data->function; }
QScriptEngine::FunctionWithArgSignature function

◆ getConstructData()

JSC::ConstructType QScript::FunctionWithArgWrapper::getConstructData ( JSC::ConstructData &  consData)
privatevirtual

Definition at line 130 of file qscriptfunction.cpp.

131 {
132  consData.native.function = proxyConstruct;
133  return JSC::ConstructTypeHost;
134 }
static JSC::JSObject * proxyConstruct(JSC::ExecState *, JSC::JSObject *, const JSC::ArgList &)

◆ proxyCall()

JSC::JSValue QScript::FunctionWithArgWrapper::proxyCall ( JSC::ExecState *  exec,
JSC::JSObject *  callee,
JSC::JSValue  thisObject,
const JSC::ArgList &  args 
)
staticprivate

Definition at line 136 of file qscriptfunction.cpp.

138 {
139  FunctionWithArgWrapper *self = static_cast<FunctionWithArgWrapper*>(callee);
141 
142  JSC::ExecState *oldFrame = eng_p->currentFrame;
143  eng_p->pushContext(exec, thisObject, args, callee);
145 
146  QScriptValue result = self->data->function(ctx, QScriptEnginePrivate::get(eng_p), self->data->arg);
147 
148  eng_p->popContext();
149  eng_p->currentFrame = oldFrame;
150 
151  return eng_p->scriptValueToJSCValue(result);
152 }
The QScriptContext class represents a Qt Script function invocation.
QScriptEnginePrivate * scriptEngineFromExec(const JSC::ExecState *exec)
static QScriptEnginePrivate * get(QScriptEngine *q)
JSC::CallFrame * pushContext(JSC::CallFrame *exec, JSC::JSValue thisObject, const JSC::ArgList &args, JSC::JSObject *callee, bool calledAsConstructor=false, bool clearScopeChain=false)
JSC native function doesn&#39;t have different stackframe or context.
JSC::ExecState * currentFrame
FunctionWithArgWrapper(JSC::ExecState *, int length, const JSC::Identifier &, QScriptEngine::FunctionWithArgSignature, void *)
JSC::JSValue scriptValueToJSCValue(const QScriptValue &value)
static QScriptContext * contextForFrame(JSC::ExecState *frame)
QScriptValue data() const
Returns the internal data of this QScriptValue object.
#define ctx
Definition: qgl.cpp:6094
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57

◆ proxyConstruct()

JSC::JSObject * QScript::FunctionWithArgWrapper::proxyConstruct ( JSC::ExecState *  exec,
JSC::JSObject *  callee,
const JSC::ArgList &  args 
)
staticprivate

Definition at line 154 of file qscriptfunction.cpp.

Referenced by getConstructData().

156 {
157  FunctionWithArgWrapper *self = static_cast<FunctionWithArgWrapper*>(callee);
159 
160  JSC::ExecState *oldFrame = eng_p->currentFrame;
161  eng_p->pushContext(exec, JSC::JSValue(), args, callee, true);
163 
164  QScriptValue result = self->data->function(ctx, QScriptEnginePrivate::get(eng_p) , self->data->arg);
165  if (!result.isObject())
166  result = ctx->thisObject();
167 
168  eng_p->popContext();
169  eng_p->currentFrame = oldFrame;
170 
171  return JSC::asObject(eng_p->scriptValueToJSCValue(result));
172 }
The QScriptContext class represents a Qt Script function invocation.
QScriptEnginePrivate * scriptEngineFromExec(const JSC::ExecState *exec)
static QScriptEnginePrivate * get(QScriptEngine *q)
JSC::CallFrame * pushContext(JSC::CallFrame *exec, JSC::JSValue thisObject, const JSC::ArgList &args, JSC::JSObject *callee, bool calledAsConstructor=false, bool clearScopeChain=false)
JSC native function doesn&#39;t have different stackframe or context.
JSC::ExecState * currentFrame
FunctionWithArgWrapper(JSC::ExecState *, int length, const JSC::Identifier &, QScriptEngine::FunctionWithArgSignature, void *)
JSC::JSValue scriptValueToJSCValue(const QScriptValue &value)
static QScriptContext * contextForFrame(JSC::ExecState *frame)
QScriptValue data() const
Returns the internal data of this QScriptValue object.
#define ctx
Definition: qgl.cpp:6094
QScriptValue thisObject() const
Returns the `this&#39; object associated with this QScriptContext.
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57
bool isObject() const
Returns true if this QScriptValue is of the Object type; otherwise returns false. ...

Properties

◆ data

Data* QScript::FunctionWithArgWrapper::data
private

Definition at line 112 of file qscriptfunction_p.h.

Referenced by FunctionWithArgWrapper(), and ~FunctionWithArgWrapper().

◆ info

const JSC::ClassInfo QScript::FunctionWithArgWrapper::info = { "QtNativeFunctionWithArgWrapper", &PrototypeFunction::info, 0, 0 }
static

Definition at line 95 of file qscriptfunction_p.h.

Referenced by QScript::QMetaObjectWrapperObject::execute().


The documentation for this class was generated from the following files: