• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

qgpgme

  • sources
  • kde-4.14
  • kdepimlibs
  • qgpgme
dataprovider.h
1 /* dataprovider.h
2  Copyright (C) 2004 Klarälvdalens Datakonsult AB
3 
4  This file is part of QGPGME.
5 
6  QGPGME is free software; you can redistribute it and/or modify it
7  under the terms of the GNU Library General Public License as published
8  by the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  QGPGME is distributed in the hope that it will be useful, but
12  WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU 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 QGPGME; see the file COPYING.LIB. If not, write to the
18  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA. */
20 
21 // -*- c++ -*-
22 #ifndef __QGPGME_DATAPROVIDER_H__
23 #define __QGPGME_DATAPROVIDER_H__
24 
25 #include "qgpgme_export.h"
26 #include <gpgme++/interfaces/dataprovider.h>
27 
28 #include <QtCore/QByteArray>
29 
30 #include <boost/shared_ptr.hpp>
31 
32 class QIODevice;
33 
34 namespace QGpgME {
35 
36  class QGPGME_EXPORT QByteArrayDataProvider : public GpgME::DataProvider {
37  public:
38  QByteArrayDataProvider();
39  explicit QByteArrayDataProvider( const QByteArray & initialData );
40  ~QByteArrayDataProvider();
41 
42  const QByteArray & data() const {
43  return mArray;
44  }
45 
46  private:
47  // these shall only be accessed through the dataprovider
48  // interface, where they're public:
50  bool isSupported( Operation ) const { return true; }
52  ssize_t read( void * buffer, size_t bufSize );
54  ssize_t write( const void * buffer, size_t bufSize );
56  off_t seek( off_t offset, int whence );
58  void release();
59 
60  private:
61  QByteArray mArray;
62  off_t mOff;
63  };
64 
65  class QGPGME_EXPORT QIODeviceDataProvider : public GpgME::DataProvider {
66  public:
67  explicit QIODeviceDataProvider( const boost::shared_ptr<QIODevice> & initialData );
68  ~QIODeviceDataProvider();
69 
70  const boost::shared_ptr<QIODevice> & ioDevice() const {
71  return mIO;
72  }
73 
74  private:
75  // these shall only be accessed through the dataprovider
76  // interface, where they're public:
78  bool isSupported( Operation ) const;
80  ssize_t read( void * buffer, size_t bufSize );
82  ssize_t write( const void * buffer, size_t bufSize );
84  off_t seek( off_t offset, int whence );
86  void release();
87 
88  private:
89  const boost::shared_ptr<QIODevice> mIO;
90  bool mErrorOccurred : 1;
91  bool mHaveQProcess : 1;
92  };
93 
94 } // namespace QGpgME
95 
96 #endif // __QGPGME_EVENTLOOPINTERACTOR_H__
97 
98 
QIODevice
QByteArray
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:37:43 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

qgpgme

Skip menu "qgpgme"
  • Main Page
  • File List

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal