gpgme/lang/cpp
Ingo Klöcker 28c23ce8db
build,cpp: Separate C++ bindings from gpgme
* configure.ac: Remove definition and substitution of
LIBGPGMEPP_LT_CURRENT, LIBGPGMEPP_LT_AGE, LIBGPGMEPP_LT_REVISION.
Remove "cpp" from available_languages and from default_languages.
Remove checks for C++ 11 and for support of visibility attribute.
Remove substitution of GPGME_CPP_CFLAGS.
Remove definition and substitution of GPGMEPP_PKGCONFIG_LIBS,
GPGMEPP_PKGCONFIG_CFLAGS, GPGMEPP_PKGCONFIG_HOST.
Remove generation of files in lang/cpp.
* lang/Makefile.am (DIST_SUBDIRS): Remove cpp.
* lang/cpp/.gitignore, lang/cpp/AUTHORS, lang/cpp/COPYING,
lang/cpp/COPYING.LESSER, lang/cpp/COPYING.LIB, lang/cpp/ChangeLog,
lang/cpp/INSTALL, lang/cpp/NEWS, lang/cpp/autogen.rc,
lang/cpp/autogen.sh, lang/cpp/configure.ac: New.
* lang/cpp/Makefile.am (EXTRA_DIST): Add autogen.sh, autogen.rc,
VERSION.
(RELEASE_ARCHIVE_SUFFIX, ACLOCAL_AMFLAGS, dist-hook, distcheck-hook,
.PHONY, gen_start_date, gen-ChangeLog, RELEASE_NAME, release,
sign-release): New (copied from top-level Makefile.am).
* lang/cpp/build-aux/compile, lang/cpp/build-aux/config.guess,
lang/cpp/build-aux/config.sub, lang/cpp/build-aux/depcomp,
lang/cpp/build-aux/install-sh, lang/cpp/build-aux/libtool-patch.sed,
lang/cpp/build-aux/ltmain.sh, lang/cpp/build-aux/missing: New.
* m4/ax_cxx_compile_stdcxx.m4: Move to...
* lang/cpp/m4/ax_cxx_compile_stdcxx.m4: ...here.
* m4/ax_gcc_func_attribute.m4: Move to...
* lang/cpp/m4/ax_gcc_func_attribute.m4: ...here.
* lang/cpp/m4/gpg-error.m4, lang/cpp/m4/gpgme.m4,
lang/cpp/m4/libtool.m4, lang/cpp/m4/ltoptions.m4,
lang/cpp/m4/ltsugar.m4, lang/cpp/m4/ltversion.m4,
lang/cpp/m4/lt~obsolete.m4: New.
* lang/cpp/src/GpgmeppConfig-w32.cmake.in.in,
lang/cpp/src/GpgmeppConfig.cmake.in.in: Remove @LIBASSUAN_LIBS@ from
INTERFACE_LINK_LIBRARIES of Gpgmepp target.
* lang/cpp/src/Makefile.am (AM_CPPFLAGS): Replace include paths of
gpgme relative to top_builddir with @GPGME_CFLAGS@. Remove
@LIBASSUAN_CFLAGS@.
(libgpgmepp_la_LIBADD): Replace relative paths of libgpgme.la with
@GPGME_LIBS@. Remove @LIBASSUAN_LIBS@.
* lang/cpp/tests/Makefile.am (LDADD): Replace relative paths of
libgpgme.la with @GPGME_LIBS@.
(AM_CPPFLAGS): Replace include paths of gpgme relative to top_builddir
with @GPGME_CFLAGS@. Remove @LIBASSUAN_CFLAGS@. Remove -DTOP_SRCDIR.
--

This makes building and distributing GpgME++ independent of the sources
of gpgme. Many of the new files are copied from gpgme to make GpgME++ a
self-contained package. A later commit re-adds the possibility to build
GpgME++ as nested package together with gpgme.

GnuPG-bug-id: 7110
2024-06-11 14:23:40 +02:00
..
build-aux build,cpp: Separate C++ bindings from gpgme 2024-06-11 14:23:40 +02:00
m4 build,cpp: Separate C++ bindings from gpgme 2024-06-11 14:23:40 +02:00
src build,cpp: Separate C++ bindings from gpgme 2024-06-11 14:23:40 +02:00
tests build,cpp: Separate C++ bindings from gpgme 2024-06-11 14:23:40 +02:00
.gitignore build,cpp: Separate C++ bindings from gpgme 2024-06-11 14:23:40 +02:00
AUTHORS build,cpp: Separate C++ bindings from gpgme 2024-06-11 14:23:40 +02:00
autogen.rc build,cpp: Separate C++ bindings from gpgme 2024-06-11 14:23:40 +02:00
autogen.sh build,cpp: Separate C++ bindings from gpgme 2024-06-11 14:23:40 +02:00
ChangeLog build,cpp: Separate C++ bindings from gpgme 2024-06-11 14:23:40 +02:00
configure.ac build,cpp: Separate C++ bindings from gpgme 2024-06-11 14:23:40 +02:00
COPYING build,cpp: Separate C++ bindings from gpgme 2024-06-11 14:23:40 +02:00
COPYING.LESSER build,cpp: Separate C++ bindings from gpgme 2024-06-11 14:23:40 +02:00
COPYING.LIB build,cpp: Separate C++ bindings from gpgme 2024-06-11 14:23:40 +02:00
INSTALL build,cpp: Separate C++ bindings from gpgme 2024-06-11 14:23:40 +02:00
Makefile.am build,cpp: Separate C++ bindings from gpgme 2024-06-11 14:23:40 +02:00
NEWS build,cpp: Separate C++ bindings from gpgme 2024-06-11 14:23:40 +02:00
README spelling: fix misspellings 2018-11-08 12:34:27 +07:00

GpgMEpp - C++ bindings/wrapper for GPGME
----------------------------------------
Based on KF5gpgmepp

Overview
--------

GpgMEpp is a C++ wrapper (or C++ bindings) for the GnuPG project's
gpgme (GnuPG Made Easy) library, version 0.4.4 and later.

It is fairly complete, with some minor things still missing (in
particular, the key edit interface).

The design principles of this library are as follows:

1. A value-based interface (most clases are implicitly shared)
2. Callbacks are replaced by C++ interfaces (classes with only
   abstract methods).
3. No exceptions are thrown
4. There is (as yet) no explicit support for multi-threaded use
   (other than what gpgme itself provides; most notably the
   refcounting for implicit sharing is not thread-safe)
5. To avoid binary incompatible interface changes, we make
   extensive use of the d-pointer pattern and avoid virtual
   methods; any polymorphism present is already provided by gpgme
   itself, anyway (see e.g. Data). A notable exception of the
   no-virtuals rule is the use of abstract classes to cover
   C-callbacks.
6. Use of STL containers for improved memory management and
   dealing with lists.
7. Complete abstraction of the C-API so "gpgme.h" should not
   be needed in your project using GpgME++.
8. Abstraction of GnuPG's edit-key interface by prepared
   Editinteractor classes.

GpgMEpp was originally developed as part of the KDEPIM community.

Usage
-----

The usage pattern of GpgMEpp closely follows GPGMEs core usage
pattern so the documentation for GPGME itself provides a good
way to start.

The context structure in GPGME is mapped to a Context object in
GpgMEpp. Additional convenience code provides Data objects and
a Dataprovider interface that can be used to implement GPGME's
data with any subclass by implementing the right callbacks.

EditInteractor subclasses provide ready to use classes for
common --edit-key tasks. You can implement your own editinteractor
classes by implementing the EditInteractor interface and using
your subclass as an interactor in the edit function.

Example to set the ownertrust of a key:

    /* Create an edit interactor */
    EditInteractor *ei = new GpgSetOwnerTrustEditInteractor(Key::Ultimate);
    /* Obtain a Context */
    Context *ctx = Context::createForProtocol(Protocol::OpenPGP);
    /* Create an in memory data object */
    Data data;
    /* Start the edit on some key previously obtained. */
    Error e = ctx->edit(key, std::unique_ptr<EditInteractor>(ei), data);
    /* Errors provide boolean comparison */
    if (!e)
        ...
    /* Delete the context */
    delete ctx;

Examples / Tests
----------------

GpgMEpp is tested through the Qt API. You can refer to the
tests in qt/tests for examples of usage or refer to
the actual QGpgME*Job.cpp implementations which rely
on GpgMEpp and should cover most use cases.

Hacking
-------

GpgMEpp follows KDE Coding styles. See:
https://techbase.kde.org/Policies/Frameworks_Coding_Style
for more info.

License
-------
GPGMEpp is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

GPGMEpp is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License
along with GPGME++; see the file COPYING.LIB.  If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.