fs/Traits: add GetFilenameSuffix() overload with std::string_view
This commit is contained in:
@ -92,6 +92,14 @@ struct PathTraitsFS {
|
|||||||
: nullptr;
|
: nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[gnu::pure]]
|
||||||
|
static string_view GetFilenameSuffix(string_view filename) noexcept {
|
||||||
|
const auto dot = filename.rfind('.');
|
||||||
|
return dot != filename.npos && dot > 0
|
||||||
|
? filename.substr(dot + 1)
|
||||||
|
: string_view{};
|
||||||
|
}
|
||||||
|
|
||||||
[[gnu::pure]]
|
[[gnu::pure]]
|
||||||
static const_pointer GetPathSuffix(const_pointer path) noexcept {
|
static const_pointer GetPathSuffix(const_pointer path) noexcept {
|
||||||
return GetFilenameSuffix(GetBase(path));
|
return GetFilenameSuffix(GetBase(path));
|
||||||
@ -228,6 +236,14 @@ struct PathTraitsUTF8 {
|
|||||||
: nullptr;
|
: nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[gnu::pure]]
|
||||||
|
static string_view GetFilenameSuffix(string_view filename) noexcept {
|
||||||
|
const auto dot = filename.rfind('.');
|
||||||
|
return dot != filename.npos && dot > 0
|
||||||
|
? filename.substr(dot + 1)
|
||||||
|
: string_view{};
|
||||||
|
}
|
||||||
|
|
||||||
[[gnu::pure]]
|
[[gnu::pure]]
|
||||||
static const_pointer GetPathSuffix(const_pointer path) noexcept {
|
static const_pointer GetPathSuffix(const_pointer path) noexcept {
|
||||||
return GetFilenameSuffix(GetBase(path));
|
return GetFilenameSuffix(GetBase(path));
|
||||||
|
Reference in New Issue
Block a user