libkdepim Library API Documentation

pluginloaderbase.h

00001 /*  -*- c++ -*-
00002     This file is part of libkdepim.
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., 59 Temple Place - Suite 330,
00019     Boston, MA 02111-1307, USA.
00020 */
00021 
00022 #ifndef __LIBKDEPIM_PLUGINLOADERBASE_H__
00023 #define __LIBKDEPIM_PLUGINLOADERBASE_H__
00024 
00025 #include <qstring.h>
00026 #include <qmap.h>
00027 
00028 class KLibrary;
00029 class QStringList;
00030 
00031 namespace KPIM {
00032 
00033   class PluginMetaData {
00034   public:
00035     PluginMetaData() {}
00036     PluginMetaData( const QString & lib, const QString & name,
00037             const QString & comment )
00038       : library( lib ), nameLabel( name ),
00039     descriptionLabel( comment ), loaded( false ) {}
00040     QString library;
00041     QString nameLabel;
00042     QString descriptionLabel;
00043     mutable bool loaded;
00044   };
00045 
00046   class PluginLoaderBase {
00047   protected:
00048     PluginLoaderBase();
00049     virtual ~PluginLoaderBase();
00050 
00051   public:
00053     QStringList types() const;
00054 
00056     const PluginMetaData * infoForName( const QString & type ) const;
00057 
00060     virtual void scan() = 0;
00061 
00062   protected:
00068     void doScan( const char * path );
00069 
00072     void * mainFunc( const QString & type, const char * main_func ) const;
00073 
00074   private:
00075     const KLibrary * openLibrary( const QString & libName ) const;
00076     QMap< QString, PluginMetaData > mPluginMap;
00077 
00078     class Private;
00079     Private * d;
00080   };
00081 
00082 } // namespace KMime
00083 
00084 #endif // __LIBKDEPIM_PLUGINLOADERBASE_H__
KDE Logo
This file is part of the documentation for libkdepim Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Aug 23 18:19:46 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003