pluginloaderbase.h
00001 /* -*- c++ -*- 00002 This file is part of libtdepim. 00003 00004 Copyright (c) 2002,2004 Marc Mutz <mutz@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 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 } // namespace KMime 00085 00086 #endif // __LIBTDEPIM_PLUGINLOADERBASE_H__