Qt 4.8
Public Types | Public Functions | Static Public Functions | Public Variables | List of all members
QScriptValuePrivate Class Reference

#include <qscriptvalue_p.h>

Public Types

enum  Type { JavaScriptCore, Number, String }
 

Public Functions

void detachFromEngine ()
 
void initFrom (JSC::JSValue value)
 
void initFrom (qsreal value)
 
void initFrom (const QString &value)
 
bool isJSC () const
 
bool isObject () const
 
qint64 objectId ()
 
void operator delete (void *)
 
void * operator new (size_t, QScriptEnginePrivate *)
 
JSC::JSValue property (const JSC::Identifier &id, const QScriptValue::ResolveFlags &mode=QScriptValue::ResolvePrototype) const
 
JSC::JSValue property (quint32 index, const QScriptValue::ResolveFlags &mode=QScriptValue::ResolvePrototype) const
 
JSC::JSValue property (const JSC::UString &, const QScriptValue::ResolveFlags &mode=QScriptValue::ResolvePrototype) const
 
QScriptValue::PropertyFlags propertyFlags (const JSC::Identifier &id, const QScriptValue::ResolveFlags &mode=QScriptValue::ResolvePrototype) const
 
 QScriptValuePrivate (QScriptEnginePrivate *)
 
void setProperty (const JSC::UString &name, const JSC::JSValue &value, const QScriptValue::PropertyFlags &flags=QScriptValue::KeepExistingFlags)
 
void setProperty (const JSC::Identifier &id, const JSC::JSValue &value, const QScriptValue::PropertyFlags &flags=QScriptValue::KeepExistingFlags)
 
void setProperty (quint32 index, const JSC::JSValue &value, const QScriptValue::PropertyFlags &flags=QScriptValue::KeepExistingFlags)
 
 ~QScriptValuePrivate ()
 

Static Public Functions

static QScriptValuePrivateget (const QScriptValue &q)
 
static QScriptEnginePrivategetEngine (const QScriptValue &q)
 
static QScriptValue toPublic (QScriptValuePrivate *d)
 

Public Variables

QScriptEnginePrivateengine
 
JSC::JSValue jscValue
 
QScriptValuePrivatenext
 
qsreal numberValue
 
QScriptValuePrivateprev
 
QBasicAtomicInt ref
 
QString stringValue
 
Type type
 

Detailed Description

Definition at line 49 of file qscriptvalue_p.h.

Enumerations

◆ Type

Enumerator
JavaScriptCore 
Number 
String 

Definition at line 56 of file qscriptvalue_p.h.

Constructors and Destructors

◆ QScriptValuePrivate()

QScriptValuePrivate::QScriptValuePrivate ( QScriptEnginePrivate e)
inline

Definition at line 125 of file qscriptvalue_p.h.

126  : engine(e), prev(0), next(0)
127 {
128  ref = 0;
129 }
QScriptValuePrivate * next
QScriptValuePrivate * prev
QBasicAtomicInt ref
QScriptEnginePrivate * engine

◆ ~QScriptValuePrivate()

QScriptValuePrivate::~QScriptValuePrivate ( )
inline

Definition at line 681 of file qscriptengine_p.h.

682 {
683  if (engine)
685 }
QScriptEnginePrivate * engine
void unregisterScriptValue(QScriptValuePrivate *value)

Functions

◆ detachFromEngine()

void QScriptValuePrivate::detachFromEngine ( )

Definition at line 183 of file qscriptvalue.cpp.

Referenced by QScriptEnginePrivate::detachAllRegisteredScriptValues(), and getEngine().

184 {
185  if (isJSC())
186  jscValue = JSC::JSValue();
187  engine = 0;
188 }
JSC::JSValue jscValue
QScriptEnginePrivate * engine

◆ get()

static QScriptValuePrivate* QScriptValuePrivate::get ( const QScriptValue q)
inlinestatic

◆ getEngine()

static QScriptEnginePrivate* QScriptValuePrivate::getEngine ( const QScriptValue q)
inlinestatic

Definition at line 82 of file qscriptvalue_p.h.

Referenced by QScriptValue::call(), QScriptValue::construct(), QScriptValue::equals(), QScriptValue::instanceOf(), QScriptValue::lessThan(), QScriptValue::setProperty(), QScriptValue::setPrototype(), QScriptValue::setScope(), and QScriptValue::strictlyEquals().

83  {
84  if (!q.d_ptr)
85  return 0;
86  return q.d_ptr->engine;
87  }
QExplicitlySharedDataPointer< QScriptValuePrivate > d_ptr
Definition: qscriptvalue.h:209
QScriptEnginePrivate * engine

◆ initFrom() [1/3]

void QScriptValuePrivate::initFrom ( JSC::JSValue  value)
inline

Definition at line 687 of file qscriptengine_p.h.

Referenced by QScriptValue::QScriptValue(), QScriptEnginePrivate::scriptValueFromJSCValue(), and QScriptEnginePrivate::scriptValueToJSCValue().

688 {
689  if (value.isCell()) {
690  Q_ASSERT(engine != 0);
691  value = engine->toUsableValue(value);
692  }
694  jscValue = value;
695  if (engine)
697 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
JSC::JSValue toUsableValue(JSC::JSValue value)
If the given value is the original global object, returns the custom global object or a proxy to the ...
JSC::JSValue jscValue
void registerScriptValue(QScriptValuePrivate *value)
QScriptEnginePrivate * engine

◆ initFrom() [2/3]

void QScriptValuePrivate::initFrom ( qsreal  value)
inline

Definition at line 699 of file qscriptengine_p.h.

700 {
701  type = Number;
702  numberValue = value;
703  if (engine)
705 }
void registerScriptValue(QScriptValuePrivate *value)
QScriptEnginePrivate * engine

◆ initFrom() [3/3]

void QScriptValuePrivate::initFrom ( const QString value)
inline

Definition at line 707 of file qscriptengine_p.h.

708 {
709  type = String;
710  stringValue = value;
711  if (engine)
713 }
void registerScriptValue(QScriptValuePrivate *value)
QScriptEnginePrivate * engine

◆ isJSC()

bool QScriptValuePrivate::isJSC ( ) const
inline

◆ isObject()

bool QScriptValuePrivate::isObject ( ) const
inline

◆ objectId()

qint64 QScriptValuePrivate::objectId ( )
inline

Definition at line 104 of file qscriptvalue_p.h.

Referenced by QScriptValue::objectId().

105  {
106  if ( (type == JavaScriptCore) && (engine) && jscValue.isCell() )
107  return (qint64)jscValue.asCell();
108  else
109  return -1;
110  }
__int64 qint64
Definition: qglobal.h:942
JSC::JSValue jscValue
QScriptEnginePrivate * engine

◆ operator delete()

void QScriptValuePrivate::operator delete ( void *  ptr)
inline

Definition at line 801 of file qscriptengine_p.h.

802 {
803  QScriptValuePrivate *d = reinterpret_cast<QScriptValuePrivate*>(ptr);
804  if (d->engine)
806  else
807  qFree(d);
808 }
double d
Definition: qnumeric_p.h:62
Q_CORE_EXPORT void qFree(void *ptr)
Definition: qmalloc.cpp:58
void freeScriptValuePrivate(QScriptValuePrivate *p)
const T * ptr(const T &t)
QScriptEnginePrivate * engine

◆ operator new()

void * QScriptValuePrivate::operator new ( size_t  size,
QScriptEnginePrivate engine 
)
inline

Definition at line 794 of file qscriptengine_p.h.

795 {
796  if (engine)
797  return engine->allocateScriptValuePrivate(size);
798  return qMalloc(size);
799 }
Q_CORE_EXPORT void * qMalloc(size_t size)
Definition: qmalloc.cpp:53
QScriptValuePrivate * allocateScriptValuePrivate(size_t)

◆ property() [1/3]

JSC::JSValue QScriptValuePrivate::property ( const JSC::Identifier &  id,
const QScriptValue::ResolveFlags &  mode = QScriptValue::ResolvePrototype 
) const
inline

Definition at line 753 of file qscriptengine_p.h.

Referenced by getEngine().

754 {
755  return QScriptEnginePrivate::property(engine->currentFrame, jscValue, id, resolveMode);
756 }
JSC::ExecState * currentFrame
static JSC::JSValue property(JSC::ExecState *, JSC::JSValue, const JSC::Identifier &id, int resolveMode=QScriptValue::ResolvePrototype)
JSC::JSValue jscValue
QScriptEnginePrivate * engine

◆ property() [2/3]

JSC::JSValue QScriptValuePrivate::property ( quint32  index,
const QScriptValue::ResolveFlags &  mode = QScriptValue::ResolvePrototype 
) const
inline

Definition at line 758 of file qscriptengine_p.h.

759 {
761 }
JSC::ExecState * currentFrame
static JSC::JSValue property(JSC::ExecState *, JSC::JSValue, const JSC::Identifier &id, int resolveMode=QScriptValue::ResolvePrototype)
quint16 index
JSC::JSValue jscValue
QScriptEnginePrivate * engine

◆ property() [3/3]

JSC::JSValue QScriptValuePrivate::property ( const JSC::UString &  name,
const QScriptValue::ResolveFlags &  mode = QScriptValue::ResolvePrototype 
) const
inline

Definition at line 763 of file qscriptengine_p.h.

764 {
765  JSC::ExecState *exec = engine->currentFrame;
766  return QScriptEnginePrivate::property(exec, jscValue, JSC::Identifier(exec, name), resolveMode);
767 }
JSC::ExecState * currentFrame
const char * name
static JSC::JSValue property(JSC::ExecState *, JSC::JSValue, const JSC::Identifier &id, int resolveMode=QScriptValue::ResolvePrototype)
JSC::JSValue jscValue
QScriptEnginePrivate * engine

◆ propertyFlags()

QScriptValue::PropertyFlags QScriptValuePrivate::propertyFlags ( const JSC::Identifier &  id,
const QScriptValue::ResolveFlags &  mode = QScriptValue::ResolvePrototype 
) const
inline

Definition at line 769 of file qscriptengine_p.h.

Referenced by getEngine().

771 {
773 }
JSC::ExecState * currentFrame
JSC::JSValue jscValue
static QScriptValue::PropertyFlags propertyFlags(JSC::ExecState *, JSC::JSValue value, const JSC::Identifier &id, const QScriptValue::ResolveFlags &mode)
QScriptEnginePrivate * engine

◆ setProperty() [1/3]

void QScriptValuePrivate::setProperty ( const JSC::UString &  name,
const JSC::JSValue &  value,
const QScriptValue::PropertyFlags flags = QScriptValue::KeepExistingFlags 
)
inline

Definition at line 787 of file qscriptengine_p.h.

Referenced by getEngine().

789 {
790  JSC::ExecState *exec = engine->currentFrame;
791  QScriptEnginePrivate::setProperty(exec, jscValue, JSC::Identifier(exec, name), value, flags);
792 }
JSC::ExecState * currentFrame
const char * name
static void setProperty(JSC::ExecState *, JSC::JSValue object, const JSC::UString &name, JSC::JSValue, const QScriptValue::PropertyFlags &flags=QScriptValue::KeepExistingFlags)
JSC::JSValue jscValue
QScriptEnginePrivate * engine

◆ setProperty() [2/3]

void QScriptValuePrivate::setProperty ( const JSC::Identifier &  id,
const JSC::JSValue &  value,
const QScriptValue::PropertyFlags flags = QScriptValue::KeepExistingFlags 
)
inline

Definition at line 775 of file qscriptengine_p.h.

777 {
779 }
JSC::ExecState * currentFrame
static void setProperty(JSC::ExecState *, JSC::JSValue object, const JSC::UString &name, JSC::JSValue, const QScriptValue::PropertyFlags &flags=QScriptValue::KeepExistingFlags)
JSC::JSValue jscValue
QScriptEnginePrivate * engine

◆ setProperty() [3/3]

void QScriptValuePrivate::setProperty ( quint32  index,
const JSC::JSValue &  value,
const QScriptValue::PropertyFlags flags = QScriptValue::KeepExistingFlags 
)
inline

Definition at line 781 of file qscriptengine_p.h.

783 {
785 }
JSC::ExecState * currentFrame
static void setProperty(JSC::ExecState *, JSC::JSValue object, const JSC::UString &name, JSC::JSValue, const QScriptValue::PropertyFlags &flags=QScriptValue::KeepExistingFlags)
quint16 index
JSC::JSValue jscValue
QScriptEnginePrivate * engine

◆ toPublic()

static QScriptValue QScriptValuePrivate::toPublic ( QScriptValuePrivate d)
inlinestatic

Definition at line 77 of file qscriptvalue_p.h.

Referenced by QScriptEnginePrivate::scriptValueFromJSCValue().

78  {
79  return QScriptValue(d);
80  }
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57

Properties

◆ engine

QScriptEnginePrivate* QScriptValuePrivate::engine

◆ jscValue

JSC::JSValue QScriptValuePrivate::jscValue

◆ next

QScriptValuePrivate* QScriptValuePrivate::next

◆ numberValue

qsreal QScriptValuePrivate::numberValue

◆ prev

QScriptValuePrivate* QScriptValuePrivate::prev

◆ ref

QBasicAtomicInt QScriptValuePrivate::ref

Definition at line 122 of file qscriptvalue_p.h.

Referenced by QScriptValuePrivate().

◆ stringValue

QString QScriptValuePrivate::stringValue

◆ type

Type QScriptValuePrivate::type

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