fs/Path: add operator+
This commit is contained in:
parent
150e8f78bf
commit
c344403bed
@ -85,6 +85,18 @@ public:
|
||||
return Path::FromFS(c_str());
|
||||
}
|
||||
|
||||
/**
|
||||
* Concatenate two paths.
|
||||
*/
|
||||
[[gnu::pure]]
|
||||
static AllocatedPath Concat(string_view a, string_view b) noexcept {
|
||||
AllocatedPath result{nullptr};
|
||||
result.value.reserve(a.size() + b.size());
|
||||
result.value.assign(a);
|
||||
result.value.append(b);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Join two path components with the path separator.
|
||||
*/
|
||||
|
@ -191,6 +191,13 @@ public:
|
||||
const_pointer GetExtension() const noexcept;
|
||||
};
|
||||
|
||||
/**
|
||||
* Concatenate a string to a #Path object.
|
||||
*/
|
||||
[[gnu::pure]]
|
||||
AllocatedPath
|
||||
operator+(Path path, PathTraitsFS::string_view other) noexcept;
|
||||
|
||||
/**
|
||||
* Concatenate two path components using the directory separator.
|
||||
*
|
||||
|
@ -34,6 +34,12 @@ Path::WithSuffix(const_pointer new_suffix) const noexcept
|
||||
return result;
|
||||
}
|
||||
|
||||
AllocatedPath
|
||||
operator+(Path a, PathTraitsFS::string_view b) noexcept
|
||||
{
|
||||
return AllocatedPath::Concat(a.c_str(), b);
|
||||
}
|
||||
|
||||
AllocatedPath
|
||||
operator/(Path a, Path b) noexcept
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user