QScriptEngine Class Reference

#include <qscriptengine.h>

Class Description

Definition at line 104 of file qscriptengine.h.

+ Inheritance diagram for QScriptEngine:

Public Types

enum  ValueOwnership { QtOwnership, ScriptOwnership, AutoOwnership }
 
enum  QObjectWrapOption {
  ExcludeChildObjects = 0x0001, ExcludeSuperClassMethods = 0x0002, ExcludeSuperClassProperties = 0x0004, ExcludeSuperClassContents = 0x0006,
  SkipMethodsInEnumeration = 0x0008, ExcludeDeleteLater = 0x0010, ExcludeSlots = 0x0020, AutoCreateDynamicProperties = 0x0100,
  PreferExistingWrapperObject = 0x0200
}
 
typedef QScriptValue(* FunctionSignature) (QScriptContext *, QScriptEngine *)
 
typedef QScriptValue(* FunctionWithArgSignature) (QScriptContext *, QScriptEngine *, void *)
 
typedef QScriptValue(* MarshalFunction) (QScriptEngine *, const void *)
 
typedef void(* DemarshalFunction) (const QScriptValue &, void *)
 

Signals

void signalHandlerException (const QScriptValue &exception)
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 

Public Member Functions

 QScriptEngine ()
 
 QScriptEngine (QObject *parent)
 
virtual ~QScriptEngine ()
 
QScriptValue globalObject () const
 
void setGlobalObject (const QScriptValue &object)
 
QScriptContextcurrentContext () const
 
QScriptContextpushContext ()
 
void popContext ()
 
bool canEvaluate (const QString &program) const
 
QScriptValue evaluate (const QString &program, const QString &fileName=QString(), int lineNumber=1)
 
QScriptValue evaluate (const QScriptProgram &program)
 
bool isEvaluating () const
 
void abortEvaluation (const QScriptValue &result=QScriptValue())
 
bool hasUncaughtException () const
 
QScriptValue uncaughtException () const
 
int uncaughtExceptionLineNumber () const
 
QStringList uncaughtExceptionBacktrace () const
 
void clearExceptions ()
 
QScriptValue nullValue ()
 
QScriptValue undefinedValue ()
 
QScriptValue newFunction (FunctionSignature signature, int length=0)
 
QScriptValue newFunction (FunctionSignature signature, const QScriptValue &prototype, int length=0)
 
QScriptValue newFunction (FunctionWithArgSignature signature, void *arg)
 
QScriptValue newVariant (const QVariant &value)
 
QScriptValue newVariant (const QScriptValue &object, const QVariant &value)
 
QScriptValue newRegExp (const QRegExp &regexp)
 
QScriptValue newObject ()
 
QScriptValue newObject (QScriptClass *scriptClass, const QScriptValue &data=QScriptValue())
 
QScriptValue newArray (uint length=0)
 
QScriptValue newRegExp (const QString &pattern, const QString &flags)
 
QScriptValue newDate (qsreal value)
 
QScriptValue newDate (const QDateTime &value)
 
QScriptValue newActivationObject ()
 
QScriptValue newQObject (QObject *object, ValueOwnership ownership=QtOwnership, const QObjectWrapOptions &options=0)
 
QScriptValue newQObject (const QScriptValue &scriptObject, QObject *qtObject, ValueOwnership ownership=QtOwnership, const QObjectWrapOptions &options=0)
 
QScriptValue newQMetaObject (const QMetaObject *metaObject, const QScriptValue &ctor=QScriptValue())
 
template<class T >
QScriptValue scriptValueFromQMetaObject ()
 
QScriptValue defaultPrototype (int metaTypeId) const
 
void setDefaultPrototype (int metaTypeId, const QScriptValue &prototype)
 
template<typename T >
QScriptValue toScriptValue (const T &value)
 
template<typename T >
fromScriptValue (const QScriptValue &value)
 
void installTranslatorFunctions (const QScriptValue &object=QScriptValue())
 
QScriptValue importExtension (const QString &extension)
 
QStringList availableExtensions () const
 
QStringList importedExtensions () const
 
void collectGarbage ()
 
void reportAdditionalMemoryCost (int size)
 
void setProcessEventsInterval (int interval)
 
int processEventsInterval () const
 
void setAgent (QScriptEngineAgent *agent)
 
QScriptEngineAgentagent () const
 
QScriptString toStringHandle (const QString &str)
 
QScriptValue toObject (const QScriptValue &value)
 
QScriptValue objectById (qint64 id) const
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=0)
 
virtual ~QObject ()
 
virtual bool event (QEvent *)
 
virtual bool eventFilter (QObject *, QEvent *)
 
QString objectName () const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const
 
bool signalsBlocked () const
 
bool blockSignals (bool b)
 
QThreadthread () const
 
void moveToThread (QThread *thread)
 
int startTimer (int interval)
 
void killTimer (int id)
 
template<typename T >
findChild (const QString &aName=QString()) const
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
const QObjectListchildren () const
 
void setParent (QObject *)
 
void installEventFilter (QObject *)
 
void removeEventFilter (QObject *)
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const
 
QList< QByteArraydynamicPropertyNames () const
 
void setUserData (uint id, QObjectUserData *data)
 
QObjectUserDatauserData (uint id) const
 
QObjectparent () const
 
bool inherits (const char *classname) const
 

Static Public Member Functions

static QScriptSyntaxCheckResult checkSyntax (const QString &program)
 
- Static Public Member Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 

Protected Member Functions

 QScriptEngine (QScriptEnginePrivate &dd, QObject *parent=0)
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 
virtual void timerEvent (QTimerEvent *)
 
virtual void childEvent (QChildEvent *)
 
virtual void customEvent (QEvent *)
 
virtual void connectNotify (const char *signal)
 
virtual void disconnectNotify (const char *signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 

Friends

void qScriptRegisterMetaType_helper (QScriptEngine *, int, MarshalFunction, DemarshalFunction, const QScriptValue &)
 
QScriptValue qScriptValueFromValue_helper (QScriptEngine *, int, const void *)
 
bool qscriptvalue_cast_helper (const QScriptValue &, int, void *)
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Static Protected Attributes inherited from QObject
static const QMetaObject staticQtMetaObject
 
- Properties inherited from QObject
QString objectName
 

Member Typedef Documentation

typedef QScriptValue(* FunctionSignature) (QScriptContext *, QScriptEngine *)

Definition at line 165 of file qscriptengine.h.

typedef QScriptValue(* FunctionWithArgSignature) (QScriptContext *, QScriptEngine *, void *)

Definition at line 166 of file qscriptengine.h.

typedef QScriptValue(* MarshalFunction) (QScriptEngine *, const void *)

Definition at line 207 of file qscriptengine.h.

typedef void(* DemarshalFunction) (const QScriptValue &, void *)

Definition at line 208 of file qscriptengine.h.

Member Enumeration Documentation

Enumerator
QtOwnership 
ScriptOwnership 
AutoOwnership 

Definition at line 113 of file qscriptengine.h.

Enumerator
ExcludeChildObjects 
ExcludeSuperClassMethods 
ExcludeSuperClassProperties 
ExcludeSuperClassContents 
SkipMethodsInEnumeration 
ExcludeDeleteLater 
ExcludeSlots 
AutoCreateDynamicProperties 
PreferExistingWrapperObject 

Definition at line 119 of file qscriptengine.h.

Constructor & Destructor Documentation

QScriptEngine ( QObject parent)
explicit
virtual ~QScriptEngine ( )
virtual
QScriptEngine ( QScriptEnginePrivate &  dd,
QObject parent = 0 
)
protected

Member Function Documentation

QScriptValue globalObject ( ) const
void setGlobalObject ( const QScriptValue object)
QScriptContext* currentContext ( ) const
QScriptContext* pushContext ( )
void popContext ( )
bool canEvaluate ( const QString program) const
static QScriptSyntaxCheckResult checkSyntax ( const QString program)
static
QScriptValue evaluate ( const QString program,
const QString fileName = QString(),
int  lineNumber = 1 
)
QScriptValue evaluate ( const QScriptProgram program)
bool isEvaluating ( ) const
void abortEvaluation ( const QScriptValue result = QScriptValue())
bool hasUncaughtException ( ) const
QScriptValue uncaughtException ( ) const
int uncaughtExceptionLineNumber ( ) const
QStringList uncaughtExceptionBacktrace ( ) const
void clearExceptions ( )
QScriptValue nullValue ( )
QScriptValue undefinedValue ( )
QScriptValue newFunction ( FunctionSignature  signature,
int  length = 0 
)
QScriptValue newFunction ( FunctionSignature  signature,
const QScriptValue prototype,
int  length = 0 
)
QScriptValue newFunction ( FunctionWithArgSignature  signature,
void arg 
)
QScriptValue newVariant ( const QVariant value)
QScriptValue newVariant ( const QScriptValue object,
const QVariant value 
)
QScriptValue newRegExp ( const QRegExp regexp)
QScriptValue newObject ( )
QScriptValue newObject ( QScriptClass scriptClass,
const QScriptValue data = QScriptValue() 
)
QScriptValue newArray ( uint  length = 0)
QScriptValue newRegExp ( const QString pattern,
const QString flags 
)
QScriptValue newDate ( qsreal  value)
QScriptValue newDate ( const QDateTime value)
QScriptValue newActivationObject ( )
QScriptValue newQObject ( QObject object,
ValueOwnership  ownership = QtOwnership,
const QObjectWrapOptions &  options = 0 
)
QScriptValue newQObject ( const QScriptValue scriptObject,
QObject qtObject,
ValueOwnership  ownership = QtOwnership,
const QObjectWrapOptions &  options = 0 
)
QScriptValue newQMetaObject ( const QMetaObject metaObject,
const QScriptValue ctor = QScriptValue() 
)
QScriptValue scriptValueFromQMetaObject ( )

Definition at line 295 of file qscriptengine.h.

296 {
297  typedef QScriptValue(*ConstructPtr)(QScriptContext *, QScriptEngine *, T *);
298  ConstructPtr cptr = qscriptQMetaObjectConstructor<T>;
299  return newQMetaObject(&T::staticMetaObject,
300  newFunction(reinterpret_cast<FunctionWithArgSignature>(cptr), 0));
301 }
QScriptValue newFunction(FunctionSignature signature, int length=0)
QScriptValue newQMetaObject(const QMetaObject *metaObject, const QScriptValue &ctor=QScriptValue())
QScriptValue defaultPrototype ( int  metaTypeId) const
void setDefaultPrototype ( int  metaTypeId,
const QScriptValue prototype 
)
QScriptValue toScriptValue ( const T &  value)
inline

Definition at line 213 of file qscriptengine.h.

214  {
215  return qScriptValueFromValue(this, value);
216  }
QScriptValue qScriptValueFromValue(QScriptEngine *, const T &)
GLsizei const GLfloat * value
Definition: GLee.h:1742
T fromScriptValue ( const QScriptValue value)
inline

Definition at line 218 of file qscriptengine.h.

219  {
220  return qscriptvalue_cast<T>(value);
221  }
T qscriptvalue_cast(const QScriptValue &)
GLsizei const GLfloat * value
Definition: GLee.h:1742
void installTranslatorFunctions ( const QScriptValue object = QScriptValue())
QScriptValue importExtension ( const QString extension)
QStringList availableExtensions ( ) const
QStringList importedExtensions ( ) const
void collectGarbage ( )
void reportAdditionalMemoryCost ( int  size)
void setProcessEventsInterval ( int  interval)
int processEventsInterval ( ) const
void setAgent ( QScriptEngineAgent agent)
QScriptEngineAgent* agent ( ) const
QScriptString toStringHandle ( const QString str)
QScriptValue toObject ( const QScriptValue value)
QScriptValue objectById ( qint64  id) const
void signalHandlerException ( const QScriptValue exception)
signal

Friends And Related Function Documentation

void qScriptRegisterMetaType_helper ( QScriptEngine eng,
int  type,
QScriptEngine::MarshalFunction  mf,
QScriptEngine::DemarshalFunction  df,
const QScriptValue prototype 
)
friend

Definition at line 371 of file qscriptengine.h.

375 {
376  eng->registerCustomType(type, mf, df, prototype);
377 }
GLuint GLuint GLsizei GLenum type
Definition: GLee.h:872
QScriptValue qScriptValueFromValue_helper ( QScriptEngine engine,
int  type,
const void ptr 
)
friend

Definition at line 318 of file qscriptengine.h.

319 {
320  if (!engine)
321  return QScriptValue();
322 
323  return engine->create(type, ptr);
324 }
GLuint GLuint GLsizei GLenum type
Definition: GLee.h:872
bool qscriptvalue_cast_helper ( const QScriptValue value,
int  type,
void ptr 
)
friend

Definition at line 338 of file qscriptengine.h.

339 {
340  return QScriptEngine::convertV2(value, type, ptr);
341 }
GLuint GLuint GLsizei GLenum type
Definition: GLee.h:872

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