ECMAScript interpreter.
Más...
#include <qsengine.h>
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< uint > | errorLines () const |
QStringList | errorMessages () const |
bool | checkSyntax (const QString &code, int checkMode=DisallowGlobal, bool deleteNodes=TRUE) |
void | enableDebug () |
QSEnv * | env () const |
void | registerType (QSClass *c) |
void | warn (const QString &msg, int l) |
void | requestPackage (const QString &package, QString &err) |
void | setTimeoutTriggerEnabled (bool enable) |
QSTimeoutTrigger * | timeoutTrigger () const |
QSEngineImp * | imp () const |
Amigas |
class | QSEngineImp |
class | QSObject |
class | Global |
Descripción detallada
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] |
Documentación de las funciones miembro
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::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 |
- Devuelve:
- Return line of last error. -1 if last call didn't have an error.
- 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.
Same as above. Only differing in the arguments accepted.
- Parámetros:
-
code | is a pointer to an Unicode string containing the code to be executed. |
length | number of characters. |
Added for convenience in case you have the code in available in internal representation already.
- Parámetros:
-
code | is 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:
-
code | is a string containing the code to be executed. |
- Devuelve:
- True if the code was evaluated successfully, false if an error occured.
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] |
void QSEngine::warn |
( |
const QString & |
msg, |
|
|
int |
l |
|
) |
| |
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
La documentación para esta clase fue generada a partir de los siguientes ficheros: