MyBooks
reportplugininterface.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 REPORTPLUGININTERFACE_H
31 #define REPORTPLUGININTERFACE_H
32 
33 #include <QObject>
34 #include <QStringList>
35 
36 #include "cutereport_globals.h"
37 #include "cutereport_types.h"
38 
39 namespace CuteReport
40 {
41 
42 class ReportCore;
43 
44 
45 struct ModuleInfo {
46  QString moduleName;
50 };
51 
52 
54 {
55  Q_OBJECT
56 
58 #if QT_VERSION <= 0x050000
59  Q_PROPERTY(QString objectName READ objectName WRITE setObjectName NOTIFY objectNameChanged)
60 #endif
61 
62 public:
63  enum ThreadingLevel {ThreadNo, ThreadNR, ThreadOk};
64  enum ModuleFlag {Unremovable = 0x01};
65  Q_DECLARE_FLAGS(ModuleFlags, ModuleFlag)
66 
67  explicit ReportPluginInterface(QObject *parent = 0);
68  virtual ~ReportPluginInterface();
69 
73  virtual bool moduleInit(){return true;}
74 
75  ModuleFlags moduleFlags() const {return ModuleFlags(0);}
76 
77  ReportCore * reportCore() const;
78  void setReportCore(ReportCore *reportCore);
79 
80  virtual int moduleVersion() const;
81  virtual QString moduleShortName() const = 0;
82  virtual QString suitName() const = 0;
83  QString moduleFullName() const { return suitName() + "::" + moduleShortName();}
84 
85  virtual QString objectNameHint() const {return QString();}
86 
87  virtual QString description() {return QString();}
88  virtual void setDescription(const QString & text) {Q_UNUSED(text);}
89 
90  // replaces modules in this with extended functionality without removing it from list
91  virtual QStringList extendsModules() const {return QStringList();}
92 
93  // removes modules from module list
94  virtual QStringList removesModules() const {return QStringList();}
95 
96  // defines mudule's dependencies including name maxVersion, MinVersion, type, etc.
97  virtual QList<ModuleInfo> dependencies() const { return QList<ModuleInfo>();}
98 
99  virtual ThreadingLevel threading() { return ThreadNo; }
100 
101  virtual ReportPluginInterface * createInstance(QObject * parent = 0) const = 0;
102 
103 //#if QT_VERSION <= 0x050000
104  virtual void setObjectName(const QString &name);
105 //#endif
106 
107 signals:
108  void changed();
109  void objectNameChanged(QString name);
110 
111 protected:
112  ReportPluginInterface(const ReportPluginInterface & dd, QObject * parent);
113 
114 private:
116 };
117 
118 } //namespace
119 
120 Q_DECLARE_INTERFACE(CuteReport::ReportPluginInterface, "CuteReport.ReportPluginInterface/1.0")
121 Q_DECLARE_OPERATORS_FOR_FLAGS(CuteReport::ReportPluginInterface::ModuleFlags)
122 #endif // REPORTPLUGININTERFACE_H
virtual QString description()
Definition: reportplugininterface.h:87
Definition: abstractpainterdelegate.h:42
QString moduleFullName() const
Definition: reportplugininterface.h:83
Definition: reportplugininterface.h:45
virtual void setDescription(const QString &text)
Definition: reportplugininterface.h:88
int maxVersion
Definition: reportplugininterface.h:48
ReportCore * m_reportCore
Definition: reportplugininterface.h:115
virtual QList< ModuleInfo > dependencies() const
Definition: reportplugininterface.h:97
int minVersion
Definition: reportplugininterface.h:47
virtual ThreadingLevel threading()
Definition: reportplugininterface.h:99
Definition: reportplugininterface.h:53
ModuleType
Definition: cutereport_types.h:127
virtual bool moduleInit()
Definition: reportplugininterface.h:73
ThreadingLevel
Definition: reportplugininterface.h:63
virtual QStringList extendsModules() const
Definition: reportplugininterface.h:91
ModuleFlag
Definition: reportplugininterface.h:64
virtual QStringList removesModules() const
Definition: reportplugininterface.h:94
#define CUTEREPORT_EXPORTS
Definition: cutereport_globals.h:47
ModuleFlags moduleFlags() const
Definition: reportplugininterface.h:75
virtual QString objectNameHint() const
Definition: reportplugininterface.h:85
Definition: reportcore.h:83
ModuleType type
Definition: reportplugininterface.h:49
QString moduleName
Definition: reportplugininterface.h:46