MyBooks
scriptextensioninterface.h
Go to the documentation of this file.
1 /***************************************************************************
2  * This file is part of the CuteReport project *
3  * Copyright (C) 2012-2017 by Alexander Mikhalov *
4  * alexander.mikhalov@gmail.com *
5  * *
6  ** GNU General Public License Usage **
7  * *
8  * This library is free software: you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation, either version 3 of the License, or *
11  * (at your option) any later version. *
12  * You should have received a copy of the GNU General Public License *
13  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
14  * *
15  ** GNU Lesser General Public License **
16  * *
17  * This library is free software: you can redistribute it and/or modify *
18  * it under the terms of the GNU Lesser General Public License as *
19  * published by the Free Software Foundation, either version 3 of the *
20  * License, or (at your option) any later version. *
21  * You should have received a copy of the GNU Lesser General Public *
22  * License along with this library. *
23  * If not, see <http://www.gnu.org/licenses/>. *
24  * *
25  * This library is distributed in the hope that it will be useful, *
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
28  * GNU General Public License for more details. *
29  ****************************************************************************/
30 #ifndef SCRIPTEXTENSIONINTERFACE_H
31 #define SCRIPTEXTENSIONINTERFACE_H
32 
33 #include "reportplugininterface.h"
34 #include "reportinterface.h"
35 #include "cutereport_globals.h"
36 
37 //#include <QtScript/QScriptExtensionPlugin>
38 
39 class QScriptEngine;
40 class QScriptValue;
41 
42 namespace CuteReport {
43 
45 {
46  Q_OBJECT
48 
49 public:
50  explicit ScriptExtensionInterface(QObject *parent = 0);
51  virtual ~ScriptExtensionInterface();
52 
53  virtual ScriptExtensionInterface *createInstance(QObject * parent = 0) const = 0;
54 
55  virtual QStringList keys() const = 0;
56  virtual void initialize(const QString &key, QScriptEngine *engine) = 0;
57 
58  void registerScriptObjects(QScriptEngine * scriptEngine, ReportInterface * report);
59  bool mainScriptPreprocess(QString & script, QStringList *errors = 0);
60 
61  bool initialItemScriptPreprocess(QString &script, const CuteReport::BaseItemInterface* item, QStringList * errors);
62  bool itemScriptPreprocess(QString &script, const QObject *object, QStringList * errors);
63 
64  QString descriptionFileName() const {return QString();}
65 
66 private:
67 
68 protected:
69  friend class ReportCore;
70 };
71 
72 
73 }
74 
75 Q_DECLARE_INTERFACE(CuteReport::ScriptExtensionInterface, "CuteReport.ScriptExtensionInterface/1.0")
76 
77 #endif // SCRIPTEXTENSIONINTERFACE_H
Definition: abstractpainterdelegate.h:42
TODO v2: rename to ReportObject.
Definition: reportinterface.h:71
QString descriptionFileName() const
Definition: scriptextensioninterface.h:64
Definition: reportplugininterface.h:53
Definition: scriptextensioninterface.h:44
#define CUTEREPORT_EXPORTS
Definition: cutereport_globals.h:47
Definition: baseiteminterface.h:107
Definition: reportcore.h:83