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