umbrello  2.32.1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
plugin.h
Go to the documentation of this file.
1 /***************************************************************************
2  plugin.h
3  -------------------
4  begin : Mon Jan 13 2003
5  copyright : (C) 2003 by Andrew Sutton
6  email : ansutton@kent.edu
7  Bugs and comments to umbrello-devel@kde.org or https://bugs.kde.org
8 ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 #ifndef UMBRELLO_PLUGIN_H
20 #define UMBRELLO_PLUGIN_H
21 
22 // Qt includes
23 #include <qobject.h>
24 
25 // KDE includes
26 #include <kgenericfactory.h>
27 
28 // local includes
29 #include "configurable.h"
30 
31 // forward declarations
32 class QStringList;
33 class KConfig;
34 
49 #define UMBRELLO_EXPORT_PLUGIN_FACTORY(libname, factory) \
50  extern "C" { KDE_EXPORT void *init_##libname() { return new factory(#libname); } }
51 
52 namespace Umbrello
53 {
54 // forward declarations
55 class PluginLoader;
56 
87 class Plugin :
88  public QObject,
89  public Configurable
90 {
91  Q_OBJECT
92  friend class PluginLoader;
93 public:
95  virtual ~Plugin();
96 
98  QByteArray instanceName() const;
99 
101  KConfig *config();
102 
104  virtual QString category();
105 
111  void unload();
112 
113 protected:
115  Plugin(QObject *parent, const char *name, const QStringList &args);
116 
118  virtual bool onInit();
119 
121  virtual bool onShutdown();
122 
123 private:
132  bool init();
133 
141  bool shutdown();
142 
151  virtual bool configure();
152 
154  void ref();
155 
156 protected:
157  uint _ref;
158  QByteArray _instanceName;
159  KConfig *_config;
160 };
161 }
162 
163 #endif
Definition: configurable.h:65
Definition: pluginloader.h:67
Definition: plugin.h:90
virtual bool onInit()
Definition: plugin.cpp:122
QByteArray _instanceName
Instance name of the plugin.
Definition: plugin.h:158
virtual bool onShutdown()
Definition: plugin.cpp:128
bool shutdown()
Definition: plugin.cpp:93
virtual QString category()
Definition: plugin.cpp:159
Plugin(QObject *parent, const char *name, const QStringList &args)
Definition: plugin.cpp:31
KConfig * _config
Configuration record.
Definition: plugin.h:159
virtual bool configure()
Definition: plugin.cpp:134
QByteArray instanceName() const
Definition: plugin.cpp:110
KConfig * config()
Definition: plugin.cpp:116
void ref()
Definition: plugin.cpp:47
bool init()
Definition: plugin.cpp:71
virtual ~Plugin()
Definition: plugin.cpp:42
uint _ref
Reference counter.
Definition: plugin.h:157
void unload()
Definition: plugin.cpp:53
Definition: configurable.h:36