File indexing completed on 2024-06-16 04:33:42

0001 /*
0002     SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef _K3B_PLUGIN_H_
0007 #define _K3B_PLUGIN_H_
0008 
0009 #include "k3b_export.h"
0010 #include <KPluginFactory>
0011 #include <KPluginMetaData>
0012 #include <QObject>
0013 
0014 #define K3B_PLUGIN_SYSTEM_VERSION 5
0015 
0016 
0017 
0018 namespace K3b {
0019 
0020 
0021     /**
0022      * Base class for all plugins.
0023      */
0024     class LIBK3B_EXPORT Plugin : public QObject
0025     {
0026         Q_OBJECT
0027 
0028         friend class PluginManager;
0029 
0030     public:
0031         explicit Plugin( QObject* parent = 0 );
0032         ~Plugin() override;
0033 
0034         KPluginMetaData pluginMetaData() const { return d->metadata; }
0035 
0036         /**
0037          * Version of the plugin system this plugin was written for.
0038          */
0039         virtual int pluginSystemVersion() const = 0;
0040 
0041         /**
0042          * The plugin category.
0043          */
0044         virtual QString category() const = 0;
0045 
0046         virtual QString categoryName() const = 0;
0047 
0048     private:
0049         struct Private {
0050             KPluginMetaData metadata;
0051         };
0052         std::unique_ptr<Private> d=std::unique_ptr<Private>(new Private());
0053     };
0054 }
0055 
0056 #define K3B_EXPORT_PLUGIN( libname, classname ) K_PLUGIN_FACTORY(factory, registerPlugin<classname>();)
0057 
0058 #endif