libkdepim
pluginloaderbase.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __LIBKDEPIM_PLUGINLOADERBASE_H__
00023 #define __LIBKDEPIM_PLUGINLOADERBASE_H__
00024
00025 #include <qstring.h>
00026 #include <qmap.h>
00027
00028 #include <kdepimmacros.h>
00029
00030 class KLibrary;
00031 class QStringList;
00032
00033 namespace KPIM {
00034
00035 class KDE_EXPORT PluginMetaData {
00036 public:
00037 PluginMetaData() {}
00038 PluginMetaData( const QString & lib, const QString & name,
00039 const QString & comment )
00040 : library( lib ), nameLabel( name ),
00041 descriptionLabel( comment ), loaded( false ) {}
00042 QString library;
00043 QString nameLabel;
00044 QString descriptionLabel;
00045 mutable bool loaded;
00046 };
00047
00048 class KDE_EXPORT PluginLoaderBase {
00049 protected:
00050 PluginLoaderBase();
00051 virtual ~PluginLoaderBase();
00052
00053 public:
00055 QStringList types() const;
00056
00058 const PluginMetaData * infoForName( const QString & type ) const;
00059
00062 virtual void scan() = 0;
00063
00064 protected:
00070 void doScan( const char * path );
00071
00074 void * mainFunc( const QString & type, const char * main_func ) const;
00075
00076 private:
00077 const KLibrary * openLibrary( const QString & libName ) const;
00078 QMap< QString, PluginMetaData > mPluginMap;
00079
00080 class Private;
00081 Private * d;
00082 };
00083
00084 }
00085
00086 #endif // __LIBKDEPIM_PLUGINLOADERBASE_H__
|