[ox/std] Make assert functions take StringViews instead of C strings
This commit is contained in:
parent
1a7e551025
commit
b6f86551e9
10
deps/ox/src/ox/std/assert.hpp
vendored
10
deps/ox/src/ox/std/assert.hpp
vendored
@ -22,9 +22,9 @@
|
||||
|
||||
namespace ox {
|
||||
|
||||
void panic(const char *file, int line, const char *panicMsg, const Error &err = OxError(0)) noexcept;
|
||||
void panic(CRStringView file, int line, CRStringView panicMsg, const Error &err = OxError(0)) noexcept;
|
||||
|
||||
constexpr void constexprPanic(const char *file, int line, const char *panicMsg, const Error &err = OxError(0)) noexcept {
|
||||
constexpr void constexprPanic(CRStringView file, int line, CRStringView panicMsg, const Error &err = OxError(0)) noexcept {
|
||||
if (!std::is_constant_evaluated()) {
|
||||
panic(file, line, panicMsg, err);
|
||||
} else {
|
||||
@ -32,7 +32,7 @@ constexpr void constexprPanic(const char *file, int line, const char *panicMsg,
|
||||
}
|
||||
}
|
||||
|
||||
constexpr void assertFunc(const char *file, int line, bool pass, [[maybe_unused]]const char *assertTxt, [[maybe_unused]]const char *msg) noexcept {
|
||||
constexpr void assertFunc(CRStringView file, int line, bool pass, [[maybe_unused]]CRStringView assertTxt, [[maybe_unused]]CRStringView msg) noexcept {
|
||||
if (!pass) {
|
||||
if (!std::is_constant_evaluated()) {
|
||||
#ifdef OX_USE_STDLIB
|
||||
@ -51,7 +51,7 @@ constexpr void assertFunc(const char *file, int line, bool pass, [[maybe_unused]
|
||||
}
|
||||
}
|
||||
|
||||
constexpr void assertFunc(const char *file, int line, const Error &err, const char*, const char *assertMsg) noexcept {
|
||||
constexpr void assertFunc(CRStringView file, int line, const Error &err, CRStringView, CRStringView assertMsg) noexcept {
|
||||
if (err) {
|
||||
if (!std::is_constant_evaluated()) {
|
||||
#if defined(OX_USE_STDLIB)
|
||||
@ -75,7 +75,7 @@ constexpr void assertFunc(const char *file, int line, const Error &err, const ch
|
||||
}
|
||||
}
|
||||
|
||||
constexpr void expect(const char *file, int line, const auto &actual, const auto &expected) noexcept {
|
||||
constexpr void expect(CRStringView file, int line, const auto &actual, const auto &expected) noexcept {
|
||||
if (actual != expected) {
|
||||
if (!std::is_constant_evaluated()) {
|
||||
#if defined(OX_USE_STDLIB)
|
||||
|
Loading…
Reference in New Issue
Block a user