19 ~PathView() =
default;
21 PathView(
const PathView& other) =
default;
22 PathView& operator=(
const PathView& other) =
default;
24 PathView(PathView&& other)
noexcept =
default;
25 PathView& operator=(PathView&& other)
noexcept =
default;
27 explicit PathView(
const std::string& s) : mSrc(s) {}
28 explicit PathView(
const char* s) : mSrc(s ? s :
"") {}
29 explicit PathView(std::string_view s) : mSrc(s) {}
31 PathView(
const Core::Path& src) : mSrc(src.getUtf8StdString()) {}
33 [[nodiscard]]
size_t size()
const {
return mSrc.size(); }
34 [[nodiscard]]
bool empty()
const {
return mSrc.empty(); }
36 [[nodiscard]] std::string_view getUtf8StringView()
const {
return mSrc; }
37 [[nodiscard]]
const char* getUtf8CString()
const {
return mSrc.data(); }
39 [[nodiscard]]
bool isAbsolute()
const {
41 if (mSrc.size() >= 2 && std::isalpha((
unsigned char)mSrc[0]) && mSrc[1] ==
':')
return true;
42 if (mSrc.size() >= 2 && mSrc[0] ==
'\\' && mSrc[1] ==
'\\')
return true;
45 return !mSrc.empty() && mSrc.front() ==
'/';
50 std::string_view mSrc;