diff options
-rw-r--r-- | libbutl/standard-version.cxx | 16 | ||||
-rw-r--r-- | libbutl/standard-version.mxx | 8 |
2 files changed, 14 insertions, 10 deletions
diff --git a/libbutl/standard-version.cxx b/libbutl/standard-version.cxx index f4517ef..b01ebb9 100644 --- a/libbutl/standard-version.cxx +++ b/libbutl/standard-version.cxx @@ -496,13 +496,19 @@ namespace butl } string standard_version:: - string_project () const + string_project (bool rev) const { std::string r (string_version ()); if (snapshot ()) r += string_snapshot (); // string_version() includes trailing dot. + if (rev && revision != 0) + { + r += '+'; + r += to_string (revision); + } + return r; } @@ -533,13 +539,7 @@ namespace butl r += '-'; } - r += string_project (); - - if (revision != 0) - { - r += '+'; - r += to_string (revision); - } + r += string_project (true /* revision */); return r; } diff --git a/libbutl/standard-version.mxx b/libbutl/standard-version.mxx index 3c38242..83e9442 100644 --- a/libbutl/standard-version.mxx +++ b/libbutl/standard-version.mxx @@ -116,8 +116,12 @@ LIBBUTL_MODEXPORT namespace butl // // Note: return empty if the corresponding component is unspecified. // - std::string string () const; // Package version. - std::string string_project () const; // Project version (no epoch/rev). + std::string string () const; // Package version. + + // Project version (no epoch). + // + std::string string_project (bool revision = false) const; + 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). |