From 9175323db2ac6fabb15a5bebb0679c39150437bb Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 28 Apr 2017 10:43:50 +0200 Subject: Add standard_version::string_project_id() --- butl/standard-version | 2 ++ butl/standard-version.cxx | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/butl/standard-version b/butl/standard-version index 71bd5be..c198d3e 100644 --- a/butl/standard-version +++ b/butl/standard-version @@ -51,6 +51,7 @@ namespace butl // std::string string () const; // Package version. std::string string_project () const; // Project version (no epoch/rev). + std::string string_project_id () const; // Project version id (no snapsn). std::string string_version () const; // Version only (no snapshot). std::string string_pre_release () const; // Pre-release part only (a.1). std::string string_snapshot () const; // Snapshot part only (1234.1f23). @@ -186,6 +187,7 @@ namespace butl butl::optional min_version, bool min_open, butl::optional max_version, bool max_open); + explicit standard_version_constraint (const standard_version& v) : standard_version_constraint (v, false, v, false) {} diff --git a/butl/standard-version.cxx b/butl/standard-version.cxx index 3e049e2..1952653 100644 --- a/butl/standard-version.cxx +++ b/butl/standard-version.cxx @@ -332,6 +332,21 @@ namespace butl } string standard_version:: + string_project_id () const + { + std::string r (string_version ()); + + if (snapshot ()) // Trailing dot already in id. + { + r += (snapshot_sn == latest_sn ? "z" : + snapshot_id.empty () ? to_string (snapshot_sn) : + snapshot_id); + } + + return r; + } + + string standard_version:: string () const { std::string r; -- cgit v1.1