diff options
| author | Andre Heinecke <[email protected]> | 2016-11-04 11:29:32 +0000 | 
|---|---|---|
| committer | Andre Heinecke <[email protected]> | 2016-11-04 11:29:32 +0000 | 
| commit | 512de91f9a8da8f491e09653eb4b5bdd0a027198 (patch) | |
| tree | d8a9b7b380a66d9b9d13187851679b8fa83264bf /lang/cpp/src | |
| parent | cpp: Don't include gpgme.h in tofuinfo header (diff) | |
| download | gpgme-512de91f9a8da8f491e09653eb4b5bdd0a027198.tar.gz gpgme-512de91f9a8da8f491e09653eb4b5bdd0a027198.zip | |
cpp: Add more EngineInfo::Version ctors
* lang/cpp/src/engineinfo.h
(EngineInfo::Version::Version(const char*)),
(EngineInfo::Version::Version()): New.
Diffstat (limited to 'lang/cpp/src')
| -rw-r--r-- | lang/cpp/src/engineinfo.h | 16 | 
1 files changed, 16 insertions, 0 deletions
| diff --git a/lang/cpp/src/engineinfo.h b/lang/cpp/src/engineinfo.h index 72e125c3..aa6fccaf 100644 --- a/lang/cpp/src/engineinfo.h +++ b/lang/cpp/src/engineinfo.h @@ -40,6 +40,12 @@ public:      struct Version      {          int major, minor, patch; +        Version() +        { +          major = 0; +          minor = 0; +          patch = 0; +        }          Version(const std::string& version)          { @@ -51,6 +57,16 @@ public:              }          } +        Version(const char *version) +        { +            if (!version || +                std::sscanf(version, "%d.%d.%d", &major, &minor, &patch) != 3) { +                major = 0; +                minor = 0; +                patch = 0; +            } +        } +          bool operator < (const Version& other)          {              if (major < other.major) | 
