ScriptingEnv Class Reference

An interpreter for evaluating scripting code. Abstract. More...

`#include <ScriptingEnv.h>`

Inheritance diagram for ScriptingEnv:

## Public Slots

virtual void | clear ()
| Clear the global environment. What exactly happens depends on the implementation. More...
void | decref ()
| Decrease the reference count. This should only be called by scripted and Script to avoid segfaults. More...
void | incref ()
| Increase the reference count. This should only be called by scripted and Script to avoid memory leaks. More...
virtual bool | setDouble (double, const char *)
virtual bool | setInt (int, const char *)
virtual bool | setQObject (QObject *, const char *)
virtual void | startExecution ()
| If the implementation supports asynchronuos execution, activate it. More...
virtual void | stopExecution ()
| If the implementation supports asynchronuos execution, deactivate it. More...

## Signals

void | error (const QString &message, const QString &scriptName, int lineNumber)
| signal an error condition / exception More...
void | print (const QString &output)
| output that is not handled by a Script More...

## Public Member Functions

ApplicationWindow * | application ()
virtual const QStringList | fileExtensions () const
| Return a list of file extensions commonly used for this language. More...
const QString | fileFilter () const
| Construct a filter expression from fileExtension(), suitable for QFileDialog. More...
virtual bool | initialize ()
| Part of the initialization is deferred from the constructor until after the signals have been connected. More...
bool | initialized () const
| initialization of the interpreter may fail; or there could be other errors setting up the environment More...
virtual bool | isRunning () const
| whether asynchronuous execution is enabled (if supported by the implementation) More...
virtual const QString | mathFunctionDoc (const QString &) const
| Return a documentation string for the given mathematical function. More...
virtual const QStringList | mathFunctions () const
| Return a list of supported mathematical functions. These should be imported into the global namespace. More...
virtual Script * | newScript (const QString &, QObject *, const QString &)
| Instantiate the Script subclass matching the ScriptEnv subclass. More...
| ScriptingEnv (ApplicationWindow *parent, const char *langName)
virtual QString | stackTraceString ()
| If an exception / error occured, return a nicely formated stack backtrace. More...

## Protected Attributes

bool | d_initialized
| whether the interpreter has been successfully initialized More...
ApplicationWindow * | d_parent
| the context in which we are running More...

## Private Attributes

int | d_refcount
| the reference counter More...

## Detailed Description

An interpreter for evaluating scripting code. Abstract.

ScriptingEnv objects represent a running interpreter, possibly with global variables, and are responsible for generating Script objects (which do the actual evaluation of code).

## Constructor & Destructor Documentation

ScriptingEnv::ScriptingEnv | ( | ApplicationWindow * | parent,
|  | const char * | langName
| ) |  |

References d_initialized, and d_refcount.

## Member Function Documentation

ApplicationWindow* ScriptingEnv::application | ( |  | ) |

inline

References d_parent.

Referenced by ScriptEdit::exportASCII(), ScriptEdit::insertCompletion(), ScriptEdit::insertErrorMsg(), PythonSyntaxHighlighter::PythonSyntaxHighlighter(), SyntaxHighlighter::SyntaxHighlighter(), and muParserScript::tablecol().

virtual void ScriptingEnv::clear | ( |  | ) |

inline virtual slot

Clear the global environment. What exactly happens depends on the implementation.

void ScriptingEnv::decref | ( |  | ) |

slot

Decrease the reference count. This should only be called by scripted and Script to avoid segfaults.

References d_refcount.

Referenced by scripted::scriptingChangeEvent(), Script::~Script(), and scripted::~scripted().

void ScriptingEnv::error | ( | const QString & | message,
|  | const QString & | scriptName,
|  | int | lineNumber
| ) |  |

signal

signal an error condition / exception

virtual const QStringList ScriptingEnv::fileExtensions | ( |  | ) | const

inline virtual

Return a list of file extensions commonly used for this language.

Reimplemented in PythonScripting.

Referenced by fileFilter().

const QString ScriptingEnv::fileFilter | ( |  | ) | const

Construct a filter expression from fileExtension(), suitable for QFileDialog.

References fileExtensions().

Referenced by ScriptEdit::exportASCII(), and ScriptEdit::importASCII().

void ScriptingEnv::incref | ( |  | ) |

slot

Increase the reference count. This should only be called by scripted and Script to avoid memory leaks.

References d_refcount.

Referenced by Script::Script(), scripted::scripted(), and scripted::scriptingChangeEvent().

virtual bool ScriptingEnv::initialize | ( |  | ) |

inline virtual

Part of the initialization is deferred from the constructor until after the signals have been connected.

Reimplemented in PythonScripting.

Referenced by ApplicationWindow::init(), and ApplicationWindow::setScriptingLanguage().

bool ScriptingEnv::initialized | ( |  | ) | const

inline

initialization of the interpreter may fail; or there could be other errors setting up the environment

References d_initialized.

Referenced by PythonScripting::initialize().

virtual bool ScriptingEnv::isRunning | ( |  | ) | const

inline virtual

whether asynchronuous execution is enabled (if supported by the implementation)

Reimplemented in PythonScripting, and muParserScripting.

virtual const QString ScriptingEnv::mathFunctionDoc | ( | const QString & |  | ) | const

inline virtual

Return a documentation string for the given mathematical function.

Reimplemented in PythonScripting, and muParserScripting.

Referenced by ScriptEdit::contextMenuEvent(), MatrixValuesDialog::insertExplain(), and SetColValuesDialog::insertExplain().

virtual const QStringList ScriptingEnv::mathFunctions | ( |  | ) | const

inline virtual

Return a list of supported mathematical functions. These should be imported into the global namespace.

Reimplemented in PythonScripting, and muParserScripting.

Referenced by ScriptEdit::contextMenuEvent(), ApplicationWindow::initCompleter(), ScriptEdit::insertFunction(), and MatrixValuesDialog::MatrixValuesDialog().

virtual Script* ScriptingEnv::newScript | ( | const QString & | ,
|  | QObject * | ,
|  | const QString & |
| ) |  |

inline virtual

Instantiate the Script subclass matching the ScriptEnv subclass.

Reimplemented in PythonScripting, and muParserScripting.

Referenced by MatrixModel::calculate(), Table::calculate(), Matrix::canCalculate(), Table::cellEdited(), ScriptEdit::customEvent(), and ScriptEdit::ScriptEdit().

void ScriptingEnv::print | ( | const QString & | output | ) |

signal

output that is not handled by a Script

Referenced by PythonScripting::write().

virtual bool ScriptingEnv::setDouble | ( | double | ,
|  | const char * |
| ) |  |

inline virtual slot

Reimplemented in muParserScripting.

virtual bool ScriptingEnv::setInt | ( | int | ,
|  | const char * |
| ) |  |

inline virtual slot

Reimplemented in muParserScripting.

virtual bool ScriptingEnv::setQObject | ( | QObject * | ,
|  | const char * |
| ) |  |

inline virtual slot

Reimplemented in PythonScripting, and muParserScripting.

virtual QString ScriptingEnv::stackTraceString | ( |  | ) |

inline virtual

If an exception / error occured, return a nicely formated stack backtrace.

virtual void ScriptingEnv::startExecution | ( |  | ) |

inline virtual slot

If the implementation supports asynchronuos execution, activate it.

virtual void ScriptingEnv::stopExecution | ( |  | ) |

inline virtual slot

If the implementation supports asynchronuos execution, deactivate it.

## Member Data Documentation

bool ScriptingEnv::d_initialized

protected

whether the interpreter has been successfully initialized

Referenced by PythonScripting::initialize(), initialized(), muParserScripting::muParserScripting(), PythonScripting::PythonScripting(), and ScriptingEnv().

ApplicationWindow* ScriptingEnv::d_parent

protected

the context in which we are running

Referenced by application(), PythonScripting::initialize(), and PythonScripting::PythonScripting().

int ScriptingEnv::d_refcount

private

the reference counter

Referenced by decref(), incref(), and ScriptingEnv().

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

- qtiplot/src/scripting/ScriptingEnv.h
- qtiplot/src/scripting/ScriptingEnv.cpp