QtiPlot  0.9.8.2
ScriptingEnv.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : ScriptingEnv.h
3  Project : QtiPlot
4  --------------------------------------------------------------------
5  Copyright : (C) 2006 by Ion Vasilief, Knut Franke
6  Email (use @ for *) : ion_vasilief*yahoo.fr
7  Description : Scripting abstraction layer
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 #ifndef SCRIPTINGENV_H
30 #define SCRIPTINGENV_H
31 
32 #include <QVariant>
33 #include <QString>
34 #include <QStringList>
35 #include <QObject>
36 #include <QStringList>
37 #include <QEvent>
38 
39 #include "customevents.h"
40 
41 class ApplicationWindow;
42 class Script;
43 
45 
50 class ScriptingEnv : public QObject
51 {
52  Q_OBJECT
53 
54  public:
55  ScriptingEnv(ApplicationWindow *parent, const char *langName);
57  virtual bool initialize() { return true; };
59  bool initialized() const { return d_initialized; }
61  virtual bool isRunning() const { return false; }
62 
64  virtual Script *newScript(const QString&, QObject*, const QString&) { return 0; }
65 
67  virtual QString stackTraceString() { return QString::null; }
68 
70  virtual const QStringList mathFunctions() const { return QStringList(); }
72  virtual const QString mathFunctionDoc(const QString&) const { return QString::null; }
74  virtual const QStringList fileExtensions() const { return QStringList(); };
76  const QString fileFilter() const;
77 
79 
80  public slots:
81  // global variables
82  virtual bool setQObject(QObject*, const char*) { return false; }
83  virtual bool setInt(int, const char*) { return false; }
84  virtual bool setDouble(double, const char*) { return false; }
85 
87  virtual void clear() {}
89  virtual void stopExecution() {}
91  virtual void startExecution() {}
92 
94  void incref();
96  void decref();
97 
98  signals:
100  void error(const QString & message, const QString & scriptName, int lineNumber);
102  void print(const QString & output);
103 
104  protected:
109 
110  private:
113 };
114 
115 #endif