diff options
author | Ingo Klöcker <[email protected]> | 2020-10-15 14:50:32 +0000 |
---|---|---|
committer | Ingo Klöcker <[email protected]> | 2020-10-23 11:50:16 +0000 |
commit | c3406462d11b4241d4feee9be08e0ebe4f2e0bfa (patch) | |
tree | 3cf53096326566362ca2891e4b30d8f57f49338e /lang/cpp/src/engineinfo.h | |
parent | cpp, qt: Fix version info comparison (diff) | |
download | gpgme-c3406462d11b4241d4feee9be08e0ebe4f2e0bfa.tar.gz gpgme-c3406462d11b4241d4feee9be08e0ebe4f2e0bfa.zip |
cpp, qt: Add missing comparison operators for version info comparison
* lang/cpp/src/engineinfo.h (EngineInfo::Version::operator<=,
EngineInfo::Version::operator>=, EngineInfo::Version::operator!=):
New.
* lang/qt/tests/t-various.cpp (TestVarious::testVersion): Add tests for
new comparison operators.
* NEWS: Mention added API
Diffstat (limited to '')
-rw-r--r-- | lang/cpp/src/engineinfo.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lang/cpp/src/engineinfo.h b/lang/cpp/src/engineinfo.h index 0bf7d0e8..52bf3474 100644 --- a/lang/cpp/src/engineinfo.h +++ b/lang/cpp/src/engineinfo.h @@ -85,6 +85,16 @@ public: return operator<(Version(other)); } + bool operator <= (const Version &other) + { + return !operator>(other); + } + + bool operator <= (const char *other) + { + return operator<=(Version(other)); + } + bool operator > (const char* other) { return operator>(Version(other)); @@ -95,6 +105,16 @@ public: return !operator<(other) && !operator==(other); } + bool operator >= (const Version &other) + { + return !operator<(other); + } + + bool operator >= (const char *other) + { + return operator>=(Version(other)); + } + bool operator == (const Version& other) { return major == other.major @@ -107,6 +127,16 @@ public: return operator==(Version(other)); } + bool operator != (const Version &other) + { + return !operator==(other); + } + + bool operator != (const char *other) + { + return operator!=(Version(other)); + } + friend std::ostream& operator << (std::ostream& stream, const Version& ver) { stream << ver.major; |