KJS-API
KJSInterpreter Class Reference
A class representing a JavaScript interpreter. More...
#include <kjsinterpreter.h>
Public Member Functions | |
KJSResult | evaluate (const QString &code, KJSObject *thisValue=0) |
KJSResult | evaluate (const QString &sourceURL, int startingLineNumber, const QString &code, KJSObject *thisValue=0) |
const KJSContext * | globalContext () const |
KJSContext * | globalContext () |
KJSObject | globalObject () |
KJSInterpreter (const KJSInterpreter &other) | |
KJSInterpreter (const KJSGlobalObject &global) | |
KJSInterpreter () | |
KJSInterpreter & | operator= (const KJSInterpreter &other) |
~KJSInterpreter () | |
Static Public Member Functions | |
static bool | normalizeCode (const QString &codeIn, QString *codeOut, int *errLine=0, QString *errMsg=0) |
Detailed Description
A class representing a JavaScript interpreter.JavaScript interpreter
Definition at line 82 of file kjsinterpreter.h.
Constructor & Destructor Documentation
KJSInterpreter::KJSInterpreter | ( | ) |
Constructs an interpreter with a default global object.
Definition at line 88 of file kjsinterpreter.cpp.
KJSInterpreter::KJSInterpreter | ( | const KJSGlobalObject & | global | ) |
Constructs an interpreter with a custom global object.
Definition at line 96 of file kjsinterpreter.cpp.
KJSInterpreter::KJSInterpreter | ( | const KJSInterpreter & | other | ) |
KJSInterpreter::~KJSInterpreter | ( | ) |
Destructs this interpreter and frees resources it has allocated.
This renders any still existing objects referencing those invalid.
Definition at line 141 of file kjsinterpreter.cpp.
Member Function Documentation
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 197 of file kjsinterpreter.cpp.
KJSResult KJSInterpreter::evaluate | ( | const QString & | sourceURL, | |
int | startingLineNumber, | |||
const QString & | code, | |||
KJSObject * | thisValue = 0 | |||
) |
Evaluates a piece of code with a "this" set to (optionally set) value.
The sourceURL and startingLineNumber parameters are used to provide information about the origin of a parse error or runtime exception.
Definition at line 163 of file kjsinterpreter.cpp.
const KJSContext* KJSInterpreter::globalContext | ( | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
KJSContext * KJSInterpreter::globalContext | ( | ) |
Returns a handle to the global execution context.
Definition at line 148 of file kjsinterpreter.cpp.
KJSObject KJSInterpreter::globalObject | ( | ) |
Returns the object that is used as the global object during all script execution performed by this interpreter,.
Definition at line 156 of file kjsinterpreter.cpp.
bool KJSInterpreter::normalizeCode | ( | const QString & | codeIn, | |
QString * | codeOut, | |||
int * | errLine = 0 , |
|||
QString * | errMsg = 0 | |||
) | [static] |
Reformat the given script code to an easy to read format with only one statement per line.
This can be useful when debugging a script that was e.g. condensed into a single line to a single line. While comments will be removed the script will remain unchanged semantically.
- Parameters:
-
codeIn The code to be reformatted codeOut Points to string holding the result. errLine Will hold the line of a parse error errMsg Will hold the message of a parse error
- Returns:
- Returns true if the reformatting was successful, false on a parse error.
Definition at line 203 of file kjsinterpreter.cpp.
KJSInterpreter & KJSInterpreter::operator= | ( | const KJSInterpreter & | other | ) |
Assign another interpreter instance to this object.
Definition at line 121 of file kjsinterpreter.cpp.
The documentation for this class was generated from the following files: