diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-04-27 19:36:58 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-04-28 12:08:08 +0300 |
commit | 5bb170316ebad036ee5b8b18dee7ce3d09c72df4 (patch) | |
tree | acb30c55637b40e7fb4ff9679cb9187ffa410c68 /butl/standard-version | |
parent | dad361a3415e88475a78d1b2702133629fb6e548 (diff) |
Add support for standard version earliest pre-release
Diffstat (limited to 'butl/standard-version')
-rw-r--r-- | butl/standard-version | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/butl/standard-version b/butl/standard-version index c9637d8..0c7b9bc 100644 --- a/butl/standard-version +++ b/butl/standard-version @@ -16,17 +16,20 @@ namespace butl { - // The build2 "standard version": + // The build2 "standard version" (specific and earliest): // // [<epoch>~]<maj>.<min>.<patch>[-(a|b).<num>[.<snapsn>[.<snapid>]]][+<rev>] + // [<epoch>~]<maj>.<min>.<patch>- // struct LIBBUTL_EXPORT standard_version { // Invariants: // - // 1. (E == 0) == (snapshot_sn == 0 && snapshot_id.empty ()) + // 1. allow_earliest + // ? (E == 1) || (snapshot_sn == 0) + // : (E == 0) == (snapshot_sn == 0) // - // 2. snapshot_sn != latest_sn || snapshot_id.empty () + // 2. snapshot_sn != latest_sn && snapshot_sn != 0 || snapshot_id.empty () // static const std::uint64_t latest_sn = std::uint64_t (~0); @@ -58,6 +61,13 @@ namespace butl bool beta () const noexcept; bool snapshot () const noexcept {return snapshot_sn != 0;} + // Is represented by DDDE being 0001 and snapshot_sn being 0. + // + // Note that the earliest version is a final alpha pre-release. + // + bool + earliest () const noexcept; + int compare (const standard_version&) const noexcept; @@ -65,23 +75,27 @@ namespace butl // recognizable or components are invalid. // explicit - standard_version (const std::string&); + standard_version (const std::string&, bool allow_earliest = false); explicit - standard_version (std::uint64_t version); + standard_version (std::uint64_t version, bool allow_earliest = false); - standard_version (std::uint64_t version, const std::string& snapshot); + standard_version (std::uint64_t version, + const std::string& snapshot, + bool allow_earliest = false); standard_version (std::uint16_t epoch, std::uint64_t version, const std::string& snapshot, - std::uint16_t revision); + std::uint16_t revision, + bool allow_earliest = false); standard_version (std::uint16_t epoch, std::uint64_t version, std::uint64_t snapshot_sn, std::string snapshot_id, - std::uint16_t revision); + std::uint16_t revision, + bool allow_earliest = false); // Create empty version. // |