diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-07-25 12:57:03 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-07-25 12:57:03 +0200 |
commit | 190fb7a0ef8a28193a89c66d9d1fd84340ff99bd (patch) | |
tree | 3aef0e5d8801b610afdec7c776d4dacc9555af08 /libbpkg/package-name.hxx | |
parent | 3374ce4f2982edff59ed5ca29edc7fde1286b0a2 (diff) |
Add package_name::{base,extension,variable}()
Diffstat (limited to 'libbpkg/package-name.hxx')
-rw-r--r-- | libbpkg/package-name.hxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libbpkg/package-name.hxx b/libbpkg/package-name.hxx index 6c7ec6c..ecc9f3b 100644 --- a/libbpkg/package-name.hxx +++ b/libbpkg/package-name.hxx @@ -53,6 +53,22 @@ namespace bpkg std::string string () && {std::string r; r.swap (this->value_); return r;} + // Package name base and extension (without the dot). If there is no + // extension, then the base name is the same as the full name and the + // returned extension is empty. + // + std::string + base () const; + + std::string + extension () const; + + // Package name sanitized to a canonical variable name. Specifically, + // '.', '-', and '+' are replaced with '_'. + // + std::string + variable () const; + // Compare ignoring case. Note that a string is not checked to be a valid // package name. // |