~showard314/ubuntu/natty/qtiplot/Python2.7_fix

« back to all changes in this revision

Viewing changes to qtiplot/src/muParserScript.h

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2008-04-04 15:11:55 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080404151155-rjp12ziov4tryj0o
Tags: 0.9.4-1
* New upstream release.
* Refresh patches.
* Remove 04_homepage_url patch. Merged upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
        Project              : QtiPlot
4
4
    --------------------------------------------------------------------
5
5
 
6
 
    Copyright            : (C) 2006 by Ion Vasilief, 
7
 
                           Tilman Hoener zu Siederdissen,
8
 
                           Knut Franke
9
 
    Email (use @ for *)  : ion_vasilief*yahoo.fr, thzs*gmx.net,
10
 
                           knut.franke*gmx.de
 
6
    Copyright            : (C) 2006 by Ion Vasilief, Knut Franke
 
7
    Email (use @ for *)  : ion_vasilief*yahoo.fr, knut.franke*gmx.de
11
8
    Description          : Evaluate mathematical expressions using muParser
12
 
                           
 
9
 
13
10
 ***************************************************************************/
14
11
 
15
12
/***************************************************************************
33
30
#ifndef MUPARSER_SCRIPT_H
34
31
#define MUPARSER_SCRIPT_H
35
32
 
36
 
#include "ScriptingEnv.h" 
 
33
#include "ScriptingEnv.h"
37
34
#include "Script.h"
38
35
 
39
36
#include <muParser.h>
45
42
class muParserScript: public Script
46
43
{
47
44
  Q_OBJECT
48
 
    
 
45
 
49
46
  public:
50
 
    muParserScript(ScriptingEnv *env, const QString &code, QObject *context=0, const QString &name="<input>");
51
 
        
 
47
    muParserScript(ScriptingEnv *env, const QString &code, QObject *context=0, const QString &name="<input>", bool checkMultilineCode = true);
 
48
 
52
49
  public slots:
53
50
    bool compile(bool asFunction=true);
54
 
    QVariant eval();
 
51
    QVariant eval();
 
52
    double evalSingleLine();
 
53
    QString evalSingleLineToString(const QLocale& locale, char f, int prec);
55
54
    bool exec();
56
55
    bool setQObject(QObject *val, const char *name);
57
56
    bool setInt(int val, const char* name);
58
 
    bool setDouble(double val, const char* name);
 
57
    bool setDouble(double val, const char* name);
 
58
    double* defineVariable(const char *name, double val = 0.0);
 
59
    int codeLines(){return muCode.size();};
59
60
 
60
61
  private:
61
62
    double col(const QString &arg);
62
 
         double tablecol(const QString &arg);
 
63
    double tablecol(const QString &arg);
63
64
    double cell(int row, int col);
64
 
         double tableCell(int col, int row);
 
65
    double tableCell(int col, int row);
65
66
    double *addVariable(const char *name);
66
67
    double *addVariableR(const char *name);
67
68
    static double *mu_addVariableR(const char *name) { return current->addVariableR(name); }
75
76
 
76
77
    mu::Parser parser, rparser;
77
78
    Q3AsciiDict<double> variables, rvariables;
78
 
    QStringList muCode;
 
79
    QStringList muCode;
 
80
        //! Flag telling is the parser should warn users on multiline code input
 
81
        bool d_warn_multiline_code;
79
82
 
80
83
  public:
81
84
    static muParserScript *current;