diff options
| author | Christoph Berg <myon@debian.org> | 2025-01-09 22:12:06 +0100 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2025-01-09 22:12:06 +0100 |
| commit | 992d4b4b8d3f3a630a2cf00d593ee4ce4dfa7ce8 (patch) | |
| tree | fbfdfe6bcb0a8a114be2480dac53d88c977e4869 /revision_utils.cpp | |
| parent | 4320ce238aae1fe87fc9f379cdd816e9317885fa (diff) | |
New upstream version 2.7.0~rc8+repackupstream/2.7.0_rc8+repack
Diffstat (limited to 'revision_utils.cpp')
| -rwxr-xr-x | revision_utils.cpp | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/revision_utils.cpp b/revision_utils.cpp index 97bd9528..d78e09fc 100755 --- a/revision_utils.cpp +++ b/revision_utils.cpp @@ -1,84 +1,84 @@ -#include "revision_utils.hpp"
-
-#include <cstring>
-
-#include <QCoreApplication>
-#include <QRegularExpression>
-
-#include "scs_version.h"
-
-namespace
-{
- QString revision_extract_number (QString const& s)
- {
- QString revision;
-
- // try and match a number (hexadecimal allowed)
- QRegularExpression re {R"(^[$:]\w+: (r?[\da-f]+[^$]*)\$$)"};
- auto match = re.match (s);
- if (match.hasMatch ())
- {
- revision = match.captured (1);
- }
- return revision;
- }
-}
-
-QString revision (QString const& scs_rev_string)
-{
- QString result;
- auto revision_from_scs = revision_extract_number (scs_rev_string);
-
-#if defined (CMAKE_BUILD)
- QString scs_info {":Rev: " SCS_VERSION_STR " $"};
-
- auto revision_from_scs_info = revision_extract_number (scs_info);
- if (!revision_from_scs_info.isEmpty ())
- {
- // we managed to get the revision number from svn info etc.
- result = revision_from_scs_info;
- }
- else if (!revision_from_scs.isEmpty ())
- {
- // fall back to revision passed in if any
- result = revision_from_scs;
- }
- else
- {
- // match anything
- QRegularExpression re {R"(^[$:]\w+: ([^$]*)\$$)"};
- auto match = re.match (scs_info);
- if (match.hasMatch ())
- {
- result = match.captured (1);
- }
- }
-#else
- if (!revision_from_scs.isEmpty ())
- {
- // not CMake build so all we have is revision passed
- result = revision_from_scs;
- }
-#endif
- return result.trimmed ();
-}
-
-QString version (bool include_patch)
-{
-#if defined (CMAKE_BUILD)
- QString v {TO_STRING__ (PROJECT_VERSION_MAJOR) "." TO_STRING__ (PROJECT_VERSION_MINOR)};
- if (include_patch)
- {
- v += "." TO_STRING__ (PROJECT_VERSION_PATCH) + QString {BUILD_TYPE_REVISION};
- }
-#else
- QString v {"Not for Release"};
-#endif
- return v;
-}
-
-QString program_title (QString const& revision)
-{
- QString id {QCoreApplication::applicationName () + " v" + QCoreApplication::applicationVersion ()};
- return id + " " + revision + " by K1JT et al.";
-}
+#include "revision_utils.hpp" + +#include <cstring> + +#include <QCoreApplication> +#include <QRegularExpression> + +#include "scs_version.h" + +namespace +{ + QString revision_extract_number (QString const& s) + { + QString revision; + + // try and match a number (hexadecimal allowed) + QRegularExpression re {R"(^[$:]\w+: (r?[\da-f]+[^$]*)\$$)"}; + auto match = re.match (s); + if (match.hasMatch ()) + { + revision = match.captured (1); + } + return revision; + } +} + +QString revision (QString const& scs_rev_string) +{ + QString result; + auto revision_from_scs = revision_extract_number (scs_rev_string); + +#if defined (CMAKE_BUILD) + QString scs_info {":Rev: " SCS_VERSION_STR " $"}; + + auto revision_from_scs_info = revision_extract_number (scs_info); + if (!revision_from_scs_info.isEmpty ()) + { + // we managed to get the revision number from svn info etc. + result = revision_from_scs_info; + } + else if (!revision_from_scs.isEmpty ()) + { + // fall back to revision passed in if any + result = revision_from_scs; + } + else + { + // match anything + QRegularExpression re {R"(^[$:]\w+: ([^$]*)\$$)"}; + auto match = re.match (scs_info); + if (match.hasMatch ()) + { + result = match.captured (1); + } + } +#else + if (!revision_from_scs.isEmpty ()) + { + // not CMake build so all we have is revision passed + result = revision_from_scs; + } +#endif + return result.trimmed (); +} + +QString version (bool include_patch) +{ +#if defined (CMAKE_BUILD) + QString v {TO_STRING__ (PROJECT_VERSION_MAJOR) "." TO_STRING__ (PROJECT_VERSION_MINOR)}; + if (include_patch) + { + v += "." TO_STRING__ (PROJECT_VERSION_PATCH) + QString {BUILD_TYPE_REVISION}; + } +#else + QString v {"Not for Release"}; +#endif + return v; +} + +QString program_title (QString const& revision) +{ + QString id {QCoreApplication::applicationName () + " v" + QCoreApplication::applicationVersion ()}; + return id + " " + revision + " by K1JT et al."; +} |
