libkdenetwork Library API Documentation

gpgmepp/eventloopinteractor.h

00001 /* eventloopinteractor.h
00002    Copyright (C) 2003,2004 Klarälvdalens Datakonsult AB
00003 
00004    This file is part of GPGME++.
00005  
00006    GPGME++ is free software; you can redistribute it and/or modify it
00007    under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010  
00011    GPGME++ is distributed in the hope that it will be useful, but
00012    WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with GPGME; if not, write to the Free Software Foundation,
00018    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA.  */
00019 
00020 // -*- c++ -*-
00021 #ifndef __GPGMEPP_EVENTLOOPINTERACTOR_H__
00022 #define __GPGMEPP_EVENTLOOPINTERACTOR_H__
00023 
00024 
00025 namespace GpgME {
00026 
00027   class Context;
00028   class Error;
00029   class TrustItem;
00030   class Key;
00031 
00106   class EventLoopInteractor {
00107   protected:
00108     EventLoopInteractor();
00109   public:
00110     virtual ~EventLoopInteractor();
00111 
00112     static EventLoopInteractor * instance() { return mSelf; }
00113 
00114     void manage( Context * context );
00115     void unmanage( Context * context );
00116 
00117     enum Direction { Read, Write };
00118   protected:
00119     //
00120     // IO Notification Interface
00121     //
00122 
00125     void actOn( int fd, Direction dir );
00126 
00127     virtual void * registerWatcher( int fd, Direction dir, bool & ok ) = 0;
00128     virtual void unregisterWatcher( void * tag ) = 0;
00129 
00130     //
00131     // Event Handler Interface
00132     //
00133 
00134     virtual void nextTrustItemEvent( Context * context, const TrustItem & item ) = 0;
00135     virtual void nextKeyEvent( Context * context, const Key & key ) = 0;
00136     virtual void operationDoneEvent( Context * context, const Error & e ) = 0;
00137 
00138   private:
00139     class Private;
00140     friend class Private;
00141     Private * d;
00142     static EventLoopInteractor * mSelf;
00143   };
00144 
00145 }
00146 
00147 #endif // __GPGMEPP_EVENTLOOPINTERACTOR_H__
KDE Logo
This file is part of the documentation for libkdenetwork Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Oct 4 14:39:09 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003