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