1 | /* |
2 | assuanresult.h - wraps a gpgme assuan result |
3 | Copyright (C) 2009 Klarälvdalens Datakonsult AB <info@kdab.com> |
4 | Author: Marc Mutz <marc@kdab.com> |
5 | |
6 | This file is part of GPGME++. |
7 | |
8 | GPGME++ is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU Library General Public |
10 | License as published by the Free Software Foundation; either |
11 | version 2 of the License, or (at your option) any later version. |
12 | |
13 | GPGME++ is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU Library General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU Library General Public License |
19 | along with GPGME++; see the file COPYING.LIB. If not, write to the |
20 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
21 | Boston, MA 02110-1301, USA. |
22 | */ |
23 | |
24 | #ifndef __GPGMEPP_ASSUANRESULT_H__ |
25 | #define __GPGMEPP_ASSUANRESULT_H__ |
26 | |
27 | #include <gpgme++/gpgmefw.h> |
28 | #include <gpgme++/result.h> |
29 | #include <gpgme++/gpgme++_export.h> |
30 | |
31 | #include <time.h> |
32 | |
33 | #include <boost/shared_ptr.hpp> |
34 | |
35 | #include <vector> |
36 | #include <iosfwd> |
37 | |
38 | namespace GpgME { |
39 | |
40 | class Error; |
41 | |
42 | class GPGMEPP_EXPORT AssuanResult : public Result { |
43 | public: |
44 | AssuanResult(); |
45 | AssuanResult( gpgme_ctx_t ctx, int error ); |
46 | AssuanResult( gpgme_ctx_t ctx, const Error & error ); |
47 | explicit AssuanResult( const Error & err ); |
48 | |
49 | const AssuanResult & operator=( AssuanResult other ) { |
50 | swap( other ); |
51 | return *this; |
52 | } |
53 | |
54 | void swap( AssuanResult & other ) { |
55 | Result::swap( other ); |
56 | using std::swap; |
57 | swap( this->d, other.d ); |
58 | } |
59 | |
60 | bool isNull() const; |
61 | |
62 | Error assuanError() const; |
63 | |
64 | class Private; |
65 | private: |
66 | void init( gpgme_ctx_t ctx ); |
67 | boost::shared_ptr<Private> d; |
68 | }; |
69 | |
70 | GPGMEPP_EXPORT std::ostream & operator<<( std::ostream & os, const AssuanResult & result ); |
71 | |
72 | } |
73 | |
74 | GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION( AssuanResult ) |
75 | |
76 | #endif // __GPGMEPP_ASSUANRESULT_H__ |
77 | |