SciDAVis
1.D4
|
A chunk of scripting code. Abstract. More...
#include <Script.h>
Public Slots | |
virtual bool | compile (bool for_eval=true) |
Compile the Code. Return true if the implementation doesn't support compilation. | |
virtual QVariant | eval () |
Evaluate the Code, returning QVariant() on an error / exception. | |
virtual bool | exec () |
Execute the Code, returning false on an error / exception. | |
virtual bool | setDouble (double, const char *) |
virtual bool | setInt (int, const char *) |
virtual bool | setQObject (const QObject *, const char *) |
Signals | |
void | codeChanged () |
This is emitted whenever the code to be executed by exec() and eval() is changed. | |
void | error (const QString &message, const QString &scriptName, int lineNumber) |
signal an error condition / exception | |
void | print (const QString &output) |
output generated by the code |
Public Member Functions | |
virtual void | addCode (const QString &code) |
Append to the code that will be executed when calling exec() or eval() | |
const QString | code () const |
Return the code that will be executed when calling exec() or eval() | |
const QObject * | context () const |
Return the context in which the code is to be executed. | |
bool | emitErrors () const |
Return whether errors / exceptions are to be emitted or silently ignored. | |
const QString | name () const |
Like QObject::name, but with unicode support. | |
Script (ScriptingEnv *env, const QString &code, QObject *context=0, const QString &name="<input>") | |
virtual void | setCode (const QString &code) |
Set the code that will be executed when calling exec() or eval() | |
virtual void | setContext (QObject *context) |
Set the context in which the code is to be executed. | |
void | setEmitErrors (bool yes) |
Set whether errors / exceptions are to be emitted or silently ignored. | |
void | setName (const QString &name) |
Like QObject::setName, but with unicode support. | |
~Script () |
Protected Types | |
enum | compileStatus { notCompiled, isCompiled, compileErr } |
Protected Member Functions | |
void | emit_error (const QString &message, int lineNumber) |
Protected Attributes | |
QString | Code |
enum Script::compileStatus | compiled |
QObject * | Context |
bool | EmitErrors |
ScriptingEnv * | Env |
QString | Name |
A chunk of scripting code. Abstract.
Script objects represent a chunk of code, possibly together with local variables. The code may be changed and executed multiple times during the lifetime of an object.
|
protected |
|
inline |
References context(), Context, EmitErrors, Env, and ScriptingEnv::incref().
|
inline |
References ScriptingEnv::decref(), and Env.
|
inlinevirtual |
Append to the code that will be executed when calling exec() or eval()
References Code, codeChanged(), compiled, and notCompiled.
|
inline |
|
signal |
|
virtualslot |
Compile the Code. Return true if the implementation doesn't support compilation.
Reimplemented in PythonScript, and MuParserScript.
References emit_error().
Referenced by Matrix::recalculate(), and Table::recalculate().
|
inline |
Return the context in which the code is to be executed.
References Context.
Referenced by Script(), and setContext().
|
inlineprotected |
References EmitErrors, error(), and Name.
Referenced by MuParserScript::compile(), PythonScript::compile(), compile(), MuParserScript::eval(), PythonScript::eval(), eval(), PythonScript::exec(), exec(), MuParserScript::setDouble(), and MuParserScript::translateLegacyFunctions().
|
inline |
Return whether errors / exceptions are to be emitted or silently ignored.
References EmitErrors.
|
signal |
signal an error condition / exception
Referenced by emit_error().
|
virtualslot |
Evaluate the Code, returning QVariant() on an error / exception.
Reimplemented in PythonScript, and MuParserScript.
References emit_error().
Referenced by NonLinearFit::calculateFitCurveData(), ScriptEdit::evaluate(), Fit::evaluate_d(), Fit::evaluate_df_helper(), Fit::evaluate_f(), FunctionCurve::loadData(), Matrix::recalculate(), Table::recalculate(), and Matrix::setText().
|
virtualslot |
Execute the Code, returning false on an error / exception.
Reimplemented in PythonScript, and MuParserScript.
References emit_error().
Referenced by ScriptEdit::execute(), and ScriptEdit::executeAll().
|
inline |
|
signal |
output generated by the code
Referenced by PythonScript::write().
|
inlinevirtual |
Set the code that will be executed when calling exec() or eval()
References code(), Code, codeChanged(), compiled, and notCompiled.
Referenced by ScriptEdit::evaluate(), ScriptEdit::execute(), and ScriptEdit::executeAll().
|
inlinevirtual |
Set the context in which the code is to be executed.
Reimplemented in PythonScript.
References compiled, context(), Context, and notCompiled.
Referenced by ScriptEdit::setContext().
|
inlinevirtualslot |
Reimplemented in PythonScript, and MuParserScript.
Referenced by NonLinearFit::calculateFitCurveData(), Fit::evaluate_d(), Fit::evaluate_df(), Fit::evaluate_df_helper(), Fit::evaluate_f(), FunctionCurve::loadData(), and Matrix::recalculate().
|
inline |
Set whether errors / exceptions are to be emitted or silently ignored.
References EmitErrors.
|
inlinevirtualslot |
Reimplemented in PythonScript, and MuParserScript.
Referenced by Matrix::recalculate(), Table::recalculate(), and Matrix::setText().
|
inline |
Like QObject::setName, but with unicode support.
References compiled, name(), Name, and notCompiled.
Referenced by ScriptEdit::evaluate(), ScriptEdit::execute(), and ScriptEdit::executeAll().
|
inlinevirtualslot |
|
protected |
Referenced by addCode(), code(), MuParserScript::compile(), PythonScript::compile(), and setCode().
|
protected |
Referenced by addCode(), MuParserScript::compile(), PythonScript::compile(), MuParserScript::eval(), PythonScript::eval(), PythonScript::exec(), setCode(), setContext(), PythonScript::setDouble(), PythonScript::setInt(), setName(), PythonScript::setQObject(), and MuParserScript::translateLegacyFunctions().
|
protected |
Referenced by MuParserScript::compile(), PythonScript::compile(), context(), MuParserScript::matrixCellFunction(), MuParserScript::MuParserScript(), PythonScript::PythonScript(), MuParserScript::resolveColumnPath(), Script(), PythonScript::setContext(), setContext(), MuParserScript::tableCell_Function(), MuParserScript::tableColumn__Function(), MuParserScript::tableColumn_Function(), and MuParserScript::translateLegacyFunctions().
|
protected |
Referenced by emit_error(), emitErrors(), Script(), and setEmitErrors().
|
protected |
Referenced by PythonScript::env(), Script(), and ~Script().
|
protected |
Referenced by PythonScript::compile(), emit_error(), name(), and setName().