[ox/fs] Make FileAddress constructor take a StringLiteral

This commit is contained in:
Gary Talent 2023-12-03 10:17:24 -06:00
parent 9855a0bcf0
commit b13eb0ef70
2 changed files with 7 additions and 3 deletions

View File

@ -65,7 +65,7 @@ class FileAddress {
explicit FileAddress(char *path) noexcept;
explicit constexpr FileAddress(const char *path) noexcept;
constexpr FileAddress(ox::StringLiteral path) noexcept;
constexpr ~FileAddress() noexcept;
@ -124,8 +124,8 @@ class FileAddress {
};
constexpr FileAddress::FileAddress(const char *path) noexcept {
m_data.constPath = path;
constexpr FileAddress::FileAddress(ox::StringLiteral path) noexcept {
m_data.constPath = path.c_str();
m_type = FileAddressType::ConstPath;
}

View File

@ -41,6 +41,10 @@ class StringLiteral: public detail::BaseStringView {
return *this;
}
[[nodiscard]]
constexpr const char *c_str() const noexcept {
return data();
}
};