#include <muParserScript.h>
Public Slots | |
int | codeLines () |
bool | compile (bool asFunction=true) |
Compile the Code. Return true if the implementation doesn't support compilation. | |
double * | defineVariable (const char *name, double val=0.0) |
QVariant | eval () |
Evaluate the Code, returning QVariant() on an error / exception. | |
double | evalSingleLine () |
QString | evalSingleLineToString (const QLocale &locale, char f, int prec) |
bool | exec () |
Execute the Code, returning false on an error / exception. | |
bool | setDouble (double val, const char *name) |
bool | setInt (int val, const char *name) |
bool | setQObject (QObject *val, const char *name) |
Public Member Functions | |
muParserScript (ScriptingEnv *env, const QString &code, QObject *context=0, const QString &name="<input>", bool checkMultilineCode=true) | |
Static Public Attributes | |
static muParserScript * | current = NULL |
Private Member Functions | |
double * | addVariable (const char *name) |
double * | addVariableR (const char *name) |
double | cell (int row, int col) |
double | col (const QString &arg) |
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, void *) |
static double * | mu_addVariableR (const char *name) |
static double | mu_cell (double row, double col) |
static double | mu_col (const char *arg) |
static double | mu_tableCell (double col, double row) |
static double | mu_tablecol (const char *arg) |
Private Attributes | |
bool | d_warn_multiline_code |
Flag telling is the parser should warn users on multiline code input. | |
QStringList | muCode |
mu::Parser | parser |
mu::Parser | rparser |
Q3AsciiDict< double > | rvariables |
Q3AsciiDict< double > | variables |
muParserScript::muParserScript | ( | ScriptingEnv * | env, | |
const QString & | code, | |||
QObject * | context = 0 , |
|||
const QString & | name = "<input>" , |
|||
bool | checkMultilineCode = true | |||
) |
double * muParserScript::addVariable | ( | const char * | name | ) | [private] |
double * muParserScript::addVariableR | ( | const char * | name | ) | [private] |
double muParserScript::cell | ( | int | row, | |
int | col | |||
) | [private] |
References Matrix::cell(), Script::Context, matrix(), Matrix::numCols(), Matrix::numRows(), and Matrix::text().
Referenced by mu_cell().
int muParserScript::codeLines | ( | ) | [inline, slot] |
References muCode.
Referenced by Matrix::canCalculate(), Table::muParserCalculate(), and MatrixModel::muParserCalculate().
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 mu_col(), and tablecol().
bool muParserScript::compile | ( | bool | for_eval = true |
) | [virtual, slot] |
Compile the Code. Return true if the implementation doesn't support compilation.
Reimplemented from Script.
References Script::Code, compileColArg(), Script::compiled, current, Script::emit_error(), Script::isCompiled, muCode, and parser.
Referenced by Matrix::canCalculate(), eval(), exec(), Table::muParserCalculate(), and MatrixModel::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(), parser, rparser, and variables.
Referenced by Matrix::canCalculate(), Table::muParserCalculate(), and MatrixModel::muParserCalculate().
QVariant muParserScript::eval | ( | ) | [virtual, slot] |
Evaluate the Code, returning QVariant() on an error / exception.
Reimplemented from Script.
References compile(), Script::compiled, current, Script::emit_error(), Script::isCompiled, muCode, and parser.
Referenced by Matrix::canCalculate(), Table::muParserCalculate(), and MatrixModel::muParserCalculate().
double muParserScript::evalSingleLine | ( | ) | [slot] |
QString muParserScript::evalSingleLineToString | ( | const QLocale & | locale, | |
char | f, | |||
int | prec | |||
) | [slot] |
bool muParserScript::exec | ( | ) | [virtual, slot] |
Execute the Code, returning false on an error / exception.
Reimplemented from Script.
References compile(), Script::compiled, current, Script::emit_error(), Script::isCompiled, muCode, and parser.
static double* muParserScript::mu_addVariable | ( | const char * | name, | |
void * | ||||
) | [inline, static, private] |
static double* muParserScript::mu_addVariableR | ( | const char * | name, | |
void * | ||||
) | [inline, static, private] |
References addVariableR(), and current.
static double* muParserScript::mu_addVariableR | ( | const char * | name | ) | [inline, static, private] |
static double muParserScript::mu_cell | ( | double | row, | |
double | col | |||
) | [inline, static, private] |
static double muParserScript::mu_col | ( | const char * | arg | ) | [inline, static, private] |
static double muParserScript::mu_tableCell | ( | double | col, | |
double | row | |||
) | [inline, static, private] |
static double muParserScript::mu_tablecol | ( | const char * | arg | ) | [inline, static, private] |
bool muParserScript::setDouble | ( | double | val, | |
const char * | name | |||
) | [virtual, slot] |
bool muParserScript::setInt | ( | int | val, | |
const char * | name | |||
) | [virtual, slot] |
bool muParserScript::setQObject | ( | QObject * | val, | |
const char * | name | |||
) | [slot] |
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 Table::cell(), col(), Table::colNames(), Script::Context, MdiSubWindow::folder(), MdiSubWindow::name(), Table::numCols(), Table::numRows(), Folder::rootFolder(), rparser, rvariables, Folder::table(), Table::text(), and variables.
Referenced by mu_tablecol().
muParserScript * muParserScript::current = NULL [static] |
Referenced by compile(), eval(), exec(), mu_addVariable(), mu_addVariableR(), mu_cell(), mu_col(), mu_tableCell(), and mu_tablecol().
bool muParserScript::d_warn_multiline_code [private] |
Flag telling is the parser should warn users on multiline code input.
Referenced by muParserScript().
QStringList muParserScript::muCode [private] |
Referenced by codeLines(), compile(), eval(), and exec().
mu::Parser muParserScript::parser [private] |
Referenced by compile(), defineVariable(), eval(), evalSingleLine(), evalSingleLineToString(), exec(), muParserScript(), and setDouble().
mu::Parser muParserScript::rparser [private] |
Referenced by addVariable(), col(), defineVariable(), muParserScript(), setDouble(), and tablecol().
Q3AsciiDict<double> muParserScript::rvariables [private] |
Referenced by addVariableR(), col(), muParserScript(), and tablecol().
Q3AsciiDict<double> muParserScript::variables [private] |
Referenced by addVariable(), col(), defineVariable(), muParserScript(), setDouble(), and tablecol().