27 #include "../api/qscriptengine.h" 28 #include "../api/qscriptengine_p.h" 29 #include "../api/qscriptcontext.h" 30 #include "../api/qscriptcontext_p.h" 31 #include "../api/qscriptclass.h" 32 #include "../api/qscriptclasspropertyiterator.h" 35 #include "PropertyNameArray.h" 47 : m_scriptClass(scriptClass)
62 const JSC::Identifier &propertyName,
63 JSC::PropertySlot &slot)
95 const JSC::Identifier &propertyName,
96 JSC::PropertyDescriptor &descriptor)
114 unsigned attribs = 0;
116 attribs |= JSC::ReadOnly;
118 attribs |= JSC::DontEnum;
120 attribs |= JSC::DontDelete;
122 attribs |= JSC::Getter;
124 attribs |= JSC::Setter;
141 const JSC::Identifier &propertyName,
142 JSC::JSValue value, JSC::PutPropertySlot &slot)
161 const JSC::Identifier &propertyName)
183 JSC::PropertyNameArray &propertyNames,
184 JSC::EnumerationMode mode)
198 propertyNames.add(JSC::Identifier(exec, name));
207 return JSC::CallTypeNone;
208 callData.native.function =
call;
209 return JSC::CallTypeHost;
213 JSC::JSValue thisValue,
const JSC::ArgList &args)
216 return JSC::throwError(exec, JSC::TypeError,
"callee is not a ClassObject object");
220 return JSC::throwError(exec, JSC::TypeError,
"callee is not a ClassObject object");
238 return JSC::ConstructTypeNone;
239 constructData.native.function =
construct;
240 return JSC::ConstructTypeHost;
244 const JSC::ArgList &args)
253 eng_p->
pushContext(exec, JSC::JSValue(), args, callee,
true);
259 result = defaultObject;
266 JSC::JSValue value, JSC::JSValue proto)
The QVariant class acts like a union for the most common Qt data types.
The QScriptContext class represents a Qt Script function invocation.
static JSC::JSObject * construct(JSC::ExecState *, JSC::JSObject *, const JSC::ArgList &)
ClassObjectDelegate(QScriptClass *scriptClass)
static JSC::JSValue JSC_HOST_CALL call(JSC::ExecState *, JSC::JSObject *, JSC::JSValue, const JSC::ArgList &)
virtual bool deleteProperty(QScriptObject *, JSC::ExecState *, const JSC::Identifier &propertyName)
QScriptEnginePrivate * scriptEngineFromExec(const JSC::ExecState *exec)
virtual void getOwnPropertyNames(QScriptObject *, JSC::ExecState *, JSC::PropertyNameArray &, JSC::EnumerationMode mode=JSC::ExcludeDontEnumProperties)
virtual Type type() const =0
virtual bool hasInstance(QScriptObject *, JSC::ExecState *, JSC::JSValue value, JSC::JSValue proto)
#define QT_END_NAMESPACE
This macro expands to.
static JSC::JSValue jscValueFromVariant(JSC::ExecState *, const QVariant &value)
The QScriptClass class provides an interface for defining custom behavior of (a class of) Qt Script o...
#define it(className, varName)
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't have different stackframe or context.
QScriptObjectDelegate * delegate() const
virtual bool getOwnPropertyDescriptor(QScriptObject *, JSC::ExecState *, const JSC::Identifier &propertyName, JSC::PropertyDescriptor &)
bool toBool() const
Returns the variant as a bool if the variant has type() Bool.
static void init(QScriptString &q, QScriptStringPrivate *d)
static const JSC::ClassInfo info
The QString class provides a Unicode character string.
virtual void put(QScriptObject *, JSC::ExecState *exec, const JSC::Identifier &propertyName, JSC::JSValue, JSC::PutPropertySlot &)
JSC::ExecState * currentFrame
virtual JSC::ConstructType getConstructData(QScriptObject *, JSC::ConstructData &)
The QScriptString class acts as a handle to "interned" strings in a QScriptEngine.
virtual bool supportsExtension(Extension extension) const
Returns true if the QScriptClass supports the given extension; otherwise, false is returned...
#define QT_BEGIN_NAMESPACE
This macro expands to.
virtual QVariant extension(Extension extension, const QVariant &argument=QVariant())
This virtual function can be reimplemented in a QScriptClass subclass to provide support for extensio...
QScriptClass * scriptClass() const
JSC::JSValue scriptValueToJSCValue(const QScriptValue &value)
static QScriptContext * contextForFrame(JSC::ExecState *frame)
The QScriptClassPropertyIterator class provides an iterator interface for custom Qt Script objects...
virtual void next()=0
Advances the iterator by one position.
QScriptClass * m_scriptClass
virtual QueryFlags queryProperty(const QScriptValue &object, const QScriptString &name, QueryFlags flags, uint *id)
Queries this script class for how access to the property with the given name of the given object shou...
virtual QScriptValue property(const QScriptValue &object, const QScriptString &name, uint id)
Returns the value of the property with the given name of the given object.
virtual Type type() const
virtual JSC::CallType getCallData(QScriptObject *, JSC::CallData &)
static QVariant fromValue(const T &value)
Returns a QVariant containing a copy of value.
virtual bool hasNext() const =0
Returns true if there is at least one item ahead of the iterator (i.
virtual void setProperty(QScriptValue &object, const QScriptString &name, uint id, const QScriptValue &value)
Sets the property with the given name of the given object to the given value.
virtual QScriptString name() const =0
Returns the name of the last property that was jumped over using next() or previous().
virtual bool getOwnPropertySlot(QScriptObject *, JSC::ExecState *, const JSC::Identifier &propertyName, JSC::PropertySlot &)
virtual bool getOwnPropertySlot(QScriptObject *, JSC::ExecState *, const JSC::Identifier &propertyName, JSC::PropertySlot &)
T qvariant_cast(const QVariant &)
virtual void put(QScriptObject *, JSC::ExecState *exec, const JSC::Identifier &propertyName, JSC::JSValue, JSC::PutPropertySlot &)
QScriptValue scriptValueFromJSCValue(JSC::JSValue value)
virtual bool hasInstance(QScriptObject *, JSC::ExecState *, JSC::JSValue value, JSC::JSValue proto)
QScriptValue thisObject() const
Returns the `this' object associated with this QScriptContext.
virtual bool deleteProperty(QScriptObject *, JSC::ExecState *, const JSC::Identifier &propertyName)
QString toString() const
Returns the string that this QScriptString represents, or a null string if this QScriptString is not ...
The QScriptValue class acts as a container for the Qt Script data types.
virtual QScriptValue::PropertyFlags propertyFlags(const QScriptValue &object, const QScriptString &name, uint id)
Returns the flags of the property with the given name of the given object.
bool isValid() const
Returns true if this QScriptValue is valid; otherwise returns false.
virtual void getOwnPropertyNames(QScriptObject *, JSC::ExecState *, JSC::PropertyNameArray &, JSC::EnumerationMode mode=JSC::ExcludeDontEnumProperties)
virtual bool getOwnPropertyDescriptor(QScriptObject *, JSC::ExecState *, const JSC::Identifier &propertyName, JSC::PropertyDescriptor &)
bool isObject() const
Returns true if this QScriptValue is of the Object type; otherwise returns false. ...
virtual QScriptClassPropertyIterator * newIterator(const QScriptValue &object)
Returns an iterator for traversing custom properties of the given object.