[ox/fs] Make FileAddress constructor take a StringLiteral
This commit is contained in:
parent
9855a0bcf0
commit
b13eb0ef70
@ -65,7 +65,7 @@ class FileAddress {
|
|||||||
|
|
||||||
explicit FileAddress(char *path) noexcept;
|
explicit FileAddress(char *path) noexcept;
|
||||||
|
|
||||||
explicit constexpr FileAddress(const char *path) noexcept;
|
constexpr FileAddress(ox::StringLiteral path) noexcept;
|
||||||
|
|
||||||
constexpr ~FileAddress() noexcept;
|
constexpr ~FileAddress() noexcept;
|
||||||
|
|
||||||
@ -124,8 +124,8 @@ class FileAddress {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr FileAddress::FileAddress(const char *path) noexcept {
|
constexpr FileAddress::FileAddress(ox::StringLiteral path) noexcept {
|
||||||
m_data.constPath = path;
|
m_data.constPath = path.c_str();
|
||||||
m_type = FileAddressType::ConstPath;
|
m_type = FileAddressType::ConstPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
deps/ox/src/ox/std/stringliteral.hpp
vendored
4
deps/ox/src/ox/std/stringliteral.hpp
vendored
@ -41,6 +41,10 @@ class StringLiteral: public detail::BaseStringView {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
constexpr const char *c_str() const noexcept {
|
||||||
|
return data();
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user