28 #include <QtScript/qscriptstring.h> 29 #include <QtScript/qscriptengine.h> 30 #include <QtScript/qscriptengineagent.h> 31 #include <private/qscriptengine_p.h> 32 #include <private/qscriptvalue_p.h> 33 #include <private/qscriptqobject_p.h> 34 #include <private/qscriptactivationobject_p.h> 35 #include <QtCore/qstringlist.h> 54 new (
this) JSC::JSValue(JSC::jsUndefined());
59 new (
this) JSC::JSValue((JSC::JSValue &)other);
80 new (
this) JSC::JSValue(JSC::JSValue::JSTrue);
82 new (
this) JSC::JSValue(JSC::JSValue::JSFalse);
118 new (
this) JSC::JSValue(JSC::JSValue::JSTrue);
120 new (
this) JSC::JSValue(JSC::JSValue::JSFalse);
145 ((JSC::JSValue *)(
this))->~JSValue();
154 : identifier(0),
engine(0)
156 new (&
d) JSC::Identifier();
163 ((JSC::Identifier &)
d).JSC::Identifier::~Identifier();
165 ((JSC::Identifier &)
d).JSC::Identifier::~Identifier();
173 new (&
d) JSC::Identifier((JSC::Identifier &)(other.
d));
181 ((JSC::Identifier &)
d) = (JSC::Identifier &)(other.
d);
187 return ((JSC::Identifier &)
d).ustring();
193 Q_ASSERT(
sizeof(
void*) ==
sizeof(JSC::Identifier));
234 if (!d || !d->
isJSC())
242 if (!d || !d->
isJSC())
256 JSC::JSObject *
object = d->
jscValue.getObject();
257 JSC::PropertySlot slot(const_cast<JSC::JSObject*>(
object));
260 JSC::Identifier id(exec, (JSC::UString::Rep *)name);
262 if (const_cast<JSC::JSObject*>(
object)->getOwnPropertySlot(exec,
id, slot)) {
263 result = slot.getValue(exec,
id);
280 JSC::JSObject *
object = d->
jscValue.getObject();
281 JSC::PropertySlot slot(const_cast<JSC::JSObject*>(
object));
284 JSC::Identifier id(exec, (JSC::UString::Rep *)name);
286 if (const_cast<JSC::JSObject*>(
object)->getOwnPropertySlot(exec,
id, slot)) {
287 result = slot.getValue(exec,
id);
304 JSC::JSObject *
object = d->
jscValue.getObject();
305 JSC::PropertySlot slot(const_cast<JSC::JSObject*>(
object));
308 JSC::Identifier id(exec, (JSC::UString::Rep *)name);
310 if (const_cast<JSC::JSObject*>(
object)->getOwnPropertySlot(exec,
id, slot)) {
311 result = slot.getValue(exec,
id);
329 JSC::JSObject *
object = d->
jscValue.getObject();
330 JSC::PropertySlot slot(const_cast<JSC::JSObject*>(
object));
333 JSC::Identifier id(exec, (JSC::UString::Rep *)name);
335 if (const_cast<JSC::JSObject*>(
object)->getOwnPropertySlot(exec,
id, slot)) {
336 result = slot.getValue(exec,
id);
355 JSC::ScopeChainNode *node = frame->scopeChain();
356 JSC::ScopeChainIterator
it(node);
360 for (it = node->begin(); it != node->end(); ++
it)
367 index = count -
index;
370 for (it = node->begin(); it != node->end(); ++
it) {
374 JSC::JSObject *
object = *
it;
418 JSC::ArgList(), 0,
false,
true);
454 new (&rv.
d) JSC::Identifier(exec, (UChar *)str.
constData(), str.
size());
455 rv.
identifier = (
void *)((JSC::Identifier &)rv.
d).ustring().rep();
468 new (&rv.
d) JSC::Identifier(exec, (JSC::UString::Rep *)id);
469 rv.
identifier = (
void *)((JSC::Identifier &)rv.
d).ustring().rep();
475 JSC::UString::Rep *r = (JSC::UString::Rep *)identifier;
481 JSC::UString::Rep *r = (JSC::UString::Rep *)identifier;
489 JSC::UString::Rep *r = (JSC::UString::Rep *)identifier;
491 return s.toArrayIndex(ok);
494 QScriptClass::QueryFlags
496 QScriptClass::QueryFlags flags)
580 for (
int i = 0; i < propertyCount; ++i) {
583 JSC::Identifier
id = JSC::Identifier(exec, names[i]);
588 propertyCount, props));
The QVariant class acts like a union for the most common Qt data types.
static unsigned propertyFlagsToJSCAttributes(const QScriptValue::PropertyFlags &flags)
The QScriptContext class represents a Qt Script function invocation.
virtual Value call(Object *, QScriptContext *)
static JSC::ExecState * frameForContext(QScriptContext *context)
QScriptEnginePrivate * scriptEngineFromExec(const JSC::ExecState *exec)
#define QT_END_NAMESPACE
This macro expands to.
bool startsWithUpper(const Identifier &)
virtual ~QScriptDeclarativeClass()
static const JSC::ClassInfo info
virtual QVariant toVariant(Object *, bool *ok=0)
#define it(className, varName)
static QScriptEnginePrivate * get(QScriptEngine *q)
QScopedPointer< QScriptDeclarativeClassPrivate > d_ptr
static QScriptValue newObject(QScriptEngine *, QScriptDeclarativeClass *, Object *)
WTF::RefPtr< JSC::Structure > staticScopeObjectStructure
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.
static QScriptValuePrivate * get(const QScriptValue &q)
static QScriptValue function(const QScriptValue &, const Identifier &)
static QScriptDeclarativeClass::Value jscToValue(const JSC::JSValue &val)
static Object * object(const QScriptValue &)
QScriptEngine * engine() const
Returns the QScriptEngine that this QScriptContext belongs to.
static QScriptDeclarativeClass * declarativeClass(JSC::JSValue)
The QString class provides a Unicode character string.
Q_DECL_CONSTEXPR T qAbs(const T &t)
The QObject class is the base class of all Qt objects.
static QObjectPrivate * get(QObject *o)
PersistentIdentifier createPersistentIdentifier(const QString &)
The QChar class provides a 16-bit Unicode character.
The QScriptDeclarativeClass::Value class acts as a container for JavaScript data types.
virtual void setProperty(Object *, const Identifier &name, const QScriptValue &)
JSC::ExecState * currentFrame
Category category() const
Returns the character's category.
virtual bool compare(Object *, Object *)
The QScriptEngine class provides an environment for evaluating Qt Script code.
#define QT_BEGIN_NAMESPACE
This macro expands to.
virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &, QScriptClass::QueryFlags flags)
JSC::JSValue scriptValueToJSCValue(const QScriptValue &value)
static QScriptContext * contextForFrame(JSC::ExecState *frame)
QScriptEnginePrivate * engine
static Value newObjectValue(QScriptEngine *, QScriptDeclarativeClass *, Object *)
int size() const
Returns the number of characters in this string.
QScriptValue toScriptValue(QScriptEngine *) const
virtual QScriptValue::PropertyFlags propertyFlags(Object *, const Identifier &)
QScriptEngine * engine() const
The QStringList class provides a list of strings.
static Value functionValue(const QScriptValue &, const Identifier &)
bool isFunction(JSC::JSValue value)
static Value propertyValue(const QScriptValue &, const Identifier &)
static QScriptValue newStaticScopeObject(QScriptEngine *, int propertyCount, const QString *names, const QScriptValue *values, const QScriptValue::PropertyFlags *flags)
Creates a scope object with a fixed set of undeletable properties.
#define Q_ASSERT_X(cond, where, what)
void setSupportsCall(bool)
quint32 toArrayIndex(const Identifier &, bool *ok)
WTF::RefPtr< JSC::Structure > scriptObjectStructure
bool supportsCall() const
virtual QObject * toQObject(Object *, bool *ok=0)
static QScriptDeclarativeClass::Object * declarativeObject(JSC::JSValue)
static QScriptValue scopeChainValue(QScriptContext *, int index)
virtual bool isQObject() const
QScriptEngineAgent * agent() const
Returns the agent currently installed on this engine, or 0 if no agent is installed.
void setDelegate(QScriptObjectDelegate *delegate)
static QScriptDeclarativeClass * scriptClass(const QScriptValue &)
virtual void contextPush()
This function is called when a new script context has been pushed.
QScriptValue scriptValueFromJSCValue(JSC::JSValue value)
QScriptValue activationObject() const
Returns the activation object of this QScriptContext.
Represent a scope for native function call.
QScriptDeclarativeClass(QScriptEngine *engine)
QScriptContext * context() const
Represents a static scope object.
The QScriptValue class acts as a container for the Qt Script data types.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
QString toString(const Identifier &)
QScriptEnginePrivate * engine
const QChar * constData() const
Returns a pointer to the data stored in the QString.
static QScriptContext * pushCleanContext(QScriptEngine *)
Enters a new execution context and returns the associated QScriptContext object.
QScriptDeclarativeClass * q_ptr
static QScriptValue property(const QScriptValue &, const Identifier &)
PersistentIdentifier & operator=(const PersistentIdentifier &other)
virtual QStringList propertyNames(Object *)