diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2023-01-17 13:10:40 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2023-01-17 13:11:22 +0300 |
commit | 33f5e4665f961de406802f13420c66598c7b32e1 (patch) | |
tree | 9a8e1f609cc01a2fdf41615190dc07f2145b1e23 /libbpkg/manifest.cxx | |
parent | d66e8f5e02f77bd51e3dc545d08c5fcbbf6e4e97 (diff) |
Add distribution_name_value::distribution()
Diffstat (limited to 'libbpkg/manifest.cxx')
-rw-r--r-- | libbpkg/manifest.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libbpkg/manifest.cxx b/libbpkg/manifest.cxx index 82a11f3..637d0ae 100644 --- a/libbpkg/manifest.cxx +++ b/libbpkg/manifest.cxx @@ -3240,6 +3240,25 @@ namespace bpkg return r; } + // distribution_name_value + // + optional<string> distribution_name_value:: + distribution (const string& s) const + { + size_t sn (s.size ()); + size_t nn (name.size ()); + + if (nn > sn && name.compare (nn - sn, sn, s) == 0) + { + size_t p (name.find ('-')); + + if (p == nn - sn) + return string (name, 0, p); + } + + return nullopt; + } + // pkg_package_manifest // static build_class_expr |