libtdepim

pluginloaderbase.h
1 /*
2  This file is part of libtdepim.
3 
4  Copyright (c) 2002,2004 Marc Mutz <mutz@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef __LIBTDEPIM_PLUGINLOADERBASE_H__
23 #define __LIBTDEPIM_PLUGINLOADERBASE_H__
24 
25 #include <tqstring.h>
26 #include <tqmap.h>
27 
28 #include <tdemacros.h>
29 
30 class KLibrary;
31 class TQStringList;
32 
33 namespace KPIM {
34 
35  class TDE_EXPORT PluginMetaData {
36  public:
37  PluginMetaData() {}
38  PluginMetaData( const TQString & lib, const TQString & name,
39  const TQString & comment )
40  : library( lib ), nameLabel( name ),
41  descriptionLabel( comment ), loaded( false ) {}
42  TQString library;
43  TQString nameLabel;
44  TQString descriptionLabel;
45  mutable bool loaded;
46  };
47 
48  class TDE_EXPORT PluginLoaderBase {
49  protected:
50  PluginLoaderBase();
51  virtual ~PluginLoaderBase();
52 
53  public:
55  TQStringList types() const;
56 
58  const PluginMetaData * infoForName( const TQString & type ) const;
59 
62  virtual void scan() = 0;
63 
64  protected:
70  void doScan( const char * path );
71 
74  void * mainFunc( const TQString & type, const char * main_func ) const;
75 
76  private:
77  const KLibrary * openLibrary( const TQString & libName ) const;
78  TQMap< TQString, PluginMetaData > mPluginMap;
79 
80  class Private;
81  Private * d;
82  };
83 
84 } // namespace KMime
85 
86 #endif // __LIBTDEPIM_PLUGINLOADERBASE_H__
TDEPIM classes for drag and drop of mails.