diff options
Diffstat (limited to 'butl/standard-version.cxx')
-rw-r--r-- | butl/standard-version.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/butl/standard-version.cxx b/butl/standard-version.cxx index 16095c0..3e049e2 100644 --- a/butl/standard-version.cxx +++ b/butl/standard-version.cxx @@ -530,4 +530,24 @@ namespace butl return (min_open ? '(' : '[') + min_version->string () + ' ' + max_version->string () + (max_open ? ')' : ']'); } + + bool standard_version_constraint:: + satisfies (const standard_version& v) const noexcept + { + bool s (true); + + if (min_version) + { + int i (v.compare (*min_version)); + s = min_open ? i > 0 : i >= 0; + } + + if (s && max_version) + { + int i (v.compare (*max_version)); + s = max_open ? i < 0 : i <= 0; + } + + return s; + } } |