Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

plugin.h

Go to the documentation of this file.
00001 /*
00002    This file is part of the KDB libraries
00003    Copyright (c) 2000 Praduroux Alessandro <pradu@thekompany.com>
00004  
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009  
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014  
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
00019 */     
00020 #ifndef PLUGIN_H
00021 #define PLUGIN_H
00022 
00023 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026 
00027 #include <qstring.h>
00028 #include <qlist.h>
00029 
00030 #include "kdb.h"
00031 #include "object.h"
00032 #include "connection.h"
00033 
00034 namespace KDB {
00035 
00036 class Capability;
00037 class Connector;
00038 
00039 class Plugin;
00040 typedef QList<Plugin>         PluginList;
00041 typedef QListIterator<Plugin> PluginIterator;
00042 
00068 class Plugin: public Object {
00069     
00070     friend class Connection;
00071     
00072     Q_OBJECT
00073 
00074 public:
00075 
00076     struct PluginInfo {
00077         QString name;
00078         QString description;
00079         QString version;
00080         QString author;
00081         QString e_mail;
00082         QString copyright;
00083     };
00084 
00085 public:
00086 
00087     Plugin(const char * name = 0, QObject *parent = 0);
00088     virtual ~Plugin();
00089 
00093     virtual PluginInfo info() = 0;
00094 
00099     Connection * openConnection (const QString &host,
00100                                  int port = 0,
00101                                  const QString &user = QString::null,
00102                                  const QString &password = QString::null);
00103 
00107     virtual Connection * addConnection (const QString &host,
00108                                         int port = 0,
00109                                         const QString &user = QString::null,
00110                                         const QString &password = QString::null);
00111 
00117     void remove(Connection *);
00118 
00123     Connection * findConnection(const QString &host, const QString & user);
00124 
00129     ConnectionIterator begin();
00130 
00134     virtual bool provides(capability cap) = 0;
00135 
00140     virtual Capability * createObject(capability cap) = 0;
00141 
00142 
00143  signals:
00144 
00145     void closing(Plugin *);
00146 
00147  protected slots:
00148         
00149     void slotConnectionClose(Connection *);
00150         
00151  protected:
00152 
00153     void registerConnection(Connection *);
00154                   
00155     // these member functions must be overridden by implementations
00156     virtual Connector *createConnector() = 0;
00157 
00158  private:
00159 
00160     ConnectionList m_connections;
00161 };
00162 
00163 };
00164 
00165 #endif

Generated at Fri Sep 29 16:32:21 2000 for KDB by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000