QtiPlot  0.9.8.2
Public Slots | Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes
muParserScript Class Reference

TODO. More...

#include <muParserScript.h>

Inheritance diagram for muParserScript:
Script

List of all members.

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 Slots inherited from Script
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()
const QString code () const
 Return the code that will be executed when calling exec() or eval()
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>")
ScriptingEnvscriptingEnv ()
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 ()

Static Public Attributes

static muParserScriptcurrent = 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.
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
- 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
ScriptingEnvEnv
QString Name

Detailed Description

TODO.


Constructor & Destructor Documentation

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

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
double muParserScript::cell ( int  row,
int  col 
)
private
int muParserScript::codeLines ( )
inlineslot
double muParserScript::col ( const QString &  arg)
private
bool muParserScript::compile ( bool  for_eval = true)
virtualslot

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::extractData(), MatrixData::MatrixData(), MatrixModel::muParserCalculate(), and Table::muParserCalculate().

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

Referenced by compile().

double * muParserScript::defineVariable ( const char *  name,
double  val = 0.0 
)
slot
QVariant muParserScript::eval ( )
virtualslot
double muParserScript::evalSingleLine ( )
slot
QString muParserScript::evalSingleLineToString ( const QLocale &  locale,
char  f,
int  prec 
)
slot

References parser.

Referenced by Table::muParserCalculate().

bool muParserScript::exec ( )
virtualslot

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.

double muParserScript::max ( const QString &  arg,
int  start = 0,
int  end = -1 
)
private
double muParserScript::min ( const QString &  arg,
int  start = 0,
int  end = -1 
)
private
static double* muParserScript::mu_addVariable ( const char *  name,
void *   
)
inlinestaticprivate

References addVariable(), and current.

Referenced by muParserScript().

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

References addVariableR(), and current.

Referenced by muParserScript().

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

References addVariableR(), and current.

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

References avg(), and current.

Referenced by muParserScript().

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

References cell(), and current.

Referenced by muParserScript().

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

References col(), and current.

Referenced by muParserScript().

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

References current, and max().

Referenced by muParserScript().

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

References current, and min().

Referenced by muParserScript().

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

References current, and sum().

Referenced by muParserScript().

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

References current, and tableCell().

Referenced by muParserScript().

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

References current, and tablecol().

Referenced by muParserScript().

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

Reimplemented from Script.

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

Referenced by setInt().

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

Reimplemented from Script.

References setDouble().

bool muParserScript::setQObject ( QObject *  val,
const char *  name 
)
slot
double muParserScript::sum ( const QString &  arg,
int  start = 0,
int  end = -1 
)
private
double muParserScript::tableCell ( int  col,
int  row 
)
private
double muParserScript::tablecol ( const QString &  arg)
private

Member Data Documentation

muParserScript * muParserScript::current = NULL
static
QStringList muParserScript::muCode
private

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

MyParser muParserScript::parser
private
MyParser muParserScript::rparser
private
Q3AsciiDict<double> muParserScript::rvariables
private
Q3AsciiDict<double> muParserScript::variables
private

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