Line data Source code
1 : /*
2 : interface/dataprovider.h - Interface for data sources
3 : Copyright (C) 2003 Klarälvdalens Datakonsult AB
4 :
5 : This file is part of GPGME++.
6 :
7 : GPGME++ is free software; you can redistribute it and/or
8 : modify it under the terms of the GNU Library General Public
9 : License as published by the Free Software Foundation; either
10 : version 2 of the License, or (at your option) any later version.
11 :
12 : GPGME++ is distributed in the hope that it will be useful,
13 : but WITHOUT ANY WARRANTY; without even the implied warranty of
14 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 : GNU Library General Public License for more details.
16 :
17 : You should have received a copy of the GNU Library General Public License
18 : along with GPGME++; see the file COPYING.LIB. If not, write to the
19 : Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 : Boston, MA 02110-1301, USA.
21 : */
22 :
23 : #ifndef __GPGMEPP_INTERFACES_DATAPROVIDER_H__
24 : #define __GPGMEPP_INTERFACES_DATAPROVIDER_H__
25 :
26 : #include <sys/types.h>
27 :
28 : #include "gpgmepp_export.h"
29 :
30 : #include <gpg-error.h>
31 :
32 : namespace GpgME
33 : {
34 :
35 64 : class GPGMEPP_EXPORT DataProvider
36 : {
37 : public:
38 64 : virtual ~DataProvider() {}
39 :
40 : enum Operation {
41 : Read, Write, Seek, Release
42 : };
43 : virtual bool isSupported(Operation op) const = 0;
44 :
45 : virtual ssize_t read(void *buffer, size_t bufSize) = 0;
46 : virtual ssize_t write(const void *buffer, size_t bufSize) = 0;
47 : virtual off_t seek(off_t offset, int whence) = 0;
48 : virtual void release() = 0;
49 : };
50 :
51 : } // namespace GpgME
52 :
53 : #endif // __GPGMEPP_INTERFACES_DATAPROVIDER_H__
|