KDECore
kpluginloader.h
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 Copyright (C) 2007 Bernhard Loos <nhuh.put@web.de> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 #ifndef KDECORE_KPLUGINLOADER_H 00019 #define KDECORE_KPLUGINLOADER_H 00020 00021 #include <kglobal.h> 00022 #include <kdeversion.h> 00023 #include <kexportplugin.h> 00024 00025 #include <QtCore/QPluginLoader> 00026 #include <QtCore/QtPlugin> 00027 00028 00029 class KComponentData; 00030 class KPluginFactory; 00031 class KService; 00032 00033 class KPluginLoaderPrivate; 00034 00079 class KDECORE_EXPORT KPluginLoader : public QPluginLoader 00080 { 00081 Q_OBJECT 00082 Q_PROPERTY(QString fileName READ fileName) 00083 Q_PROPERTY(QString pluginName READ fileName) 00084 public: 00092 explicit KPluginLoader(const QString &plugin, const KComponentData &componentdata = KGlobal::mainComponent(), QObject *parent = 0); 00093 00101 explicit KPluginLoader(const KService &service, const KComponentData &componentdata = KGlobal::mainComponent(), QObject *parent = 0); 00102 00106 ~KPluginLoader(); 00107 00114 KPluginFactory *factory(); 00115 00120 QString pluginName() const; 00121 00126 quint32 pluginVersion() const; 00127 00132 QString errorString() const; 00133 00134 bool isLoaded() const; 00135 00136 protected: 00140 bool load(); 00141 private: 00142 Q_DECLARE_PRIVATE(KPluginLoader) 00143 Q_DISABLE_COPY(KPluginLoader) 00144 00145 using QPluginLoader::setFileName; 00146 00147 KPluginLoaderPrivate *const d_ptr; 00148 }; 00149 00150 00151 #endif