Squashed 'deps/nostalgia/' changes from f847289b..671b8eda

671b8eda [ox/std] Make StringLiteral constructors consteval
952637a1 Merge commit 'cbf4414fcaf00c00a2abf73b5c04a055180ad980'
7569698e [nostalgia,studio] Add FileExts_TileSheet const, and corresponding FilePickerPopup constructor
21713ba9 [ox/std] Fix StringLiteral::operator= to work with DevkitARM
73273b6f [nostalgia/gfx] Add isTileSheet function for checking paths against both file extensions
9f040392 [olympic,nostalgia] Cleanup style
f4f7e5d0 Merge commit '9b5f7886cadc5c3dc826d00fa5b2e71696151dfd'
c27726a4 Merge commit '6bbcae10cc7b21b73171ec0ff196f4baf6304404'
bd24a775 Merge commit '7371df429534f264c179684412f6197f7968ebfa'
4419dff2 Merge commit '7688c05bac8c20bc267cae62ec78d55e5d0c493b'
536999c0 Merge commit '47eee1d56d591e3631d16e95a78ea3629ee312ee'
a5535ef5 Merge commit '08236fc790e711afe886b6ef545511d35e4e5c6c'
a90380f3 Merge commit 'e90dd887477452922f783535edb3d4c55e9a0d2c'
2000b2de [nostalgia/gfx/studio] Cleanup
7d92400f [nostalgia/gfx/studio] Add type specific navigateTo functions

git-subtree-dir: deps/nostalgia
git-subtree-split: 671b8edaadefe1872fb8954ad13d221b24f676c0
This commit is contained in:
2025-06-29 17:33:27 -05:00
parent 9b5f7886ca
commit b0726568df
36 changed files with 159 additions and 114 deletions

View File

@ -16,35 +16,28 @@ namespace ox {
* StringLiteral is used for functions that want to ensure that they are taking
* string literals, and not strings outside of the data section of the program
* that might get deleted.
* This type cannot force you to use it correctly, so don't give it something
* that is not a literal.
* If you do this:
* StringLiteral(str.c_str())
* the resulting segfault is on you.
*/
class StringLiteral: public detail::BaseStringView {
public:
constexpr StringLiteral() noexcept = default;
consteval StringLiteral() noexcept = default;
constexpr StringLiteral(StringLiteral const&sv) noexcept = default;
constexpr StringLiteral(StringLiteral const &sv) noexcept = default;
constexpr explicit StringLiteral(std::nullptr_t) noexcept {}
consteval explicit StringLiteral(std::nullptr_t) noexcept {}
constexpr explicit StringLiteral(const char *str, std::size_t len) noexcept: BaseStringView(str, len) {}
consteval explicit StringLiteral(char const *str, std::size_t const len) noexcept: BaseStringView{str, len} {}
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
constexpr explicit StringLiteral(char const *str) noexcept: StringLiteral(str, ox::strlen(str)) {}
consteval explicit StringLiteral(char const *str) noexcept: StringLiteral{str, ox::strlen(str)} {}
OX_ALLOW_UNSAFE_BUFFERS_END
constexpr StringLiteral &operator=(StringLiteral const&other) noexcept {
if (&other != this) {
set(other.data(), other.len());
}
constexpr StringLiteral &operator=(StringLiteral const &other) noexcept {
set(other.data(), other.len());
return *this;
}
[[nodiscard]]
constexpr const char *c_str() const noexcept {
constexpr char const *c_str() const noexcept {
return data();
}