Debian Codegraph @

README

raw
1 GPGME++ - C++ bindings/wrapper for GPGME
2 ----------------------------------------
3 Based on KF5gpgmepp
4
5 Overview
6 --------
7
8 GPGME++ is a C++ wrapper (or C++ bindings) for the GnuPG project's
9 GPGME (GnuPG Made Easy) library, version 0.4.4 and later.
10
11 It is fairly complete, with some minor things still missing.
12
13 The design principles of this library are as follows:
14
15 1. A value-based interface (most classes are implicitly shared)
16 2. Callbacks are replaced by C++ interfaces (classes with only
17 abstract methods).
18 3. No exceptions are thrown
19 4. There is (as yet) no explicit support for multi-threaded use
20 (other than what GPGME itself provides; most notably the
21 refcounting for implicit sharing is not thread-safe)
22 5. To avoid binary incompatible interface changes, we make
23 extensive use of the d-pointer pattern and avoid virtual
24 methods; any polymorphism present is already provided by GPGME
25 itself, anyway (see e.g. Data). A notable exception of the
26 no-virtuals rule is the use of abstract classes to cover
27 C-callbacks.
28 6. Use of STL containers for improved memory management and
29 dealing with lists.
30 7. Complete abstraction of the C-API so "gpgme.h" should not
31 be needed in your project using GPGME++.
32 8. Abstraction of GnuPG's edit-key interface by prepared
33 EditInteractor classes.
34
35 GPGME++ was originally developed as part of the KDEPIM community.
36
37 Usage
38 -----
39
40 The usage pattern of GPGME++ closely follows GPGMEs core usage
41 pattern so the documentation for GPGME itself provides a good
42 way to start.
43
44 The context structure in GPGME is mapped to a Context object in
45 GPGME++. Additional convenience code provides Data objects and
46 a Dataprovider interface that can be used to implement GPGME's
47 data with any subclass by implementing the right callbacks.
48
49 EditInteractor subclasses provide ready to use classes for
50 common --edit-key tasks. You can implement your own editinteractor
51 classes by implementing the EditInteractor interface and using
52 your subclass as an interactor in the edit function.
53
54 Example to set the ownertrust of a key:
55
56 /* Create an edit interactor */
57 EditInteractor *ei = new GpgSetOwnerTrustEditInteractor(Key::Ultimate);
58 /* Obtain a Context */
59 Context *ctx = Context::createForProtocol(Protocol::OpenPGP);
60 /* Create an in memory data object */
61 Data data;
62 /* Start the edit on some key previously obtained. */
63 Error e = ctx->edit(key, std::unique_ptr<EditInteractor>(ei), data);
64 /* Errors provide boolean comparison */
65 if (!e)
66 ...
67 /* Delete the context */
68 delete ctx;
69
70 Examples / Tests
71 ----------------
72
73 GPGME++ is tested through the Qt API. You can refer to the
74 tests in QGpgME for examples of usage or refer to
75 the actual QGpgME*Job.cpp implementations which rely
76 on GPGME++ and should cover most use cases.
77
78 A few examples for using the GPGME++ API directly can be found
79 in the tests folder.
80
81 Hacking
82 -------
83
84 GPGME++ follows KDE Coding styles. See:
85 https://community.kde.org/Policies/Frameworks_Coding_Style
86 for more info.
87
88 License
89 -------
90 GPGME++ is free software; you can redistribute it and/or
91 modify it under the terms of the GNU Library General Public
92 License as published by the Free Software Foundation; either
93 version 2 of the License, or (at your option) any later version.
94
95 GPGME++ is distributed in the hope that it will be useful,
96 but WITHOUT ANY WARRANTY; without even the implied warranty of
97 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
98 GNU Library General Public License for more details.
99
100 You should have received a copy of the GNU Library General Public License
101 along with GPGME++; see the file COPYING.LIB. If not, write to the
102 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
103 Boston, MA 02110-1301, USA.