[git] GPGME - branch, master, updated. gpgme-1.6.0-237-gd2f2cbd

by Andre Heinecke cvs at cvs.gnupg.org
Thu Jul 14 17:03:52 CEST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".

The branch, master has been updated
       via  d2f2cbd297c4d2f2c3264ecc3ffb7a2b3a70bd55 (commit)
       via  41de1ab904eaddffb2de17b1de8ef41e462daabe (commit)
      from  e7f4c364732660c6cda25720b7dbc5b1c917e368 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit d2f2cbd297c4d2f2c3264ecc3ffb7a2b3a70bd55
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Jul 14 17:03:05 2016 +0200

    Qt: Disable keylocate test for gnupg < 2.0.10
    
    * lang/qt/tests/t-keylocate.cpp: Disable test for gnupg < 2.0.10

diff --git a/lang/qt/tests/t-keylocate.cpp b/lang/qt/tests/t-keylocate.cpp
index 43aaf1c..5f52cc3 100644
--- a/lang/qt/tests/t-keylocate.cpp
+++ b/lang/qt/tests/t-keylocate.cpp
@@ -35,6 +35,7 @@
 #include "keylistjob.h"
 #include "protocol.h"
 #include "keylistresult.h"
+#include "engineinfo.h"
 
 using namespace QGpgME;
 using namespace GpgME;
@@ -88,6 +89,9 @@ private Q_SLOTS:
 
     void testKeyLocateSingle()
     {
+        if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.0.10") {
+            return;
+        }
         auto *job = openpgp()->locateKeysJob();
         mTestpattern = QStringLiteral("alfa at example.net");
 

commit 41de1ab904eaddffb2de17b1de8ef41e462daabe
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Jul 14 17:01:33 2016 +0200

    Cpp: Add EngineInfo::Version class
    
    * lang/cpp/src/engineinfo.cpp (EngineInfo::engineVersion): New.
    * lang/cpp/src/engineinfo.h (EngineInfo::engineVersion): Declare.
    (EngineInfo::Version): Small helper to work with versions.

diff --git a/lang/cpp/src/engineinfo.cpp b/lang/cpp/src/engineinfo.cpp
index d260090..c3b3e04 100644
--- a/lang/cpp/src/engineinfo.cpp
+++ b/lang/cpp/src/engineinfo.cpp
@@ -72,6 +72,11 @@ const char *GpgME::EngineInfo::version() const
     return isNull() ? 0 : d->info->version;
 }
 
+GpgME::EngineInfo::Version GpgME::EngineInfo::engineVersion() const
+{
+    return Version(version());
+}
+
 const char *GpgME::EngineInfo::requiredVersion() const
 {
     return isNull() ? 0 : d->info->req_version;
diff --git a/lang/cpp/src/engineinfo.h b/lang/cpp/src/engineinfo.h
index 4de9884..72e125c 100644
--- a/lang/cpp/src/engineinfo.h
+++ b/lang/cpp/src/engineinfo.h
@@ -28,6 +28,8 @@
 #include <memory>
 
 #include <algorithm>
+#include <string>
+#include <iostream>
 
 namespace GpgME
 {
@@ -35,6 +37,59 @@ namespace GpgME
 class GPGMEPP_EXPORT EngineInfo
 {
 public:
+    struct Version
+    {
+        int major, minor, patch;
+
+        Version(const std::string& version)
+        {
+            if (version.empty() ||
+                std::sscanf(version.c_str(), "%d.%d.%d", &major, &minor, &patch) != 3) {
+                major = 0;
+                minor = 0;
+                patch = 0;
+            }
+        }
+
+        bool operator < (const Version& other)
+        {
+            if (major < other.major)
+                return true;
+            if (minor < other.minor)
+                return true;
+            if (patch < other.patch)
+                return true;
+            return false;
+        }
+
+        bool operator < (const char* other)
+        {
+            return operator<(Version(other));
+        }
+
+        bool operator == (const Version& other)
+        {
+            return major == other.major
+                && minor == other.minor
+                && patch == other.patch;
+        }
+
+        bool operator == (const char* other)
+        {
+            return operator==(Version(other));
+        }
+
+        friend std::ostream& operator << (std::ostream& stream, const Version& ver)
+        {
+            stream << ver.major;
+            stream << '.';
+            stream << ver.minor;
+            stream << '.';
+            stream << ver.patch;
+            return stream;
+        }
+    };
+
     EngineInfo();
     explicit EngineInfo(gpgme_engine_info_t engine);
 
@@ -55,6 +110,7 @@ public:
     Protocol protocol() const;
     const char *fileName() const;
     const char *version() const;
+    Version engineVersion() const;
     const char *requiredVersion() const;
     const char *homeDirectory() const;
 

-----------------------------------------------------------------------

Summary of changes:
 lang/cpp/src/engineinfo.cpp   |  5 ++++
 lang/cpp/src/engineinfo.h     | 56 +++++++++++++++++++++++++++++++++++++++++++
 lang/qt/tests/t-keylocate.cpp |  4 ++++
 3 files changed, 65 insertions(+)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list