• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

qgpgme

dataprovider.h

00001 /* dataprovider.h
00002    Copyright (C) 2004 Klarälvdalens Datakonsult AB
00003 
00004    This file is part of QGPGME.
00005 
00006    QGPGME is free software; you can redistribute it and/or modify it
00007    under the terms of the GNU Library General Public License as published
00008    by the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010 
00011    QGPGME 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
00014    GNU 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 QGPGME; see the file COPYING.LIB.  If not, write to the
00018    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019    Boston, MA 02110-1301, USA. */
00020 
00021 // -*- c++ -*-
00022 #ifndef __QGPGME_DATAPROVIDER_H__
00023 #define __QGPGME_DATAPROVIDER_H__
00024 
00025 #include "qgpgme_export.h"
00026 #include <gpgme++/interfaces/dataprovider.h>
00027 
00028 #include <QtCore/QByteArray>
00029 
00030 #include <boost/shared_ptr.hpp>
00031 
00032 class QIODevice;
00033 
00034 namespace QGpgME {
00035 
00036   class QGPGME_EXPORT QByteArrayDataProvider : public GpgME::DataProvider {
00037   public:
00038     QByteArrayDataProvider();
00039     explicit QByteArrayDataProvider( const QByteArray & initialData );
00040     ~QByteArrayDataProvider();
00041 
00042     const QByteArray & data() const { return mArray; }
00043 
00044   private:
00045     // these shall only be accessed through the dataprovider
00046     // interface, where they're public:
00048     bool isSupported( Operation ) const { return true; }
00050     ssize_t read( void * buffer, size_t bufSize );
00052     ssize_t write( const void * buffer, size_t bufSize );
00054     off_t seek( off_t offset, int whence );
00056     void release();
00057 
00058   private:
00059     QByteArray mArray;
00060     off_t mOff;
00061   };
00062 
00063   class QGPGME_EXPORT QIODeviceDataProvider : public GpgME::DataProvider {
00064   public:
00065     explicit QIODeviceDataProvider( const boost::shared_ptr<QIODevice> & initialData );
00066     ~QIODeviceDataProvider();
00067 
00068     const boost::shared_ptr<QIODevice> & ioDevice() const { return mIO; }
00069 
00070   private:
00071     // these shall only be accessed through the dataprovider
00072     // interface, where they're public:
00074     bool isSupported( Operation ) const;
00076     ssize_t read( void * buffer, size_t bufSize );
00078     ssize_t write( const void * buffer, size_t bufSize );
00080     off_t seek( off_t offset, int whence );
00082     void release();
00083 
00084   private:
00085     const boost::shared_ptr<QIODevice> mIO;
00086     bool mErrorOccurred;
00087   };
00088 
00089 } // namespace QGpgME
00090 
00091 #endif // __QGPGME_EVENTLOOPINTERACTOR_H__
00092 
00093 

qgpgme

Skip menu "qgpgme"
  • Main Page
  • File List

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  • kabc
  • kblog
  • kcal
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.6
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal