Eneboo - Documentación para desarrolladores
Tipos públicos | Señales | Métodos públicos | Amigas
Referencia de la Clase QSEngine

ECMAScript interpreter. Más...

#include <qsengine.h>

Diagrama de herencias de QSEngine
QObject Qt Qt QuickInterpreter

Lista de todos los miembros.

Tipos públicos

enum  CheckMode { CheckNormal = 0, DisallowGlobal }

Señales

void warning (const QString &msg, int l)
void packageRequest (const QString &package, QString &err)

Métodos públicos

 QSEngine (QObject *parent=0, const char *name=0)
virtual ~QSEngine ()
void init ()
int recursion () const
bool evaluate (const char *code)
bool evaluate (const QSObject &thisV, const QString &code, int linezero=0)
bool evaluate (const QString &code)
bool call (const QString &func, const QSList &args)
bool call (QSObject *scope, const QString &func, const QSList &args)
void clear ()
QSObject returnValue () const
void setReturnValue (const QSObject &v)
int errorType () const
QValueList< uinterrorLines () const
QStringList errorMessages () const
bool checkSyntax (const QString &code, int checkMode=DisallowGlobal, bool deleteNodes=TRUE)
void enableDebug ()
QSEnvenv () const
void registerType (QSClass *c)
void warn (const QString &msg, int l)
void requestPackage (const QString &package, QString &err)
void setTimeoutTriggerEnabled (bool enable)
QSTimeoutTriggertimeoutTrigger () const
QSEngineImpimp () const

Amigas

class QSEngineImp
class QSObject
class Global

Descripción detallada

ECMAScript interpreter.


Documentación de las enumeraciones miembro de la clase

Valores de enumeraciones:
CheckNormal 
DisallowGlobal 

Documentación del constructor y destructor

QSEngine::QSEngine ( QObject parent = 0,
const char *  name = 0 
)

Create a new ECMAScript interpreter. You can later ask it to interprete code by passing it via evaluate.

QSEngine::~QSEngine ( ) [virtual]

Destructor


Documentación de las funciones miembro

bool QSEngine::call ( const QString func,
const QSList args 
)

Call the specified function directly, optionally passing args as a list of arguments. Return value and treatment of errors is analog to the evaluate() calls.

bool QSEngine::call ( QSObject scope,
const QString func,
const QSList args 
)
bool QSEngine::checkSyntax ( const QString code,
int  checkMode = DisallowGlobal,
bool  deleteNodes = TRUE 
)

Check the syntax of a piece of code. Return true if the code could be parsed without errors, false otherwise. errorLine() will tell you approximately where the syntax error happened.

void QSEngine::clear ( void  )

Clear the interpreter's memory. Otherwise, function declarations and global variables will be remembered after each invokation of QSEngine::evaluate.

Reimplementado en QuickInterpreter.

void QSEngine::enableDebug ( )

Adds a debug() function to the set of pre-defined properties. debug(arg) tries to convert 'arg' to a string and prints the result to stderr. If you want to debug self defined Host Objects this way you should provide them with a toString() method that returns a string.

QSEnv * QSEngine::env ( ) const
QValueList< uint > QSEngine::errorLines ( ) const
Devuelve:
Return line of last error. -1 if last call didn't have an error.
QStringList QSEngine::errorMessages ( ) const
Devuelve:
Error message from last call to evaluate(). Empty string if no error occured.
int QSEngine::errorType ( ) const
Devuelve:
Return code from last call to evaluate(). 0 on success.
bool QSEngine::evaluate ( const QSObject thisV,
const QString code,
int  linezero = 0 
)

Same as above. Only differing in the arguments accepted.

Parámetros:
codeis a pointer to an Unicode string containing the code to be executed.
lengthnumber of characters.
bool QSEngine::evaluate ( const QString code)

Added for convenience in case you have the code in available in internal representation already.

Parámetros:
codeis an Unicode string containing the code to be executed.
bool QSEngine::evaluate ( const char *  code)

Asks the interpreter to evaluate a piece of code. If called more than once the state (global variables, functions etc.) will be preserved between each call.

Parámetros:
codeis a string containing the code to be executed.
Devuelve:
True if the code was evaluated successfully, false if an error occured.
QSEngineImp* QSEngine::imp ( ) const [inline]
void QSEngine::init ( )

Force a "context switch". You usually do not need to do that, evaluate() does it too.

void QSEngine::packageRequest ( const QString package,
QString err 
) [signal]

Emitted whenever the interpreter encountered an 'import' statement asking for a package. Upon receiptong feed the requested source to the interpreter. If you want to return an error set err to a non-null string.

int QSEngine::recursion ( ) const

Current level of recursive calls to this interpreter. 0 initially.

void QSEngine::registerType ( QSClass c)

Register the type described by c with the engine. Ownership of the type object is passed on. The interpreter will delete all registered types on destruction or a call to clear().

Ver también:
type()
void QSEngine::requestPackage ( const QString package,
QString err 
)
QSObject QSEngine::returnValue ( ) const
Devuelve:
Return value from the last call to evaluate(). Null if there hasn't been any.
void QSEngine::setReturnValue ( const QSObject v)
void QSEngine::setTimeoutTriggerEnabled ( bool  enable) [inline]
QSTimeoutTrigger* QSEngine::timeoutTrigger ( ) const [inline]
void QSEngine::warn ( const QString msg,
int  l 
)

Reimplementado en QuickInterpreter.

void QSEngine::warning ( const QString msg,
int  l 
) [signal]

This signal is emitted on each non-fatal error msg at line l.

Reimplementado en QuickInterpreter.


Documentación de las funciones relacionadas y clases amigas

friend class Global [friend]
friend class QSEngineImp [friend]
friend class QSObject [friend]

La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'