aboutsummaryrefslogtreecommitdiff
path: root/libbutl/standard-version.ixx
diff options
context:
space:
mode:
Diffstat (limited to 'libbutl/standard-version.ixx')
-rw-r--r--libbutl/standard-version.ixx34
1 files changed, 22 insertions, 12 deletions
diff --git a/libbutl/standard-version.ixx b/libbutl/standard-version.ixx
index 66dccba..7e282f8 100644
--- a/libbutl/standard-version.ixx
+++ b/libbutl/standard-version.ixx
@@ -40,28 +40,38 @@ namespace butl
return static_cast<std::uint16_t> (v / 1000 % 1000);
}
- inline std::uint16_t standard_version::
- pre_release () const noexcept
+ inline bool standard_version::
+ release () const noexcept
{
- std::uint64_t ab (version / 10 % 1000);
- if (ab >= 500)
- ab -= 500;
+ return version % 10000 == 0;
+ }
- return static_cast<std::uint16_t> (ab);
+ inline optional<std::uint16_t> standard_version::
+ pre_release () const noexcept
+ {
+ return release () || stub ()
+ ? nullopt
+ : optional<std::uint16_t> (version / 10 % 1000);
}
- inline bool standard_version::
+ inline optional<std::uint16_t> standard_version::
alpha () const noexcept
{
- std::uint64_t abe (version % 10000);
- return abe > 0 && abe < 5000 && !stub ();
+ optional<std::uint16_t> pr (pre_release ());
+ return pr && *pr < 500 ? pr : nullopt;
}
- inline bool standard_version::
+ inline optional<std::uint16_t> standard_version::
beta () const noexcept
{
- std::uint64_t abe (version % 10000);
- return abe > 5000 && !stub ();
+ optional<std::uint16_t> pr (pre_release ());
+ return pr && *pr >= 500 ? optional<std::uint16_t> (*pr - 500) : nullopt;
+ }
+
+ inline bool standard_version::
+ final () const noexcept
+ {
+ return release () || !(snapshot () || stub ());
}
inline bool standard_version::