diff --git a/deps/ox/src/ox/clargs/clargs.cpp b/deps/ox/src/ox/clargs/clargs.cpp index 9acdecbb..c6edb9c8 100644 --- a/deps/ox/src/ox/clargs/clargs.cpp +++ b/deps/ox/src/ox/clargs/clargs.cpp @@ -27,7 +27,7 @@ ClArgs::ClArgs(int argc, const char **args) noexcept { m_bools[arg] = false; } m_strings[arg] = val; - if (auto r = ox_atoi(val.c_str()); r.error == 0) { + if (auto r = ox::atoi(val.c_str()); r.error == 0) { m_ints[arg] = r.value; } ++i; diff --git a/deps/ox/src/ox/claw/read.cpp b/deps/ox/src/ox/claw/read.cpp index 2df7a1a9..9506cead 100644 --- a/deps/ox/src/ox/claw/read.cpp +++ b/deps/ox/src/ox/claw/read.cpp @@ -13,7 +13,7 @@ namespace ox { Result readClawHeader(const char *buff, std::size_t buffLen) noexcept { - const auto s1End = ox_strchr(buff, ';', buffLen); + const auto s1End = ox::strchr(buff, ';', buffLen); if (!s1End) { return OxError(1, "Could not read Claw header"); } @@ -22,7 +22,7 @@ Result readClawHeader(const char *buff, std::size_t buffLen) noexcep buff += s1Size + 1; buffLen -= s1Size + 1; - const auto s2End = ox_strchr(buff, ';', buffLen); + const auto s2End = ox::strchr(buff, ';', buffLen); if (!s2End) { return OxError(2, "Could not read Claw header"); } @@ -31,7 +31,7 @@ Result readClawHeader(const char *buff, std::size_t buffLen) noexcep buff += s2Size + 1; buffLen -= s2Size + 1; - const auto s3End = ox_strchr(buff, ';', buffLen); + const auto s3End = ox::strchr(buff, ';', buffLen); if (!s3End) { return OxError(3, "Could not read Claw header"); } @@ -49,7 +49,7 @@ Result readClawHeader(const char *buff, std::size_t buffLen) noexcep return OxError(4, "Claw format does not match any supported format/version combo"); } hdr.typeName = typeName; - if (auto r = ox_atoi(versionStr.c_str()); r.error == 0) { + if (auto r = ox::atoi(versionStr.c_str()); r.error == 0) { hdr.typeVersion = r.value; } hdr.data = buff; diff --git a/deps/ox/src/ox/claw/write.hpp b/deps/ox/src/ox/claw/write.hpp index e8ec3bf0..f2d45dcb 100644 --- a/deps/ox/src/ox/claw/write.hpp +++ b/deps/ox/src/ox/claw/write.hpp @@ -88,7 +88,7 @@ ox::Error writeClawHeader(Writer_c auto &writer, const T *t, ClawFormat fmt) noe oxReturnError(writer.put(';')); const auto tn = detail::getTypeVersion(t); if (tn > -1) { - oxReturnError(ox::itoa(tn, writer)); + oxReturnError(ox::writeItoa(tn, writer)); } oxReturnError(writer.put(';')); return {}; diff --git a/deps/ox/src/ox/fs/filesystem/directory.hpp b/deps/ox/src/ox/fs/filesystem/directory.hpp index 10407529..ed67b75f 100644 --- a/deps/ox/src/ox/fs/filesystem/directory.hpp +++ b/deps/ox/src/ox/fs/filesystem/directory.hpp @@ -48,7 +48,7 @@ struct OX_PACKED DirectoryEntry { auto d = data(); if (d.valid()) { d->inode = inode; - ox_strncpy(d->name, name, ox::min(bufferSize, static_cast(MaxFileNameLength))); + ox::strncpy(d->name, name, ox::min(bufferSize, static_cast(MaxFileNameLength))); return OxError(0); } return OxError(1); diff --git a/deps/ox/src/ox/fs/filesystem/filelocation.cpp b/deps/ox/src/ox/fs/filesystem/filelocation.cpp index 88f9ee21..72238e01 100644 --- a/deps/ox/src/ox/fs/filesystem/filelocation.cpp +++ b/deps/ox/src/ox/fs/filesystem/filelocation.cpp @@ -46,7 +46,7 @@ FileAddress &FileAddress::operator=(const FileAddress &other) noexcept { case FileAddressType::Path: { if (other.m_data.path) { - auto strSize = ox_strlen(other.m_data.path) + 1; + auto strSize = ox::strlen(other.m_data.path) + 1; m_data.path = new char[strSize]; ox_memcpy(m_data.path, other.m_data.path, strSize); } else { diff --git a/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp b/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp index d9cd254a..e600e1be 100644 --- a/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp +++ b/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp @@ -186,7 +186,7 @@ Error PassThroughFS::writeFileInode(uint64_t, const void*, uint64_t, FileType) n } std::string_view PassThroughFS::stripSlash(StringView path) noexcept { - const auto pathLen = ox_strlen(path); + const auto pathLen = ox::strlen(path); for (auto i = 0u; i < pathLen && path[0] == '/'; i++) { path = substr(path, 1); } diff --git a/deps/ox/src/ox/fs/filesystem/pathiterator.cpp b/deps/ox/src/ox/fs/filesystem/pathiterator.cpp index d6edf192..87885d61 100644 --- a/deps/ox/src/ox/fs/filesystem/pathiterator.cpp +++ b/deps/ox/src/ox/fs/filesystem/pathiterator.cpp @@ -19,7 +19,7 @@ PathIterator::PathIterator(const char *path, std::size_t maxSize, std::size_t it m_iterator = iterator; } -PathIterator::PathIterator(const char *path): PathIterator(path, ox_strlen(path)) { +PathIterator::PathIterator(const char *path): PathIterator(path, ox::strlen(path)) { } PathIterator::PathIterator(CRStringView path): PathIterator(path.data(), path.bytes()) { @@ -29,10 +29,10 @@ PathIterator::PathIterator(CRStringView path): PathIterator(path.data(), path.by * @return 0 if no error */ Error PathIterator::dirPath(char *out, std::size_t outSize) { - const auto idx = ox_lastIndexOf(m_path, '/', m_maxSize); + const auto idx = ox::lastIndexOf(m_path, '/', m_maxSize); const auto size = static_cast(idx + 1); if (idx >= 0 && size < outSize) { - ox_memcpy(out, m_path, size); + ox::memcpy(out, m_path, size); out[size] = 0; return OxError(0); } else { @@ -44,12 +44,12 @@ Error PathIterator::dirPath(char *out, std::size_t outSize) { * @return 0 if no error */ Error PathIterator::fileName(char *out, std::size_t outSize) { - auto idx = ox_lastIndexOf(m_path, '/', m_maxSize); + auto idx = ox::lastIndexOf(m_path, '/', m_maxSize); if (idx >= 0) { idx++; // pass up the preceding / - std::size_t fileNameSize = static_cast(ox_strlen(&m_path[idx])); + std::size_t fileNameSize = static_cast(ox::strlen(&m_path[idx])); if (fileNameSize < outSize) { - ox_memcpy(out, &m_path[idx], fileNameSize); + ox::memcpy(out, &m_path[idx], fileNameSize); out[fileNameSize] = 0; return OxError(0); } else { @@ -67,8 +67,8 @@ Error PathIterator::get(char *pathOut, std::size_t pathOutSize) { oxTracef("ox.fs.PathIterator.get", "m_iterator ({}) >= m_maxSize ({})", m_iterator, m_maxSize); return OxError(1); } - if (!ox_strlen(&m_path[m_iterator])) { - oxTrace("ox.fs.PathIterator.get", "!ox_strlen(&m_path[m_iterator])"); + if (!ox::strlen(&m_path[m_iterator])) { + oxTrace("ox.fs.PathIterator.get", "!ox::strlen(&m_path[m_iterator])"); return OxError(1); } auto start = m_iterator; @@ -76,10 +76,10 @@ Error PathIterator::get(char *pathOut, std::size_t pathOutSize) { start++; } // end is at the next / - const char *substr = ox_strchr(&m_path[start], '/', m_maxSize - start); + const char *substr = ox::strchr(&m_path[start], '/', m_maxSize - start); // correct end if it is invalid, which happens if there is no next / if (!substr) { - substr = ox_strchr(&m_path[start], 0, m_maxSize - start); + substr = ox::strchr(&m_path[start], 0, m_maxSize - start); } const auto end = static_cast(substr - m_path); size = end - start; @@ -87,7 +87,7 @@ Error PathIterator::get(char *pathOut, std::size_t pathOutSize) { if (size >= pathOutSize || size == 0) { return OxError(1); } - ox_memcpy(pathOut, &m_path[start], size); + ox::memcpy(pathOut, &m_path[start], size); // truncate trailing / if (size && pathOut[size - 1] == '/') { size--; @@ -100,17 +100,17 @@ Error PathIterator::get(char *pathOut, std::size_t pathOutSize) { Error PathIterator::next(char *pathOut, std::size_t pathOutSize) { std::size_t size = 0; auto retval = OxError(1); - if (m_iterator < m_maxSize && ox_strlen(&m_path[m_iterator])) { + if (m_iterator < m_maxSize && ox::strlen(&m_path[m_iterator])) { retval = OxError(0); if (m_path[m_iterator] == '/') { m_iterator++; } const auto start = m_iterator; // end is at the next / - const char *substr = ox_strchr(&m_path[start], '/', m_maxSize - start); + const char *substr = ox::strchr(&m_path[start], '/', m_maxSize - start); // correct end if it is invalid, which happens if there is no next / if (!substr) { - substr = ox_strchr(&m_path[start], 0, m_maxSize - start); + substr = ox::strchr(&m_path[start], 0, m_maxSize - start); } const auto end = static_cast(substr - m_path); size = end - start; @@ -118,7 +118,7 @@ Error PathIterator::next(char *pathOut, std::size_t pathOutSize) { if (size >= pathOutSize) { return OxError(1); } - ox_memcpy(pathOut, &m_path[start], size); + ox::memcpy(pathOut, &m_path[start], size); } // truncate trailing / if (size && pathOut[size - 1] == '/') { @@ -147,17 +147,17 @@ Result PathIterator::nextSize() const { std::size_t size = 0; auto retval = OxError(1); auto it = m_iterator; - if (it < m_maxSize && ox_strlen(&m_path[it])) { + if (it < m_maxSize && ox::strlen(&m_path[it])) { retval = OxError(0); if (m_path[it] == '/') { it++; } const auto start = it; // end is at the next / - const char *substr = ox_strchr(&m_path[start], '/', m_maxSize - start); + const char *substr = ox::strchr(&m_path[start], '/', m_maxSize - start); // correct end if it is invalid, which happens if there is no next / if (!substr) { - substr = ox_strchr(&m_path[start], 0, m_maxSize - start); + substr = ox::strchr(&m_path[start], 0, m_maxSize - start); } const auto end = static_cast(substr - m_path); size = end - start; @@ -168,16 +168,16 @@ Result PathIterator::nextSize() const { bool PathIterator::hasNext() const { std::size_t size = 0; - if (m_iterator < m_maxSize && ox_strlen(&m_path[m_iterator])) { + if (m_iterator < m_maxSize && ox::strlen(&m_path[m_iterator])) { std::size_t start = m_iterator; if (m_path[start] == '/') { start++; } // end is at the next / - const char *substr = ox_strchr(&m_path[start], '/', m_maxSize - start); + const char *substr = ox::strchr(&m_path[start], '/', m_maxSize - start); // correct end if it is invalid, which happens if there is no next / if (!substr) { - substr = ox_strchr(&m_path[start], 0, m_maxSize - start); + substr = ox::strchr(&m_path[start], 0, m_maxSize - start); } const auto end = static_cast(substr - m_path); size = end - start; @@ -192,16 +192,16 @@ bool PathIterator::valid() const { PathIterator PathIterator::next() const { std::size_t size = 0; auto iterator = m_iterator; - if (iterator < m_maxSize && ox_strlen(&m_path[iterator])) { + if (iterator < m_maxSize && ox::strlen(&m_path[iterator])) { if (m_path[iterator] == '/') { iterator++; } const auto start = iterator; // end is at the next / - const char *substr = ox_strchr(&m_path[start], '/', m_maxSize - start); + const char *substr = ox::strchr(&m_path[start], '/', m_maxSize - start); // correct end if it is invalid, which happens if there is no next / if (!substr) { - substr = ox_strchr(&m_path[start], 0, m_maxSize - start); + substr = ox::strchr(&m_path[start], 0, m_maxSize - start); } const auto end = static_cast(substr - m_path); size = end - start; diff --git a/deps/ox/src/ox/fs/test/tests.cpp b/deps/ox/src/ox/fs/test/tests.cpp index be6fdb2c..154b0e0a 100644 --- a/deps/ox/src/ox/fs/test/tests.cpp +++ b/deps/ox/src/ox/fs/test/tests.cpp @@ -61,9 +61,9 @@ const std::map> tests = auto const path = ox::String("/usr/share/charset.gbag"); ox::PathIterator it(path.c_str(), path.len()); auto buff = static_cast(ox_alloca(path.len() + 1)); - oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "usr") == 0, "PathIterator shows wrong next"); - oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "share") == 0, "PathIterator shows wrong next"); - oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "charset.gbag") == 0, "PathIterator shows wrong next"); + oxAssert(it.next(buff, path.len()) == 0 && ox::strcmp(buff, "usr") == 0, "PathIterator shows wrong next"); + oxAssert(it.next(buff, path.len()) == 0 && ox::strcmp(buff, "share") == 0, "PathIterator shows wrong next"); + oxAssert(it.next(buff, path.len()) == 0 && ox::strcmp(buff, "charset.gbag") == 0, "PathIterator shows wrong next"); return OxError(0); } }, @@ -73,8 +73,8 @@ const std::map> tests = auto const path = ox::String("/usr/share/"); ox::PathIterator it(path.c_str(), path.len()); auto buff = static_cast(ox_alloca(path.len() + 1)); - oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "usr") == 0, "PathIterator shows wrong next"); - oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "share") == 0, "PathIterator shows wrong next"); + oxAssert(it.next(buff, path.len()) == 0 && ox::strcmp(buff, "usr") == 0, "PathIterator shows wrong next"); + oxAssert(it.next(buff, path.len()) == 0 && ox::strcmp(buff, "share") == 0, "PathIterator shows wrong next"); return OxError(0); } }, @@ -84,7 +84,7 @@ const std::map> tests = auto const path = ox::String("/"); ox::PathIterator it(path.c_str(), path.len()); auto buff = static_cast(ox_alloca(path.len() + 1)); - oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "\0") == 0, "PathIterator shows wrong next"); + oxAssert(it.next(buff, path.len()) == 0 && ox::strcmp(buff, "\0") == 0, "PathIterator shows wrong next"); return OxError(0); } }, @@ -94,9 +94,9 @@ const std::map> tests = auto const path = ox::String("usr/share/charset.gbag"); ox::PathIterator it(path.c_str(), path.len()); auto buff = static_cast(ox_alloca(path.len() + 1)); - oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "usr") == 0, "PathIterator shows wrong next"); - oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "share") == 0, "PathIterator shows wrong next"); - oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "charset.gbag") == 0, "PathIterator shows wrong next"); + oxAssert(it.next(buff, path.len()) == 0 && ox::strcmp(buff, "usr") == 0, "PathIterator shows wrong next"); + oxAssert(it.next(buff, path.len()) == 0 && ox::strcmp(buff, "share") == 0, "PathIterator shows wrong next"); + oxAssert(it.next(buff, path.len()) == 0 && ox::strcmp(buff, "charset.gbag") == 0, "PathIterator shows wrong next"); return OxError(0); } }, @@ -106,8 +106,8 @@ const std::map> tests = auto const path = ox::String("usr/share/"); ox::PathIterator it(path.c_str(), path.len()); auto buff = static_cast(ox_alloca(path.len() + 1)); - oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "usr") == 0, "PathIterator shows wrong next"); - oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "share") == 0, "PathIterator shows wrong next"); + oxAssert(it.next(buff, path.len()) == 0 && ox::strcmp(buff, "usr") == 0, "PathIterator shows wrong next"); + oxAssert(it.next(buff, path.len()) == 0 && ox::strcmp(buff, "share") == 0, "PathIterator shows wrong next"); return OxError(0); } }, @@ -117,7 +117,7 @@ const std::map> tests = auto const path = ox::String("/usr/share/charset.gbag"); ox::PathIterator it(path.c_str(), path.len()); auto buff = static_cast(ox_alloca(path.len() + 1)); - oxAssert(it.dirPath(buff, path.len()) == 0 && ox_strcmp(buff, "/usr/share/") == 0, "PathIterator shows incorrect dir path"); + oxAssert(it.dirPath(buff, path.len()) == 0 && ox::strcmp(buff, "/usr/share/") == 0, "PathIterator shows incorrect dir path"); return OxError(0); } }, @@ -127,7 +127,7 @@ const std::map> tests = auto const path = ox::String("/usr/share/charset.gbag"); ox::PathIterator it(path.c_str(), path.len()); auto buff = static_cast(ox_alloca(path.len() + 1)); - oxAssert(it.fileName(buff, path.len()) == 0 && ox_strcmp(buff, "charset.gbag") == 0, "PathIterator shows incorrect file name"); + oxAssert(it.fileName(buff, path.len()) == 0 && ox::strcmp(buff, "charset.gbag") == 0, "PathIterator shows incorrect file name"); return OxError(0); } }, @@ -135,7 +135,7 @@ const std::map> tests = "PathIterator::hasNext", [](ox::StringView) { const auto path = "/file1"; - ox::PathIterator it(path, ox_strlen(path)); + ox::PathIterator it(path, ox::strlen(path)); oxAssert(it.hasNext(), "PathIterator shows incorrect hasNext"); oxAssert(!it.next().hasNext(), "PathIterator shows incorrect hasNext"); return OxError(0); @@ -171,9 +171,9 @@ const std::map> tests = [](ox::StringView) { constexpr auto buffLen = 5000; constexpr auto str1 = "Hello, World!"; - constexpr auto str1Len = ox_strlen(str1) + 1; + constexpr auto str1Len = ox::strlen(str1) + 1; constexpr auto str2 = "Hello, Moon!"; - constexpr auto str2Len = ox_strlen(str2) + 1; + constexpr auto str2Len = ox::strlen(str2) + 1; auto list = new (ox_alloca(buffLen)) ox::ptrarith::NodeBuffer>(buffLen); oxAssert(ox::FileStore32::format(list, buffLen), "FileStore::format failed."); ox::FileStore32 fileStore(list, buffLen); diff --git a/deps/ox/src/ox/mc/write.hpp b/deps/ox/src/ox/mc/write.hpp index 8eb94808..b3453b6d 100644 --- a/deps/ox/src/ox/mc/write.hpp +++ b/deps/ox/src/ox/mc/write.hpp @@ -214,7 +214,7 @@ template constexpr Error MetalClawWriter::fieldCString(const char*, const char *const*val, std::size_t) noexcept { bool fieldSet = false; if (!m_unionIdx.has_value() || *m_unionIdx == m_field) { - const auto strLen = *val ? ox_strlen(*val) : 0; + const auto strLen = *val ? ox::strlen(*val) : 0; // write the length const auto strLenBuff = mc::encodeInteger(strLen); oxReturnError(m_writer.write(reinterpret_cast(strLenBuff.data), strLenBuff.length)); diff --git a/deps/ox/src/ox/oc/read.cpp b/deps/ox/src/ox/oc/read.cpp index 33a7d057..a6d634f5 100644 --- a/deps/ox/src/ox/oc/read.cpp +++ b/deps/ox/src/ox/oc/read.cpp @@ -15,7 +15,7 @@ namespace ox { OrganicClawReader::OrganicClawReader(const uint8_t *buff, std::size_t buffSize) { auto json = reinterpret_cast(buff); - auto jsonLen = ox_strnlen(json, buffSize); + auto jsonLen = ox::strnlen(json, buffSize); Json::CharReaderBuilder parserBuilder; auto parser = std::unique_ptr(parserBuilder.newCharReader()); if (!parser->parse(json, json + jsonLen, &m_json, nullptr)) { @@ -198,7 +198,7 @@ Error OrganicClawReader::fieldCString(const char *key, char *val, std::size_t bu if (strSize >= buffLen) { err = OxError(2, "String size exceeds capacity of destination"); } else { - ox_memcpy(data, begin, static_cast(strSize)); + ox::memcpy(data, begin, static_cast(strSize)); data[strSize] = 0; } } else { @@ -224,7 +224,7 @@ Error OrganicClawReader::fieldCString(const char *key, char **val) noexcept { const auto strSize = static_cast(end - begin); safeDelete(*val); *val = new char[strSize + 1]; - ox_memcpy(data, begin, static_cast(strSize)); + ox::memcpy(data, begin, static_cast(strSize)); data[strSize] = 0; } else { err = OxError(1, "Type mismatch"); @@ -242,7 +242,7 @@ Error OrganicClawReader::fieldCString(const char *key, char **val, std::size_t b if (jv.empty()) { auto data = val; if (data) { - data[0] = 0; + data[0] = nullptr; } } else if (jv.isString()) { jv.getString(&begin, &end); @@ -252,8 +252,8 @@ Error OrganicClawReader::fieldCString(const char *key, char **val, std::size_t b safeDelete(*val); *val = new char[strSize + 1]; } - ox_memcpy(data, begin, static_cast(strSize)); - data[strSize] = 0; + ox::memcpy(data, begin, static_cast(strSize)); + data[strSize] = nullptr; } else { err = OxError(1, "Type mismatch"); } diff --git a/deps/ox/src/ox/oc/read.hpp b/deps/ox/src/ox/oc/read.hpp index 5c16ff72..15ecb7e6 100644 --- a/deps/ox/src/ox/oc/read.hpp +++ b/deps/ox/src/ox/oc/read.hpp @@ -274,7 +274,7 @@ Result readOC(const char *json, std::size_t jsonLen) noexcept { template Result readOC(const char *json) noexcept { - return readOC(json, ox_strlen(json)); + return readOC(json, ox::strlen(json)); } template diff --git a/deps/ox/src/ox/oc/write.cpp b/deps/ox/src/ox/oc/write.cpp index 024e3545..ddec2ce4 100644 --- a/deps/ox/src/ox/oc/write.cpp +++ b/deps/ox/src/ox/oc/write.cpp @@ -27,7 +27,7 @@ Error OrganicClawWriter::fieldCString(const char *key, const char *const*val, in } Error OrganicClawWriter::fieldCString(const char *key, const char *const*val) noexcept { - return fieldCString(key, const_cast(val), static_cast(ox_strlen(val))); + return fieldCString(key, const_cast(val), static_cast(ox::strlen(val))); } Error OrganicClawWriter::field(const char *key, const UUID *uuid) noexcept { diff --git a/deps/ox/src/ox/std/CMakeLists.txt b/deps/ox/src/ox/std/CMakeLists.txt index 07b965bc..73c00578 100644 --- a/deps/ox/src/ox/std/CMakeLists.txt +++ b/deps/ox/src/ox/std/CMakeLists.txt @@ -105,6 +105,7 @@ install( heapmgr.hpp iterator.hpp math.hpp + maybeview.hpp memops.hpp memory.hpp new.hpp diff --git a/deps/ox/src/ox/std/basestringview.hpp b/deps/ox/src/ox/std/basestringview.hpp index e4ed55ce..b111f0e1 100644 --- a/deps/ox/src/ox/std/basestringview.hpp +++ b/deps/ox/src/ox/std/basestringview.hpp @@ -131,7 +131,7 @@ class BaseStringView { constexpr explicit BaseStringView(std::nullptr_t) noexcept {} - constexpr explicit BaseStringView(const char *str) noexcept: m_str(str), m_len(str ? ox_strlen(str) : 0) {} + constexpr explicit BaseStringView(const char *str) noexcept: m_str(str), m_len(str ? ox::strlen(str) : 0) {} constexpr explicit BaseStringView(const char *str, std::size_t len) noexcept: m_str(str), m_len(len) {} diff --git a/deps/ox/src/ox/std/bstring.hpp b/deps/ox/src/ox/std/bstring.hpp index 1dd5ada5..7a450ede 100644 --- a/deps/ox/src/ox/std/bstring.hpp +++ b/deps/ox/src/ox/std/bstring.hpp @@ -109,7 +109,7 @@ constexpr BString::BString(const char *str) noexcept: m_buff{{0}} { template constexpr BString &BString::operator=(Integer_c auto i) noexcept { char str[65] = {}; - ox_itoa(i, str); + ox::itoa(i, str); return this->operator=(str); } @@ -127,7 +127,7 @@ constexpr BString &BString::operator=(ox::CRStringView str) noexcept template constexpr BString &BString::operator=(const char *str) noexcept { - std::size_t strLen = ox_strlen(str) + 1; + std::size_t strLen = ox::strlen(str) + 1; if (cap() < strLen) { strLen = cap(); } @@ -144,7 +144,7 @@ constexpr BString &BString::operator=(char *str) noexcept { template constexpr BString &BString::operator+=(const char *str) noexcept { - std::size_t strLen = ox_strlen(str) + 1; + std::size_t strLen = ox::strlen(str) + 1; oxIgnoreError(append(str, strLen)); return *this; } @@ -157,7 +157,7 @@ constexpr BString &BString::operator+=(char *str) noexcept { template constexpr BString &BString::operator+=(Integer_c auto i) noexcept { char str[65] = {}; - ox_itoa(i, str); + ox::itoa(i, str); return this->operator+=(str); } @@ -171,7 +171,7 @@ constexpr BString &BString::operator+=(StringView s) noexcept { template constexpr BString BString::operator+(const char *str) const noexcept { auto out = *this; - std::size_t strLen = ox_strlen(str) + 1; + std::size_t strLen = ox::strlen(str) + 1; oxIgnoreError(out.append(str, strLen)); return out; } @@ -184,7 +184,7 @@ constexpr BString BString::operator+(char *str) const noexcept { template constexpr BString BString::operator+(Integer_c auto i) const noexcept { char str[65] = {}; - ox_itoa(i, str); + ox::itoa(i, str); return this->operator+(str); } @@ -226,7 +226,7 @@ constexpr Error BString::append(const char *str, std::size_t strLen) no strLen = cap() - currentLen; err = OxError(1, "Insufficient space for full string"); } - ox_strncpy(m_buff + currentLen, str, strLen); + ox::strncpy(m_buff + currentLen, str, strLen); // make sure last element is a null terminator m_buff[currentLen + strLen] = 0; return err; diff --git a/deps/ox/src/ox/std/cstrops.hpp b/deps/ox/src/ox/std/cstrops.hpp index d0d26ffe..4b5b02c1 100644 --- a/deps/ox/src/ox/std/cstrops.hpp +++ b/deps/ox/src/ox/std/cstrops.hpp @@ -11,8 +11,10 @@ #include "types.hpp" #include "typetraits.hpp" +namespace ox { + template -constexpr T1 ox_strncpy(T1 dest, T2 src, std::size_t maxLen) noexcept { +constexpr T1 strncpy(T1 dest, T2 src, std::size_t maxLen) noexcept { using T1Type = typename ox::remove_reference::type; std::size_t i = 0; while (i < maxLen && src[i]) { @@ -25,7 +27,7 @@ constexpr T1 ox_strncpy(T1 dest, T2 src, std::size_t maxLen) noexcept { } [[nodiscard]] -constexpr auto ox_strnlen(const char *str1, std::size_t maxLen) noexcept { +constexpr auto strnlen(const char *str1, std::size_t maxLen) noexcept { std::size_t len = 0; for (; len < maxLen && str1[len]; len++); return len; @@ -33,7 +35,7 @@ constexpr auto ox_strnlen(const char *str1, std::size_t maxLen) noexcept { template [[nodiscard]] -constexpr auto ox_strlen(T const&str1) noexcept { +constexpr auto strlen(T const&str1) noexcept { std::size_t len = 0; for (; str1[len]; len++); return len; @@ -41,7 +43,7 @@ constexpr auto ox_strlen(T const&str1) noexcept { template [[nodiscard]] -constexpr int ox_strcmp(const T1 &str1, const T2 &str2) noexcept { +constexpr int strcmp(const T1 &str1, const T2 &str2) noexcept { auto retval = 0; auto i = 0u; while (str1[i] || str2[i]) { @@ -59,7 +61,7 @@ constexpr int ox_strcmp(const T1 &str1, const T2 &str2) noexcept { template [[nodiscard]] -constexpr int ox_strncmp(T1 const&str1, T2 const&str2, const std::size_t maxLen) noexcept { +constexpr int strncmp(T1 const&str1, T2 const&str2, const std::size_t maxLen) noexcept { auto retval = 0; std::size_t i = 0; while (i < maxLen && (str1[i] || str2[i])) { @@ -76,7 +78,7 @@ constexpr int ox_strncmp(T1 const&str1, T2 const&str2, const std::size_t maxLen) } [[nodiscard]] -constexpr const char *ox_strchr(const char *str, int character, std::size_t maxLen = 0xFFFFFFFF) noexcept { +constexpr const char *strchr(const char *str, int character, std::size_t maxLen = 0xFFFFFFFF) noexcept { for (std::size_t i = 0; i <= maxLen; i++) { if (str[i] == character) { return &str[i]; @@ -88,7 +90,7 @@ constexpr const char *ox_strchr(const char *str, int character, std::size_t maxL } [[nodiscard]] -constexpr char *ox_strchr(char *str, int character, std::size_t maxLen = 0xFFFFFFFF) noexcept { +constexpr char *strchr(char *str, int character, std::size_t maxLen = 0xFFFFFFFF) noexcept { for (std::size_t i = 0; i < maxLen; i++) { if (str[i] == character) { return &str[i]; @@ -100,7 +102,7 @@ constexpr char *ox_strchr(char *str, int character, std::size_t maxLen = 0xFFFFF } [[nodiscard]] -constexpr int ox_lastIndexOf(const auto &str, int character, std::size_t maxLen = 0xFFFFFFFF) noexcept { +constexpr int lastIndexOf(const auto &str, int character, std::size_t maxLen = 0xFFFFFFFF) noexcept { int retval = -1; for (std::size_t i = 0; i < maxLen && str[i]; i++) { if (str[i] == character) { @@ -111,7 +113,7 @@ constexpr int ox_lastIndexOf(const auto &str, int character, std::size_t maxLen } template -constexpr T ox_itoa(Integer v, T str) noexcept { +constexpr T itoa(Integer v, T str) noexcept { if (v) { ox::ResizedInt_t mod = 1000000000000000000; ox::ResizedInt_t val = v; @@ -143,3 +145,5 @@ constexpr T ox_itoa(Integer v, T str) noexcept { } return str; } + +} diff --git a/deps/ox/src/ox/std/fmt.hpp b/deps/ox/src/ox/std/fmt.hpp index a3717045..b650bbef 100644 --- a/deps/ox/src/ox/std/fmt.hpp +++ b/deps/ox/src/ox/std/fmt.hpp @@ -81,7 +81,7 @@ class FmtArg { if constexpr(is_bool_v) { return v ? "true" : "false"; } else if constexpr(is_integer_v) { - return ox_itoa(v, dataStr); + return ox::itoa(v, dataStr); } else { return toStringView(v); } @@ -126,11 +126,11 @@ struct FmtSegment { unsigned length = 0; constexpr bool operator==(const FmtSegment &o) const noexcept { - return length == o.length && ox_strncmp(str, o.str, length) == 0; + return length == o.length && ox::strncmp(str, o.str, length) == 0; } constexpr bool operator!=(const FmtSegment &o) const noexcept { - return length != o.length || ox_strncmp(str, o.str, length) != 0; + return length != o.length || ox::strncmp(str, o.str, length) != 0; } }; diff --git a/deps/ox/src/ox/std/hashmap.hpp b/deps/ox/src/ox/std/hashmap.hpp index 868f5ae5..37658149 100644 --- a/deps/ox/src/ox/std/hashmap.hpp +++ b/deps/ox/src/ox/std/hashmap.hpp @@ -45,16 +45,16 @@ class HashMap { constexpr HashMap &operator=(HashMap &&other) noexcept; - constexpr T &operator[](MaybeSV_t const&key); + constexpr T &operator[](MaybeView_t const&key); - constexpr Result at(MaybeSV_t const&key) noexcept; + constexpr Result at(MaybeView_t const&key) noexcept; - constexpr Result at(MaybeSV_t const&key) const noexcept; + constexpr Result at(MaybeView_t const&key) const noexcept; - constexpr void erase(MaybeSV_t const&key); + constexpr void erase(MaybeView_t const&key); [[nodiscard]] - constexpr bool contains(MaybeSV_t const&key) const noexcept; + constexpr bool contains(MaybeView_t const&key) const noexcept; [[nodiscard]] constexpr std::size_t size() const noexcept; @@ -134,7 +134,7 @@ constexpr HashMap &HashMap::operator=(HashMap &&other) noexcep } template -constexpr T &HashMap::operator[](MaybeSV_t const&k) { +constexpr T &HashMap::operator[](MaybeView_t const&k) { auto &p = access(m_pairs, k); if (p == nullptr) { if (static_cast(m_pairs.size()) * 0.7 < @@ -149,7 +149,7 @@ constexpr T &HashMap::operator[](MaybeSV_t const&k) { } template -constexpr Result HashMap::at(MaybeSV_t const&k) noexcept { +constexpr Result HashMap::at(MaybeView_t const&k) noexcept { auto p = access(m_pairs, k); if (!p) { return {nullptr, OxError(1, "value not found for given key")}; @@ -158,7 +158,7 @@ constexpr Result HashMap::at(MaybeSV_t const&k) noexcept { } template -constexpr Result HashMap::at(MaybeSV_t const&k) const noexcept { +constexpr Result HashMap::at(MaybeView_t const&k) const noexcept { auto p = access(m_pairs, k); if (!p) { return {nullptr, OxError(1, "value not found for given key")}; @@ -167,7 +167,7 @@ constexpr Result HashMap::at(MaybeSV_t const&k) const noexcep } template -constexpr void HashMap::erase(MaybeSV_t const&k) { +constexpr void HashMap::erase(MaybeView_t const&k) { if (!contains(k)) { return; } @@ -185,7 +185,7 @@ constexpr void HashMap::erase(MaybeSV_t const&k) { } template -constexpr bool HashMap::contains(MaybeSV_t const&k) const noexcept { +constexpr bool HashMap::contains(MaybeView_t const&k) const noexcept { return access(m_pairs, k) != nullptr; } diff --git a/deps/ox/src/ox/std/maybeview.hpp b/deps/ox/src/ox/std/maybeview.hpp new file mode 100644 index 00000000..e9992391 --- /dev/null +++ b/deps/ox/src/ox/std/maybeview.hpp @@ -0,0 +1,26 @@ +/* + * Copyright 2015 - 2022 gary@drinkingtea.net + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include "typetraits.hpp" + +namespace ox { + +// Maybe StringView. If T is a string type, MaybeType::type/MaybeView_t is a +// StringView. This avoids creating unnecessary Strings when taking a +// StringView or C string as a function argument. +template> +struct MaybeView { + using type = T; +}; + +template +using MaybeView_t = typename MaybeView::type; + +} diff --git a/deps/ox/src/ox/std/std.hpp b/deps/ox/src/ox/std/std.hpp index 0cf050d3..9f55f501 100644 --- a/deps/ox/src/ox/std/std.hpp +++ b/deps/ox/src/ox/std/std.hpp @@ -28,6 +28,7 @@ #include "heapmgr.hpp" #include "iterator.hpp" #include "math.hpp" +#include "maybeview.hpp" #include "memops.hpp" #include "memory.hpp" #include "new.hpp" diff --git a/deps/ox/src/ox/std/string.hpp b/deps/ox/src/ox/std/string.hpp index 772932de..e2604310 100644 --- a/deps/ox/src/ox/std/string.hpp +++ b/deps/ox/src/ox/std/string.hpp @@ -315,7 +315,7 @@ constexpr BasicString &BasicString::operat template constexpr BasicString &BasicString::operator=(int64_t i) noexcept { ox::Array str{}; - ox_itoa(i, str.data()); + ox::itoa(i, str.data()); set(str.data()); return *this; } @@ -323,7 +323,7 @@ constexpr BasicString &BasicString::operat template constexpr BasicString &BasicString::operator=(uint64_t i) noexcept { ox::Array str{}; - ox_itoa(i, str.data()); + ox::itoa(i, str.data()); set(str.data()); return *this; } @@ -352,7 +352,7 @@ constexpr BasicString &BasicString::operat template constexpr BasicString &BasicString::operator+=(const char *str) noexcept { - std::size_t strLen = ox_strlen(str); + std::size_t strLen = ox::strlen(str); oxIgnoreError(append(str, strLen)); return *this; } @@ -371,7 +371,7 @@ constexpr BasicString &BasicString::operat template constexpr BasicString &BasicString::operator+=(Integer_c auto i) noexcept { char str[65] = {}; - ox_itoa(i, str); + ox::itoa(i, str); return this->operator+=(str); } @@ -390,7 +390,7 @@ constexpr BasicString &BasicString::operat template constexpr BasicString BasicString::operator+(const char *str) const noexcept { - const std::size_t strLen = ox_strlen(str); + const std::size_t strLen = ox::strlen(str); const auto currentLen = len(); BasicString cpy(currentLen + strLen); cpy.m_buff.resize(m_buff.size() + strLen); @@ -415,7 +415,7 @@ constexpr BasicString BasicString::operato template constexpr BasicString BasicString::operator+(Integer_c auto i) const noexcept { char str[65] = {}; - ox_itoa(i, str); + ox::itoa(i, str); return *this + str; } @@ -470,22 +470,22 @@ constexpr bool BasicString::operator!=(OxString_c auto const& template constexpr bool BasicString::operator<(BasicString const&other) const noexcept { - return ox_strcmp(c_str(), other.c_str()) < 0; + return ox::strcmp(c_str(), other.c_str()) < 0; } template constexpr bool BasicString::operator>(BasicString const&other) const noexcept { - return ox_strcmp(c_str(), other.c_str()) > 0; + return ox::strcmp(c_str(), other.c_str()) > 0; } template constexpr bool BasicString::operator<=(BasicString const&other) const noexcept { - return ox_strcmp(c_str(), other.c_str()) < 1; + return ox::strcmp(c_str(), other.c_str()) < 1; } template constexpr bool BasicString::operator>=(BasicString const&other) const noexcept { - return ox_strcmp(c_str(), other.c_str()) > -1; + return ox::strcmp(c_str(), other.c_str()) > -1; } template @@ -548,7 +548,7 @@ constexpr void BasicString::set(CRStringView str) noexcept { template constexpr void BasicString::set(const char8_t *str) noexcept { - std::size_t strBytes = ox_strlen(str) + 1; + std::size_t strBytes = ox::strlen(str) + 1; m_buff.resize(strBytes); memcpy(m_buff.data(), str, strBytes); *m_buff.back().value = 0; diff --git a/deps/ox/src/ox/std/stringview.hpp b/deps/ox/src/ox/std/stringview.hpp index 46ff5b46..06ca90fa 100644 --- a/deps/ox/src/ox/std/stringview.hpp +++ b/deps/ox/src/ox/std/stringview.hpp @@ -14,6 +14,7 @@ #include "basestringview.hpp" #include "cstrops.hpp" +#include "maybeview.hpp" #include "writer.hpp" namespace ox { @@ -63,7 +64,7 @@ constexpr auto operator==(CRStringView s1, CRStringView s2) noexcept { if (s2.len() != s1.len()) { return false; } - return ox_strncmp(s1.data(), s2.data(), s1.len()) == 0; + return ox::strncmp(s1.data(), s2.data(), s1.len()) == 0; } constexpr auto operator<=>(CRStringView s1, CRStringView s2) noexcept { @@ -97,24 +98,12 @@ constexpr auto toStdStringView(CRStringView sv) noexcept { #endif -// Maybe StringView. If T is a string type, MaybeType::type/MaybeSV_t is a -// StringView. This avoids creating unnecessary Strings when taking a -// StringView or C string as a function argument. -template> -struct MaybeSV { - using type = T; -}; template -struct MaybeSV { +struct MaybeView { using type = ox::StringView; }; -template -using MaybeSV_t = typename MaybeSV::type; - -} - -constexpr ox::Result ox_atoi(ox::CRStringView str) noexcept { +constexpr ox::Result atoi(ox::CRStringView str) noexcept { int total = 0; int multiplier = 1; for (auto i = static_cast(str.len()) - 1; i != -1; --i) { @@ -129,3 +118,6 @@ constexpr ox::Result ox_atoi(ox::CRStringView str) noexcept { return total; } + +} + diff --git a/deps/ox/src/ox/std/strops.cpp b/deps/ox/src/ox/std/strops.cpp index 532c3bfe..6396ddf4 100644 --- a/deps/ox/src/ox/std/strops.cpp +++ b/deps/ox/src/ox/std/strops.cpp @@ -8,26 +8,26 @@ #include "strops.hpp" -static_assert(ox_strcmp("asdf", "hijk") < 0, "asdf < hijk"); -static_assert(ox_strcmp("hijk", "asdf") > 0, "hijk > asdf"); -static_assert(ox_strcmp("resize", "read") > 0, "resize > read"); -static_assert(ox_strcmp("read", "resize") < 0, "read < resize"); -static_assert(ox_strcmp("resize", "resize") == 0, "resize == resize"); -static_assert(ox_strcmp("", "") == 0, "\"\" == \"\""); +static_assert(ox::strcmp("asdf", "hijk") < 0, "asdf < hijk"); +static_assert(ox::strcmp("hijk", "asdf") > 0, "hijk > asdf"); +static_assert(ox::strcmp("resize", "read") > 0, "resize > read"); +static_assert(ox::strcmp("read", "resize") < 0, "read < resize"); +static_assert(ox::strcmp("resize", "resize") == 0, "resize == resize"); +static_assert(ox::strcmp("", "") == 0, "\"\" == \"\""); static_assert([] { auto testStr = "asdf"; - return ox_strchr(testStr, 0, 4) == &testStr[4]; -}(), "ox_strchr 0"); + return ox::strchr(testStr, 0, 4) == &testStr[4]; +}(), "ox::strchr 0"); static_assert([] { int retval = 0; auto testStr = "aaaa"; - // test the const and non-const versions of ox_lastIndexOf - retval |= !(ox_lastIndexOf(const_cast(testStr), 'a', ox_strlen(testStr)) == 3); - retval |= !(ox_lastIndexOf(testStr, 'a', ox_strlen(testStr)) == 3); + // test the const and non-const versions of ox::lastIndexOf + retval |= !(ox::lastIndexOf(const_cast(testStr), 'a', ox::strlen(testStr)) == 3); + retval |= !(ox::lastIndexOf(testStr, 'a', ox::strlen(testStr)) == 3); return retval == 0; -}(), "ox_lastIndexOf aaaa a"); +}(), "ox::lastIndexOf aaaa a"); #ifndef OX_USE_STDLIB diff --git a/deps/ox/src/ox/std/strops.hpp b/deps/ox/src/ox/std/strops.hpp index d3236d87..84be901f 100644 --- a/deps/ox/src/ox/std/strops.hpp +++ b/deps/ox/src/ox/std/strops.hpp @@ -37,7 +37,7 @@ constexpr ox::StringView substr(Str const&str, std::size_t start, std::size_t en } template -constexpr ox::Error itoa(Integer v, ox::Writer_c auto &writer) noexcept { +constexpr ox::Error writeItoa(Integer v, ox::Writer_c auto &writer) noexcept { if (v) { ox::ResizedInt_t mod = 1000000000000000000; ox::ResizedInt_t val = v; @@ -71,13 +71,13 @@ constexpr ox::Error itoa(Integer v, ox::Writer_c auto &writer) noexcept { [[nodiscard]] constexpr bool beginsWith(CRStringView base, CRStringView beginning) noexcept { const auto beginningLen = ox::min(beginning.len(), base.len()); - return base.len() >= beginning.len() && ox_strncmp(base.data(), beginning, beginningLen) == 0; + return base.len() >= beginning.len() && ox::strncmp(base.data(), beginning, beginningLen) == 0; } [[nodiscard]] constexpr bool endsWith(CRStringView base, CRStringView ending) noexcept { const auto endingLen = ending.len(); - return base.len() >= endingLen && ox_strcmp(base.data() + (base.len() - endingLen), ending) == 0; + return base.len() >= endingLen && ox::strcmp(base.data() + (base.len() - endingLen), ending) == 0; } constexpr std::size_t find(CRStringView str, char search) noexcept { diff --git a/deps/ox/src/ox/std/test/tests.cpp b/deps/ox/src/ox/std/test/tests.cpp index b04ddf3e..3aeb015a 100644 --- a/deps/ox/src/ox/std/test/tests.cpp +++ b/deps/ox/src/ox/std/test/tests.cpp @@ -30,13 +30,13 @@ static std::map tests = { []() { ox::Array buff; ox::CharBuffWriter bw(buff); - oxAssert(ox::itoa(5, bw), "ox::itoa returned Error"); + oxAssert(ox::writeItoa(5, bw), "ox::writeItoa returned Error"); oxExpect(ox::StringView(buff.data()), ox::StringView("5")); oxReturnError(bw.seekp(0)); - oxAssert(ox::itoa(50, bw), "ox::itoa returned Error"); + oxAssert(ox::writeItoa(50, bw), "ox::writeItoa returned Error"); oxExpect(ox::StringView(buff.data()), ox::StringView("50")); oxReturnError(bw.seekp(0)); - oxAssert(ox::itoa(500, bw), "ox::itoa returned Error"); + oxAssert(ox::writeItoa(500, bw), "ox::writeItoa returned Error"); oxExpect(ox::StringView(buff.data()), ox::StringView("500")); return ox::Error{}; } diff --git a/deps/ox/src/ox/std/tracehook.cpp b/deps/ox/src/ox/std/tracehook.cpp index 7498954d..a0a0528d 100644 --- a/deps/ox/src/ox/std/tracehook.cpp +++ b/deps/ox/src/ox/std/tracehook.cpp @@ -42,7 +42,7 @@ enum LogChan { template static void log(ox::CRStringView str) { const auto sz = ox::min(0x100, str.bytes()); - ox_strncpy(REG_MGBA_DEBUG_STRING, str.data(), sz); + ox::strncpy(REG_MGBA_DEBUG_STRING, str.data(), sz); REG_MGBA_DEBUG_FLAGS = chan | 0x100; } @@ -69,30 +69,30 @@ void oxTraceHook([[maybe_unused]] const char *file, [[maybe_unused]] int line, std::cout << std::setw(53) << std::left << ch << "| "; std::cout << std::setw(65) << std::left << msg << '|'; std::cout << " " << file << ':' << line << "\n"; - } else if (ox_strcmp(ch, "debug") == 0 || ox_strcmp(ch, "info") == 0) { + } else if (ox::strcmp(ch, "debug") == 0 || ox::strcmp(ch, "info") == 0) { printf("%s\n", msg); fflush(stdout); - } else if (ox_strcmp(ch, "stdout") == 0) { + } else if (ox::strcmp(ch, "stdout") == 0) { printf("%s", msg); fflush(stdout); - } else if (ox_strcmp(ch, "stderr") == 0) { + } else if (ox::strcmp(ch, "stderr") == 0) { printf("%s", msg); fflush(stdout); - } else if (ox_strcmp(ch, "error") == 0) { + } else if (ox::strcmp(ch, "error") == 0) { //std::cerr << "\033[31;1;1mERROR:\033[0m (" << file << ':' << line << "): " << msg << '\n'; fprintf(stderr, "\033[31;1;1mERROR:\033[0m (%s:%d): %s\n", file, line, msg); fflush(stderr); } #else - if (ox_strcmp(ch, "info") == 0) { + if (ox::strcmp(ch, "info") == 0) { infoLog(msg); - } else if (ox_strcmp(ch, "debug") == 0) { + } else if (ox::strcmp(ch, "debug") == 0) { debugLog(msg); - } else if (ox_strcmp(ch, "stdout") == 0) { + } else if (ox::strcmp(ch, "stdout") == 0) { infoLog(msg); - } else if (ox_strcmp(ch, "stderr") == 0) { + } else if (ox::strcmp(ch, "stderr") == 0) { errorLog(msg); - } else if (ox_strcmp(ch, "error") == 0) { + } else if (ox::strcmp(ch, "error") == 0) { errorLog(msg); } #endif diff --git a/deps/ox/src/ox/std/vector.hpp b/deps/ox/src/ox/std/vector.hpp index 9ccd9aba..05f377ab 100644 --- a/deps/ox/src/ox/std/vector.hpp +++ b/deps/ox/src/ox/std/vector.hpp @@ -263,12 +263,12 @@ class Vector: detail::VectorAllocator { } [[nodiscard]] - constexpr bool contains(MaybeSV_t const&) const noexcept(useNoexcept); + constexpr bool contains(MaybeView_t const&) const noexcept(useNoexcept); constexpr iterator insert( - std::size_t pos, std::size_t cnt, MaybeSV_t const&val) noexcept(useNoexcept); + std::size_t pos, std::size_t cnt, MaybeView_t const&val) noexcept(useNoexcept); - constexpr iterator insert(std::size_t pos, MaybeSV_t const&val) noexcept(useNoexcept); + constexpr iterator insert(std::size_t pos, MaybeView_t const&val) noexcept(useNoexcept); template constexpr iterator emplace(std::size_t pos, Args&&... args) noexcept(useNoexcept); @@ -278,7 +278,7 @@ class Vector: detail::VectorAllocator { constexpr void push_back(T &&item) noexcept(useNoexcept); - constexpr void push_back(MaybeSV_t const&item) noexcept(useNoexcept); + constexpr void push_back(MaybeView_t const&item) noexcept(useNoexcept); constexpr void pop_back() noexcept(useNoexcept); @@ -516,7 +516,7 @@ constexpr void Vector::resize(std::size_t size) n } template -constexpr bool Vector::contains(MaybeSV_t const&v) const noexcept(useNoexcept) { +constexpr bool Vector::contains(MaybeView_t const&v) const noexcept(useNoexcept) { for (std::size_t i = 0; i < m_size; i++) { if (m_items[i] == v) { return true; @@ -528,7 +528,7 @@ constexpr bool Vector::contains(MaybeSV_t cons template constexpr typename Vector::template iterator Vector::insert( - std::size_t pos, std::size_t cnt, MaybeSV_t const&val) noexcept(useNoexcept) { + std::size_t pos, std::size_t cnt, MaybeView_t const&val) noexcept(useNoexcept) { if (m_size + cnt > m_cap) { reserveInsert(m_cap ? m_size + cnt : initialCap, pos, cnt); if (pos < m_size) { @@ -556,7 +556,7 @@ Vector::insert( template constexpr typename Vector::template iterator -Vector::insert(std::size_t pos, MaybeSV_t const&val) noexcept(useNoexcept) { +Vector::insert(std::size_t pos, MaybeView_t const&val) noexcept(useNoexcept) { if (m_size == m_cap) { reserveInsert(m_cap ? m_cap * 2 : initialCap, pos); if (pos < m_size) { @@ -622,7 +622,7 @@ constexpr void Vector::push_back(T &&item) noexce } template -constexpr void Vector::push_back(MaybeSV_t const&item) noexcept(useNoexcept) { +constexpr void Vector::push_back(MaybeView_t const&item) noexcept(useNoexcept) { if (m_size == m_cap) { reserve(m_cap ? m_cap * 2 : initialCap); }