diff options
Diffstat (limited to 'src/core/utils/CommonUtils.cpp')
-rw-r--r-- | src/core/utils/CommonUtils.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/utils/CommonUtils.cpp b/src/core/utils/CommonUtils.cpp index 9687acd4..0adc4d7f 100644 --- a/src/core/utils/CommonUtils.cpp +++ b/src/core/utils/CommonUtils.cpp @@ -98,4 +98,13 @@ auto GFUnStrDup(const char* s) -> QString { auto GPGFRONTEND_CORE_EXPORT IsFlatpakENV() -> bool { return QString::fromLocal8Bit(qgetenv("container")) == "flatpak"; } + +auto GPGFRONTEND_CORE_EXPORT ParseHexEncodedVersionTuple(const QString& s) + -> int { + // s is a hex-encoded, unsigned int-packed version tuple, + // i.e. each byte represents one part of the version tuple + bool ok; + const auto version = s.toUtf8().toUInt(&ok, 16); + return ok ? static_cast<int>(version) : -1; +} } // namespace GpgFrontend
\ No newline at end of file |