• Skip to content
  • Skip to link menu
KDE 4.0 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 #include <QtCore/QPointer>
00030 #include <QtCore/QIODevice>
00031 
00032 namespace QGpgME {
00033 
00034   class QGPGME_EXPORT QByteArrayDataProvider : public GpgME::DataProvider {
00035   public:
00036     QByteArrayDataProvider();
00037     explicit QByteArrayDataProvider( const QByteArray & initialData );
00038     ~QByteArrayDataProvider();
00039 
00040     const QByteArray & data() const { return mArray; }
00041 
00042   private:
00043     // these shall only be accessed through the dataprovider
00044     // interface, where they're public:
00046     bool isSupported( Operation ) const { return true; }
00048     ssize_t read( void * buffer, size_t bufSize );
00050     ssize_t write( const void * buffer, size_t bufSize );
00052     off_t seek( off_t offset, int whence );
00054     void release();
00055 
00056   private:
00057     QByteArray mArray;
00058     off_t mOff;
00059   };
00060 
00061   class QGPGME_EXPORT QIODeviceDataProvider : public GpgME::DataProvider {
00062   public:
00063     explicit QIODeviceDataProvider( QIODevice * initialData );
00064     ~QIODeviceDataProvider();
00065 
00066     void setOwnsDevice( bool ownz );
00067     bool ownsDevice() const;
00068 
00069     QIODevice * ioDevice() const { return mIO; }
00070 
00071   private:
00072     // these shall only be accessed through the dataprovider
00073     // interface, where they're public:
00075     bool isSupported( Operation ) const;
00077     ssize_t read( void * buffer, size_t bufSize );
00079     ssize_t write( const void * buffer, size_t bufSize );
00081     off_t seek( off_t offset, int whence );
00083     void release();
00084 
00085   private:
00086     QPointer<QIODevice> mIO;
00087     bool mOwnsDevice      :  1;
00088     unsigned int reserved : 31;
00089   };
00090 
00091 } // namespace QGpgME
00092 
00093 #endif // __QGPGME_EVENTLOOPINTERACTOR_H__
00094 
00095 

qgpgme

Skip menu "qgpgme"
  • Main Page
  • File List

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • 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.5
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