1 | /* |
2 | editinteractor.h - Interface for edit interactors |
3 | Copyright (C) 2007 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_EDITINTERACTOR_H__ |
24 | #define __GPGMEPP_EDITINTERACTOR_H__ |
25 | |
26 | #include <gpgme++/gpgme++_export.h> |
27 | |
28 | #include <cstdio> |
29 | |
30 | namespace GpgME { |
31 | |
32 | class Error; |
33 | class Context; |
34 | class CallbackHelper; |
35 | |
36 | class GPGMEPP_EXPORT EditInteractor { |
37 | friend class ::GpgME::Context; |
38 | friend class ::GpgME::CallbackHelper; |
39 | EditInteractor( const EditInteractor & ); |
40 | EditInteractor & operator=( const EditInteractor & ); |
41 | public: |
42 | EditInteractor(); |
43 | virtual ~EditInteractor(); |
44 | |
45 | enum { |
46 | StartState = 0, |
47 | ErrorState = 0xFFFFFFFF |
48 | }; |
49 | |
50 | virtual const char * action( Error & err ) const = 0; |
51 | virtual unsigned int nextState( unsigned int statusCode, const char * args, Error & err ) const = 0; |
52 | |
53 | unsigned int state() const; |
54 | Error lastError() const; |
55 | bool needsNoResponse( unsigned int statusCode ) const; |
56 | |
57 | void setDebugChannel( std::FILE * file ); |
58 | |
59 | private: |
60 | class Private; |
61 | Private * const d; |
62 | }; |
63 | |
64 | } // namespace GpgME |
65 | |
66 | #endif // __GPGMEPP_EDITINTERACTOR_H__ |
67 | |