1 | /* |
2 | trustitem.h - wraps a gpgme trust item |
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 | // -*- c++ -*- |
24 | #ifndef __GPGMEPP_TRUSTITEM_H__ |
25 | #define __GPGMEPP_TRUSTITEM_H__ |
26 | |
27 | #include <gpgme++/gpgmefw.h> |
28 | #include <gpgme++/key.h> |
29 | #include <gpgme++/gpgme++_export.h> |
30 | |
31 | #include <algorithm> |
32 | |
33 | namespace GpgME { |
34 | |
35 | class Context; |
36 | |
37 | class GPGMEPP_EXPORT TrustItem { |
38 | friend class ::GpgME::Context; |
39 | public: |
40 | explicit TrustItem( gpgme_trust_item_t item=0 ); |
41 | TrustItem( const TrustItem & other ); |
42 | virtual ~TrustItem(); |
43 | |
44 | const TrustItem & operator=( TrustItem other ) { |
45 | swap( other ); |
46 | return *this; |
47 | } |
48 | |
49 | void swap( TrustItem & other ) { |
50 | using std::swap; |
51 | swap( this->d, other.d ); |
52 | } |
53 | |
54 | bool isNull() const; |
55 | |
56 | const char * keyID() const; |
57 | const char * userID() const; |
58 | |
59 | const char * ownerTrustAsString() const; |
60 | const char * validityAsString() const; |
61 | |
62 | int trustLevel() const; |
63 | |
64 | enum Type { Unknown=0, Key=1, UserID=2 }; |
65 | Type type() const; |
66 | |
67 | private: |
68 | gpgme_trust_item_t impl() const; |
69 | class Private; |
70 | Private * d; |
71 | }; |
72 | |
73 | } // namepace GpgME |
74 | |
75 | GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION( TrustItem ) |
76 | |
77 | #endif // __GPGMEPP_TRUSTITEM_H__ |
78 | |