muParserScript Class Reference

TODO. More...

`#include <muParserScript.h>`

Inheritance diagram for muParserScript:

## Public Slots

int | codeLines ()
bool | compile (bool asFunction=true)
double * | defineVariable (const char *name, double val=0.0)
QVariant | eval ()
double | evalSingleLine ()
QString | evalSingleLineToString (const QLocale &locale, char f, int prec)
bool | exec ()
bool | setDouble (double val, const char *name)
bool | setInt (int val, const char *name)
bool | setQObject (QObject *val, const char *name)
Public Slots inherited from Script
virtual bool | compile (bool for_eval=true)
| Compile the Code. Return true if the implementation doesn't support compilation. More...
virtual QVariant | eval ()
| Evaluate the Code, returning QVariant() on an error / exception. More...
virtual bool | exec ()
| Execute the Code, returning false on an error / exception. More...
virtual bool | setDouble (double, const char *)
virtual bool | setInt (int, const char *)
virtual bool | setQObject (const QObject *, const char *)

## Public Member Functions

| muParserScript (ScriptingEnv *env, const QString &code, QObject *context=0, const QString &name="<input>")
Public Member Functions inherited from Script
virtual void | addCode (const QString &code)
| Append to the code that will be executed when calling exec() or eval() More...
const QString | code () const
| Return the code that will be executed when calling exec() or eval() More...
QObject * | context () const
| Return the context in which the code is to be executed. More...
bool | emitErrors () const
| Return whether errors / exceptions are to be emitted or silently ignored. More...
const QString | name () const
| Like QObject::name, but with unicode support. More...
| Script (ScriptingEnv *env, const QString &code, QObject *context=0, const QString &name="<input>")
ScriptingEnv * | scriptingEnv ()
virtual void | setCode (const QString &code)
| Set the code that will be executed when calling exec() or eval() More...
virtual void | setContext (QObject *context)
| Set the context in which the code is to be executed. More...
void | setEmitErrors (bool yes)
| Set whether errors / exceptions are to be emitted or silently ignored. More...
void | setName (const QString &name)
| Like QObject::setName, but with unicode support. More...
| ~Script ()

## Static Public Attributes

static muParserScript * | current = NULL

## Private Member Functions

double * | addVariable (const char *name)
double * | addVariableR (const char *name)
double | avg (const QString &arg, int start=0, int end=-1)
double | cell (int row, int col)
double | col (const QString &arg)
double | max (const QString &arg, int start=0, int end=-1)
double | min (const QString &arg, int start=0, int end=-1)
double | sum (const QString &arg, int start=0, int end=-1)
double | tableCell (int col, int row)
double | tablecol (const QString &arg)

## Static Private Member Functions

static QString | compileColArg (const QString &in)
static double * | mu_addVariable (const char *name, void *)
static double * | mu_addVariableR (const char *name)
static double * | mu_addVariableR (const char *name, void *)
static double | mu_avg (const char *arg, double start=1, double end=-1)
static double | mu_cell (double row, double col)
static double | mu_col (const char *arg)
static double | mu_max (const char *arg, double start=1, double end=-1)
static double | mu_min (const char *arg, double start=1, double end=-1)
static double | mu_sum (const char *arg, double start=1, double end=-1)
static double | mu_tableCell (double col, double row)
static double | mu_tablecol (const char *arg)

## Private Attributes

QStringList | muCode
MyParser | parser
MyParser | rparser
Q3AsciiDict< double > | rvariables
Q3AsciiDict< double > | variables

## Additional Inherited Members

Signals inherited from Script
void | codeChanged ()
| This is emitted whenever the code to be executed by exec() and eval() is changed. More...
void | error (const QString &message, const QString &scriptName, int lineNumber)
| signal an error condition / exception More...
void | print (const QString &output)
| output generated by the code More...
Protected Types inherited from Script
enum | compileStatus { notCompiled, isCompiled, compileErr }
Protected Member Functions inherited from Script
void | emit_error (const QString &message, int lineNumber)
Protected Attributes inherited from Script
QString | Code
enum Script::compileStatus | compiled
QObject * | Context
bool | EmitErrors
ScriptingEnv * | Env
QString | Name

## Detailed Description

TODO.

## Constructor & Destructor Documentation

muParserScript::muParserScript | ( | ScriptingEnv * | env,
|  | const QString & | code,
|  | QObject * | context = `0`,
|  | const QString & | name = `"<input>"`
| ) |  |

References MyParser::addGSLConstants(), Script::Context, Script::error(), mu_addVariable(), mu_addVariableR(), mu_avg(), mu_cell(), mu_col(), mu_max(), mu_min(), mu_sum(), mu_tableCell(), mu_tablecol(), parser, Script::print(), rparser, rvariables, and variables.

## Member Function Documentation

double * muParserScript::addVariable | ( | const char * | name | ) |

private

References rparser, and variables.

Referenced by mu_addVariable().

double * muParserScript::addVariableR | ( | const char * | name | ) |

private

References rvariables.

Referenced by mu_addVariableR().

double muParserScript::avg | ( | const QString & | arg,
|  | int | start = `0`,
|  | int | end = `-1`
| ) |  |

private

References Table::avg(), col(), Table::colNames(), Script::Context, and rvariables.

Referenced by mu_avg().

double muParserScript::cell | ( | int | row,
|  | int | col
| ) |  |

private

References Matrix::cell(), Script::Context, Matrix::numCols(), Matrix::numRows(), and Matrix::text().

Referenced by mu_cell().

int muParserScript::codeLines | ( |  | ) |

inline slot

References muCode.

Referenced by Matrix::canCalculate(), Table::extractData(), MatrixData::MatrixData(), MatrixModel::muParserCalculate(), Table::muParserCalculate(), and MatrixData::value().

double muParserScript::col | ( | const QString & | arg | ) |

private

References Table::cell(), Table::colNames(), Script::Context, Table::numCols(), Table::numRows(), rparser, rvariables, Table::text(), and variables.

Referenced by avg(), max(), min(), mu_col(), sum(), and tablecol().

bool muParserScript::compile | ( | bool | asFunction = `true` | ) |

slot

References Script::Code, compileColArg(), Script::compiled, current, Script::emit_error(), Script::isCompiled, muCode, and parser.

Referenced by Matrix::canCalculate(), eval(), exec(), Table::extractData(), MatrixData::MatrixData(), MatrixModel::muParserCalculate(), and Table::muParserCalculate().

QString muParserScript::compileColArg | ( | const QString & | in | ) |

static private

Referenced by compile().

double * muParserScript::defineVariable | ( | const char * | name,
|  | double | val = `0.0`
| ) |  |

slot

References Script::emit_error(), Script::name(), parser, rparser, and variables.

Referenced by Matrix::canCalculate(), Table::extractData(), MatrixData::MatrixData(), MatrixModel::muParserCalculate(), and Table::muParserCalculate().

QVariant muParserScript::eval | ( |  | ) |

slot

References compile(), Script::compiled, current, Script::emit_error(), Script::isCompiled, muCode, and parser.

Referenced by Matrix::canCalculate(), Table::extractData(), MatrixData::MatrixData(), MatrixModel::muParserCalculate(), Table::muParserCalculate(), and MatrixData::value().

double muParserScript::evalSingleLine | ( |  | ) |

slot

References parser.

Referenced by Matrix::canCalculate(), Table::extractData(), MatrixData::MatrixData(), MatrixModel::muParserCalculate(), Table::muParserCalculate(), and MatrixData::value().

QString muParserScript::evalSingleLineToString | ( | const QLocale & | locale,
|  | char | f,
|  | int | prec
| ) |  |

slot

References parser.

Referenced by Table::muParserCalculate().

bool muParserScript::exec | ( |  | ) |

slot

References compile(), Script::compiled, current, Script::emit_error(), Script::isCompiled, muCode, and parser.

double muParserScript::max | ( | const QString & | arg,
|  | int | start = `0`,
|  | int | end = `-1`
| ) |  |

private

References col(), Table::colNames(), Script::Context, Table::maxColumnValue(), and rvariables.

Referenced by mu_max().

double muParserScript::min | ( | const QString & | arg,
|  | int | start = `0`,
|  | int | end = `-1`
| ) |  |

private

References col(), Table::colNames(), Script::Context, Table::minColumnValue(), and rvariables.

Referenced by mu_min().

static double* muParserScript::mu_addVariable | ( | const char * | name,
|  | void * |
| ) |  |

inline static private

References addVariable(), and current.

Referenced by muParserScript().

static double* muParserScript::mu_addVariableR | ( | const char * | name | ) |

inline static private

References addVariableR(), and current.

Referenced by muParserScript().

static double* muParserScript::mu_addVariableR | ( | const char * | name,
|  | void * |
| ) |  |

inline static private

References addVariableR(), and current.

static double muParserScript::mu_avg | ( | const char * | arg,
|  | double | start = `1`,
|  | double | end = `-1`
| ) |  |

inline static private

References avg(), and current.

Referenced by muParserScript().

static double muParserScript::mu_cell | ( | double | row,
|  | double | col
| ) |  |

inline static private

References cell(), and current.

Referenced by muParserScript().

static double muParserScript::mu_col | ( | const char * | arg | ) |

inline static private

References col(), and current.

Referenced by muParserScript().

static double muParserScript::mu_max | ( | const char * | arg,
|  | double | start = `1`,
|  | double | end = `-1`
| ) |  |

inline static private

References current, and max().

Referenced by muParserScript().

static double muParserScript::mu_min | ( | const char * | arg,
|  | double | start = `1`,
|  | double | end = `-1`
| ) |  |

inline static private

References current, and min().

Referenced by muParserScript().

static double muParserScript::mu_sum | ( | const char * | arg,
|  | double | start = `1`,
|  | double | end = `-1`
| ) |  |

inline static private

References current, and sum().

Referenced by muParserScript().

static double muParserScript::mu_tableCell | ( | double | col,
|  | double | row
| ) |  |

inline static private

References current, and tableCell().

Referenced by muParserScript().

static double muParserScript::mu_tablecol | ( | const char * | arg | ) |

inline static private

References current, and tablecol().

Referenced by muParserScript().

bool muParserScript::setDouble | ( | double | val,
|  | const char * | name
| ) |  |

slot

References Script::emit_error(), Script::name(), parser, rparser, and variables.

Referenced by setInt().

bool muParserScript::setInt | ( | int | val,
|  | const char * | name
| ) |  |

slot

References setDouble().

bool muParserScript::setQObject | ( | QObject * | val,
|  | const char * | name
| ) |  |

slot

double muParserScript::sum | ( | const QString & | arg,
|  | int | start = `0`,
|  | int | end = `-1`
| ) |  |

private

References col(), Table::colNames(), Script::Context, rvariables, and Table::sum().

Referenced by mu_sum().

double muParserScript::tableCell | ( | int | col,
|  | int | row
| ) |  |

private

References Table::cell(), Script::Context, Table::numCols(), Table::numRows(), and Table::text().

Referenced by mu_tableCell().

double muParserScript::tablecol | ( | const QString & | arg | ) |

private

References ScriptingEnv::application(), Table::cell(), col(), Table::colIndex(), Script::Context, MdiSubWindow::name(), Table::numCols(), Table::numRows(), rparser, rvariables, Script::scriptingEnv(), ApplicationWindow::table(), Table::text(), and variables.

Referenced by mu_tablecol().

## Member Data Documentation

muParserScript * muParserScript::current = NULL

static

Referenced by compile(), eval(), exec(), mu_addVariable(), mu_addVariableR(), mu_avg(), mu_cell(), mu_col(), mu_max(), mu_min(), mu_sum(), mu_tableCell(), and mu_tablecol().

QStringList muParserScript::muCode

private

Referenced by codeLines(), compile(), eval(), and exec().

MyParser muParserScript::parser

private

Referenced by compile(), defineVariable(), eval(), evalSingleLine(), evalSingleLineToString(), exec(), muParserScript(), and setDouble().

MyParser muParserScript::rparser

private

Referenced by addVariable(), col(), defineVariable(), muParserScript(), setDouble(), and tablecol().

Q3AsciiDict<double> muParserScript::rvariables

private

Referenced by addVariableR(), avg(), col(), max(), min(), muParserScript(), sum(), and tablecol().

Q3AsciiDict<double> muParserScript::variables

private

Referenced by addVariable(), col(), defineVariable(), muParserScript(), setDouble(), and tablecol().

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

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