From cc10631b5599082cd4ce08d671028d8b6b2aa510 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 28 Sep 2024 16:09:43 -0500 Subject: [PATCH] [ox] Rename CRStringView to StringViewCR --- deps/ox/src/ox/clargs/clargs.cpp | 12 ++-- deps/ox/src/ox/clargs/clargs.hpp | 12 ++-- deps/ox/src/ox/fs/filesystem/directory.hpp | 4 +- deps/ox/src/ox/fs/filesystem/filelocation.cpp | 4 +- deps/ox/src/ox/fs/filesystem/filelocation.hpp | 4 +- deps/ox/src/ox/fs/filesystem/filesystem.cpp | 2 +- deps/ox/src/ox/fs/filesystem/filesystem.hpp | 72 +++++++++---------- .../ox/src/ox/fs/filesystem/passthroughfs.cpp | 16 ++--- .../ox/src/ox/fs/filesystem/passthroughfs.hpp | 20 +++--- deps/ox/src/ox/fs/filesystem/pathiterator.cpp | 2 +- deps/ox/src/ox/fs/filesystem/pathiterator.hpp | 2 +- deps/ox/src/ox/logconn/logconn.cpp | 2 +- deps/ox/src/ox/logconn/logconn.hpp | 2 +- deps/ox/src/ox/model/desctypes.hpp | 2 +- deps/ox/src/ox/model/descwrite.hpp | 32 ++++----- deps/ox/src/ox/model/fieldcounter.hpp | 8 +-- deps/ox/src/ox/model/typestore.hpp | 4 +- deps/ox/src/ox/preloader/alignmentcatcher.hpp | 6 +- deps/ox/src/ox/preloader/preloader.hpp | 36 +++++----- deps/ox/src/ox/preloader/unionsizecatcher.hpp | 18 ++--- deps/ox/src/ox/std/assert.hpp | 10 +-- deps/ox/src/ox/std/istring.hpp | 4 +- deps/ox/src/ox/std/string.hpp | 18 ++--- deps/ox/src/ox/std/stringview.hpp | 12 ++-- deps/ox/src/ox/std/strops.hpp | 18 ++--- deps/ox/src/ox/std/tracehook.cpp | 10 +-- deps/ox/src/ox/std/uuid.hpp | 4 +- 27 files changed, 168 insertions(+), 168 deletions(-) diff --git a/deps/ox/src/ox/clargs/clargs.cpp b/deps/ox/src/ox/clargs/clargs.cpp index 41feed51..7cb8033a 100644 --- a/deps/ox/src/ox/clargs/clargs.cpp +++ b/deps/ox/src/ox/clargs/clargs.cpp @@ -37,32 +37,32 @@ ClArgs::ClArgs(int argc, const char **args) noexcept { } } -bool ClArgs::getBool(ox::CRStringView arg, bool defaultValue) const noexcept { +bool ClArgs::getBool(ox::StringViewCR arg, bool defaultValue) const noexcept { auto [value, err] = m_ints.at(arg); return !err ? *value : defaultValue; } -String ClArgs::getString(ox::CRStringView arg, ox::StringView defaultValue) const noexcept { +String ClArgs::getString(ox::StringViewCR arg, ox::StringView defaultValue) const noexcept { auto [value, err] = m_strings.at(arg); return !err ? ox::String(*value) : ox::String(defaultValue); } -int ClArgs::getInt(ox::CRStringView arg, int defaultValue) const noexcept { +int ClArgs::getInt(ox::StringViewCR arg, int defaultValue) const noexcept { auto [value, err] = m_ints.at(arg); return !err ? *value : defaultValue; } -Result ClArgs::getBool(ox::CRStringView arg) const noexcept { +Result ClArgs::getBool(ox::StringViewCR arg) const noexcept { oxRequire(out, m_bools.at(arg)); return *out; } -Result ClArgs::getString(ox::CRStringView argName) const noexcept { +Result ClArgs::getString(ox::StringViewCR argName) const noexcept { oxRequire(out, m_strings.at(argName)); return *out; } -Result ClArgs::getInt(ox::CRStringView arg) const noexcept { +Result ClArgs::getInt(ox::StringViewCR arg) const noexcept { oxRequire(out, m_ints.at(arg)); return *out; } diff --git a/deps/ox/src/ox/clargs/clargs.hpp b/deps/ox/src/ox/clargs/clargs.hpp index ed514409..610d6259 100644 --- a/deps/ox/src/ox/clargs/clargs.hpp +++ b/deps/ox/src/ox/clargs/clargs.hpp @@ -23,21 +23,21 @@ class ClArgs { ClArgs(int argc, const char **args) noexcept; [[nodiscard]] - bool getBool(ox::CRStringView arg, bool defaultValue) const noexcept; + bool getBool(ox::StringViewCR arg, bool defaultValue) const noexcept; [[nodiscard]] - String getString(ox::CRStringView argName, ox::StringView defaultValue) const noexcept; + String getString(ox::StringViewCR argName, ox::StringView defaultValue) const noexcept; [[nodiscard]] - int getInt(ox::CRStringView arg, int defaultValue) const noexcept; + int getInt(ox::StringViewCR arg, int defaultValue) const noexcept; [[nodiscard]] - Result getBool(ox::CRStringView arg) const noexcept; + Result getBool(ox::StringViewCR arg) const noexcept; [[nodiscard]] - Result getString(ox::CRStringView argName) const noexcept; + Result getString(ox::StringViewCR argName) const noexcept; - Result getInt(ox::CRStringView arg) const noexcept; + Result getInt(ox::StringViewCR arg) const noexcept; }; diff --git a/deps/ox/src/ox/fs/filesystem/directory.hpp b/deps/ox/src/ox/fs/filesystem/directory.hpp index dd03c6ab..5adff262 100644 --- a/deps/ox/src/ox/fs/filesystem/directory.hpp +++ b/deps/ox/src/ox/fs/filesystem/directory.hpp @@ -43,7 +43,7 @@ struct OX_PACKED DirectoryEntry { public: constexpr DirectoryEntry() noexcept = default; - Error init(InodeId_t inode, ox::CRStringView name, size_t bufferSize) noexcept { + Error init(InodeId_t inode, ox::StringViewCR name, size_t bufferSize) noexcept { oxTracef("ox.fs.DirectoryEntry.init", "inode: {}, name: {}, bufferSize: {}", inode, name, bufferSize); m_bufferSize = static_cast(bufferSize); auto d = data(); @@ -284,7 +284,7 @@ Error Directory::ls(F cb) noexcept { } template -Result Directory::findEntry(CRStringView name) const noexcept { +Result Directory::findEntry(StringViewCR name) const noexcept { oxTrace("ox.fs.Directory.findEntry", name); auto buff = m_fs.read(m_inodeId).template to(); if (!buff.valid()) { diff --git a/deps/ox/src/ox/fs/filesystem/filelocation.cpp b/deps/ox/src/ox/fs/filesystem/filelocation.cpp index df5f8a10..51b9f2d1 100644 --- a/deps/ox/src/ox/fs/filesystem/filelocation.cpp +++ b/deps/ox/src/ox/fs/filesystem/filelocation.cpp @@ -28,7 +28,7 @@ FileAddress::FileAddress(uint64_t inode) noexcept { m_type = FileAddressType::Inode; } -FileAddress::FileAddress(ox::CRStringView path) noexcept { +FileAddress::FileAddress(ox::StringViewCR path) noexcept { auto pathSize = path.bytes(); m_data.path = new char[pathSize + 1]; memcpy(m_data.path, path.data(), pathSize); @@ -114,7 +114,7 @@ bool FileAddress::operator==(FileAddress const&other) const noexcept { return true; } -bool FileAddress::operator==(CRStringView path) const noexcept { +bool FileAddress::operator==(StringViewCR path) const noexcept { auto [p, err] = getPath(); if (err) { return false; diff --git a/deps/ox/src/ox/fs/filesystem/filelocation.hpp b/deps/ox/src/ox/fs/filesystem/filelocation.hpp index 4ce349fe..c8f6cfa5 100644 --- a/deps/ox/src/ox/fs/filesystem/filelocation.hpp +++ b/deps/ox/src/ox/fs/filesystem/filelocation.hpp @@ -57,7 +57,7 @@ class FileAddress { FileAddress(uint64_t inode) noexcept; - explicit FileAddress(CRStringView path) noexcept; + explicit FileAddress(StringViewCR path) noexcept; constexpr FileAddress(ox::StringLiteral path) noexcept; @@ -69,7 +69,7 @@ class FileAddress { bool operator==(const FileAddress &other) const noexcept; - bool operator==(CRStringView path) const noexcept; + bool operator==(StringViewCR path) const noexcept; [[nodiscard]] constexpr FileAddressType type() const noexcept { diff --git a/deps/ox/src/ox/fs/filesystem/filesystem.cpp b/deps/ox/src/ox/fs/filesystem/filesystem.cpp index 16c28cb3..5b9b7718 100644 --- a/deps/ox/src/ox/fs/filesystem/filesystem.cpp +++ b/deps/ox/src/ox/fs/filesystem/filesystem.cpp @@ -44,7 +44,7 @@ Result FileSystem::read(const FileAddress &addr) noexcept { return buff; } -Result FileSystem::read(CRStringView path) noexcept { +Result FileSystem::read(StringViewCR path) noexcept { oxRequire(s, statPath(path)); Buffer buff(static_cast(s.size)); oxReturnError(readFilePath(path, buff.data(), buff.size())); diff --git a/deps/ox/src/ox/fs/filesystem/filesystem.hpp b/deps/ox/src/ox/fs/filesystem/filesystem.hpp index ebe98d00..a8c6110c 100644 --- a/deps/ox/src/ox/fs/filesystem/filesystem.hpp +++ b/deps/ox/src/ox/fs/filesystem/filesystem.hpp @@ -30,22 +30,22 @@ class FileSystem { public: virtual ~FileSystem() noexcept = default; - virtual Error mkdir(CRStringView path, bool recursive) noexcept = 0; + virtual Error mkdir(StringViewCR path, bool recursive) noexcept = 0; /** * Moves an entry from one directory to another. * @param src the path to the file * @param dest the path of the destination directory */ - virtual Error move(CRStringView src, CRStringView dest) noexcept = 0; + virtual Error move(StringViewCR src, StringViewCR dest) noexcept = 0; Error read(const FileAddress &addr, void *buffer, std::size_t size) noexcept; Result read(const FileAddress &addr) noexcept; - Result read(CRStringView path) noexcept; + Result read(StringViewCR path) noexcept; - inline Error read(CRStringView path, void *buffer, std::size_t buffSize) noexcept { + inline Error read(StringViewCR path, void *buffer, std::size_t buffSize) noexcept { return readFilePath(path, buffer, buffSize); } @@ -55,19 +55,19 @@ class FileSystem { Error read(const FileAddress &addr, std::size_t readStart, std::size_t readSize, void *buffer, std::size_t *size) noexcept; - virtual Result> ls(CRStringView dir) const noexcept = 0; + virtual Result> ls(StringViewCR dir) const noexcept = 0; - virtual Error remove(CRStringView path, bool recursive) noexcept = 0; + virtual Error remove(StringViewCR path, bool recursive) noexcept = 0; Error remove(const FileAddress &addr, bool recursive = false) noexcept; virtual Error resize(uint64_t size, void *buffer) noexcept = 0; - Error write(CRStringView path, const void *buffer, uint64_t size) noexcept { + Error write(StringViewCR path, const void *buffer, uint64_t size) noexcept { return writeFilePath(path, buffer, size, FileType::NormalFile); } - Error write(CRStringView path, ox::Span const&buff) noexcept { + Error write(StringViewCR path, ox::Span const&buff) noexcept { return write(path, buff.data(), buff.size(), FileType::NormalFile); } @@ -81,7 +81,7 @@ class FileSystem { Error write(const FileAddress &addr, const void *buffer, uint64_t size, FileType fileType = FileType::NormalFile) noexcept; - inline Error write(CRStringView path, const void *buffer, uint64_t size, FileType fileType) noexcept { + inline Error write(StringViewCR path, const void *buffer, uint64_t size, FileType fileType) noexcept { return writeFilePath(path, buffer, size, fileType); } @@ -93,7 +93,7 @@ class FileSystem { return statInode(inode); } - inline Result stat(CRStringView path) const noexcept { + inline Result stat(StringViewCR path) const noexcept { return statPath(path); } @@ -134,15 +134,15 @@ class FileSystem { protected: virtual Result statInode(uint64_t inode) const noexcept = 0; - virtual Result statPath(CRStringView path) const noexcept = 0; + virtual Result statPath(StringViewCR path) const noexcept = 0; - virtual Error readFilePath(CRStringView path, void *buffer, std::size_t buffSize) noexcept = 0; + virtual Error readFilePath(StringViewCR path, void *buffer, std::size_t buffSize) noexcept = 0; virtual Error readFileInode(uint64_t inode, void *buffer, std::size_t size) noexcept = 0; virtual Error readFileInodeRange(uint64_t inode, std::size_t readStart, std::size_t readSize, void *buffer, std::size_t *size) noexcept = 0; - virtual Error writeFilePath(CRStringView path, const void *buffer, uint64_t size, FileType fileType) noexcept = 0; + virtual Error writeFilePath(StringViewCR path, const void *buffer, uint64_t size, FileType fileType) noexcept = 0; virtual Error writeFileInode(uint64_t inode, const void *buffer, uint64_t size, FileType fileType) noexcept = 0; @@ -152,7 +152,7 @@ class MemFS: public FileSystem { public: Result directAccess(const FileAddress &addr) const noexcept; - inline Result directAccess(CRStringView path) const noexcept { + inline Result directAccess(StringViewCR path) const noexcept { return directAccessPath(path); } @@ -161,7 +161,7 @@ class MemFS: public FileSystem { } protected: - virtual Result directAccessPath(CRStringView path) const noexcept = 0; + virtual Result directAccessPath(StringViewCR path) const noexcept = 0; virtual Result directAccessInode(uint64_t inode) const noexcept = 0; }; @@ -197,13 +197,13 @@ class FileSystemTemplate: public MemFS { static Error format(void *buff, uint64_t buffSize) noexcept; - Error mkdir(CRStringView path, bool recursive) noexcept override; + Error mkdir(StringViewCR path, bool recursive) noexcept override; - Error move(CRStringView src, CRStringView dest) noexcept override; + Error move(StringViewCR src, StringViewCR dest) noexcept override; - Error readFilePath(CRStringView path, void *buffer, std::size_t buffSize) noexcept override; + Error readFilePath(StringViewCR path, void *buffer, std::size_t buffSize) noexcept override; - Result directAccessPath(CRStringView) const noexcept override; + Result directAccessPath(StringViewCR) const noexcept override; Error readFileInode(uint64_t inode, void *buffer, std::size_t size) noexcept override; @@ -211,12 +211,12 @@ class FileSystemTemplate: public MemFS { Result directAccessInode(uint64_t) const noexcept override; - Result> ls(CRStringView dir) const noexcept override; + Result> ls(StringViewCR dir) const noexcept override; template - Error ls(CRStringView path, F cb) const; + Error ls(StringViewCR path, F cb) const; - Error remove(CRStringView path, bool recursive) noexcept override; + Error remove(StringViewCR path, bool recursive) noexcept override; /** * Resizes FileSystem to minimum possible size. @@ -225,13 +225,13 @@ class FileSystemTemplate: public MemFS { Error resize(uint64_t size, void *buffer) noexcept override; - Error writeFilePath(CRStringView path, const void *buffer, uint64_t size, FileType fileType) noexcept override; + Error writeFilePath(StringViewCR path, const void *buffer, uint64_t size, FileType fileType) noexcept override; Error writeFileInode(uint64_t inode, const void *buffer, uint64_t size, FileType fileType) noexcept override; Result statInode(uint64_t inode) const noexcept override; - Result statPath(CRStringView path) const noexcept override; + Result statPath(StringViewCR path) const noexcept override; [[nodiscard]] uint64_t spaceNeeded(uint64_t size) const noexcept override; @@ -253,7 +253,7 @@ class FileSystemTemplate: public MemFS { /** * Finds the inode ID at the given path. */ - Result find(CRStringView path) const noexcept; + Result find(StringViewCR path) const noexcept; Result rootDir() const noexcept; @@ -305,14 +305,14 @@ Error FileSystemTemplate::format(void *buff, uint64_t buff } template -Error FileSystemTemplate::mkdir(CRStringView path, bool recursive) noexcept { +Error FileSystemTemplate::mkdir(StringViewCR path, bool recursive) noexcept { oxTracef("ox.fs.FileSystemTemplate.mkdir", "path: {}, recursive: {}", path, recursive); oxRequireM(rootDir, this->rootDir()); return rootDir.mkdir(path, recursive); } template -Error FileSystemTemplate::move(CRStringView src, CRStringView dest) noexcept { +Error FileSystemTemplate::move(StringViewCR src, StringViewCR dest) noexcept { oxRequire(fd, fileSystemData()); Directory rootDir(m_fs, fd.rootDirInode); oxRequireM(inode, rootDir.find(src)); @@ -322,7 +322,7 @@ Error FileSystemTemplate::move(CRStringView src, CRStringV } template -Error FileSystemTemplate::readFilePath(CRStringView path, void *buffer, std::size_t buffSize) noexcept { +Error FileSystemTemplate::readFilePath(StringViewCR path, void *buffer, std::size_t buffSize) noexcept { oxTrace("ox.fs.FileSystemTemplate.readFilePath", path); oxRequire(fd, fileSystemData()); Directory rootDir(m_fs, fd.rootDirInode); @@ -334,7 +334,7 @@ Error FileSystemTemplate::readFilePath(CRStringView path, } template -Result FileSystemTemplate::directAccessPath(CRStringView path) const noexcept { +Result FileSystemTemplate::directAccessPath(StringViewCR path) const noexcept { oxRequire(fd, fileSystemData()); Directory rootDir(m_fs, fd.rootDirInode); oxRequire(inode, rootDir.find(path)); @@ -366,9 +366,9 @@ Result FileSystemTemplate::directAccessInode( } template -Result> FileSystemTemplate::ls(CRStringView path) const noexcept { +Result> FileSystemTemplate::ls(StringViewCR path) const noexcept { Vector out; - oxReturnError(ls(path, [&out](CRStringView name, typename FileStore::InodeId_t) { + oxReturnError(ls(path, [&out](StringViewCR name, typename FileStore::InodeId_t) { out.emplace_back(name); return OxError(0); })); @@ -377,7 +377,7 @@ Result> FileSystemTemplate::ls(CRStringView template template -Error FileSystemTemplate::ls(CRStringView path, F cb) const { +Error FileSystemTemplate::ls(StringViewCR path, F cb) const { oxTracef("ox.fs.FileSystemTemplate.ls", "path: {}", path); oxRequire(s, stat(path)); Directory dir(m_fs, s.inode); @@ -385,7 +385,7 @@ Error FileSystemTemplate::ls(CRStringView path, F cb) cons } template -Error FileSystemTemplate::remove(CRStringView path, bool recursive) noexcept { +Error FileSystemTemplate::remove(StringViewCR path, bool recursive) noexcept { oxRequire(fd, fileSystemData()); Directory rootDir(m_fs, fd.rootDirInode); oxRequire(inode, rootDir.find(path)); @@ -416,7 +416,7 @@ Error FileSystemTemplate::resize(uint64_t size, void *buff template Error FileSystemTemplate::writeFilePath( - CRStringView path, + StringViewCR path, const void *buffer, uint64_t size, FileType fileType) noexcept { @@ -449,7 +449,7 @@ Result FileSystemTemplate::statInode(uint64_t in } template -Result FileSystemTemplate::statPath(CRStringView path) const noexcept { +Result FileSystemTemplate::statPath(StringViewCR path) const noexcept { oxRequire(inode, find(path)); return stat(inode); } @@ -492,7 +492,7 @@ Result::FileSystemData> FileSy } template -Result FileSystemTemplate::find(CRStringView path) const noexcept { +Result FileSystemTemplate::find(StringViewCR path) const noexcept { oxRequire(fd, fileSystemData()); // return root as a special case if (path == "/") { diff --git a/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp b/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp index 91bff12d..1fd7080b 100644 --- a/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp +++ b/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp @@ -17,7 +17,7 @@ namespace ox { -PassThroughFS::PassThroughFS(CRStringView dirPath) { +PassThroughFS::PassThroughFS(StringViewCR dirPath) { m_path = std::string_view(dirPath.data(), dirPath.bytes()); } @@ -27,7 +27,7 @@ String PassThroughFS::basePath() const noexcept { return ox::String(m_path.string().c_str()); } -Error PassThroughFS::mkdir(CRStringView path, bool recursive) noexcept { +Error PassThroughFS::mkdir(StringViewCR path, bool recursive) noexcept { bool success = false; const auto p = m_path / stripSlash(path); const auto u8p = p.u8string(); @@ -54,7 +54,7 @@ Error PassThroughFS::mkdir(CRStringView path, bool recursive) noexcept { return OxError(success ? 0 : 1); } -Error PassThroughFS::move(CRStringView src, CRStringView dest) noexcept { +Error PassThroughFS::move(StringViewCR src, StringViewCR dest) noexcept { std::error_code ec; std::filesystem::rename(m_path / stripSlash(src), m_path / stripSlash(dest), ec); if (ec.value()) { @@ -63,7 +63,7 @@ Error PassThroughFS::move(CRStringView src, CRStringView dest) noexcept { return OxError(0); } -Result> PassThroughFS::ls(CRStringView dir) const noexcept { +Result> PassThroughFS::ls(StringViewCR dir) const noexcept { Vector out; std::error_code ec; const auto di = std::filesystem::directory_iterator(m_path / stripSlash(dir), ec); @@ -75,7 +75,7 @@ Result> PassThroughFS::ls(CRStringView dir) const noexcept { return out; } -Error PassThroughFS::remove(CRStringView path, bool recursive) noexcept { +Error PassThroughFS::remove(StringViewCR path, bool recursive) noexcept { if (recursive) { return OxError(std::filesystem::remove_all(m_path / stripSlash(path)) != 0); } else { @@ -93,7 +93,7 @@ Result PassThroughFS::statInode(uint64_t) const noexcept { return OxError(1, "statInode(uint64_t) is not supported by PassThroughFS"); } -Result PassThroughFS::statPath(CRStringView path) const noexcept { +Result PassThroughFS::statPath(StringViewCR path) const noexcept { std::error_code ec; const auto p = m_path / stripSlash(path); const FileType type = std::filesystem::is_directory(p, ec) ? @@ -140,7 +140,7 @@ bool PassThroughFS::valid() const noexcept { return false; } -Error PassThroughFS::readFilePath(CRStringView path, void *buffer, std::size_t buffSize) noexcept { +Error PassThroughFS::readFilePath(StringViewCR path, void *buffer, std::size_t buffSize) noexcept { try { std::ifstream file((m_path / stripSlash(path)), std::ios::binary | std::ios::ate); const std::size_t size = static_cast(file.tellg()); @@ -167,7 +167,7 @@ Error PassThroughFS::readFileInodeRange(uint64_t, std::size_t, std::size_t, void return OxError(1, "read(uint64_t, std::size_t, std::size_t, void*, std::size_t*) is not supported by PassThroughFS"); } -Error PassThroughFS::writeFilePath(CRStringView path, const void *buffer, uint64_t size, FileType) noexcept { +Error PassThroughFS::writeFilePath(StringViewCR path, const void *buffer, uint64_t size, FileType) noexcept { const auto p = (m_path / stripSlash(path)); try { std::ofstream f(p, std::ios::binary); diff --git a/deps/ox/src/ox/fs/filesystem/passthroughfs.hpp b/deps/ox/src/ox/fs/filesystem/passthroughfs.hpp index 22a81836..abe6dae9 100644 --- a/deps/ox/src/ox/fs/filesystem/passthroughfs.hpp +++ b/deps/ox/src/ox/fs/filesystem/passthroughfs.hpp @@ -29,29 +29,29 @@ class PassThroughFS: public FileSystem { std::filesystem::path m_path; public: - explicit PassThroughFS(CRStringView dirPath); + explicit PassThroughFS(StringViewCR dirPath); ~PassThroughFS() noexcept override; [[nodiscard]] String basePath() const noexcept; - Error mkdir(CRStringView path, bool recursive) noexcept override; + Error mkdir(StringViewCR path, bool recursive) noexcept override; - Error move(CRStringView src, CRStringView dest) noexcept override; + Error move(StringViewCR src, StringViewCR dest) noexcept override; - Result> ls(CRStringView dir) const noexcept override; + Result> ls(StringViewCR dir) const noexcept override; template - Error ls(CRStringView dir, F cb) const noexcept; + Error ls(StringViewCR dir, F cb) const noexcept; - Error remove(CRStringView path, bool recursive) noexcept override; + Error remove(StringViewCR path, bool recursive) noexcept override; Error resize(uint64_t size, void *buffer) noexcept override; Result statInode(uint64_t inode) const noexcept override; - Result statPath(CRStringView path) const noexcept override; + Result statPath(StringViewCR path) const noexcept override; [[nodiscard]] uint64_t spaceNeeded(uint64_t size) const noexcept override; @@ -69,13 +69,13 @@ class PassThroughFS: public FileSystem { bool valid() const noexcept override; protected: - Error readFilePath(CRStringView path, void *buffer, std::size_t buffSize) noexcept override; + Error readFilePath(StringViewCR path, void *buffer, std::size_t buffSize) noexcept override; Error readFileInode(uint64_t inode, void *buffer, std::size_t size) noexcept override; Error readFileInodeRange(uint64_t inode, std::size_t readStart, std::size_t readSize, void *buffer, std::size_t *size) noexcept override; - Error writeFilePath(CRStringView path, const void *buffer, uint64_t size, FileType fileType) noexcept override; + Error writeFilePath(StringViewCR path, const void *buffer, uint64_t size, FileType fileType) noexcept override; Error writeFileInode(uint64_t inode, const void *buffer, uint64_t size, FileType fileType) noexcept override; @@ -89,7 +89,7 @@ class PassThroughFS: public FileSystem { }; template -Error PassThroughFS::ls(CRStringView dir, F cb) const noexcept { +Error PassThroughFS::ls(StringViewCR dir, F cb) const noexcept { std::error_code ec; const auto di = std::filesystem::directory_iterator(m_path / stripSlash(dir), ec); oxReturnError(OxError(static_cast(ec.value()), "PassThroughFS: ls failed")); diff --git a/deps/ox/src/ox/fs/filesystem/pathiterator.cpp b/deps/ox/src/ox/fs/filesystem/pathiterator.cpp index 581b2901..6f5af207 100644 --- a/deps/ox/src/ox/fs/filesystem/pathiterator.cpp +++ b/deps/ox/src/ox/fs/filesystem/pathiterator.cpp @@ -22,7 +22,7 @@ PathIterator::PathIterator(const char *path, std::size_t maxSize, std::size_t it PathIterator::PathIterator(const char *path): PathIterator(path, ox::strlen(path)) { } -PathIterator::PathIterator(CRStringView path): PathIterator(path.data(), path.bytes()) { +PathIterator::PathIterator(StringViewCR path): PathIterator(path.data(), path.bytes()) { } /** diff --git a/deps/ox/src/ox/fs/filesystem/pathiterator.hpp b/deps/ox/src/ox/fs/filesystem/pathiterator.hpp index e2047c76..33659abe 100644 --- a/deps/ox/src/ox/fs/filesystem/pathiterator.hpp +++ b/deps/ox/src/ox/fs/filesystem/pathiterator.hpp @@ -25,7 +25,7 @@ class PathIterator { PathIterator(const char *path); - PathIterator(CRStringView path); + PathIterator(StringViewCR path); Error dirPath(char *pathOut, std::size_t pathOutSize); diff --git a/deps/ox/src/ox/logconn/logconn.cpp b/deps/ox/src/ox/logconn/logconn.cpp index b5c59126..f5a398ff 100644 --- a/deps/ox/src/ox/logconn/logconn.cpp +++ b/deps/ox/src/ox/logconn/logconn.cpp @@ -51,7 +51,7 @@ LoggerConn::~LoggerConn() noexcept { } } -ox::Error LoggerConn::initConn(ox::CRStringView appName) noexcept { +ox::Error LoggerConn::initConn(ox::StringViewCR appName) noexcept { sockaddr_in addr{}; addr.sin_family = AF_INET; addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); diff --git a/deps/ox/src/ox/logconn/logconn.hpp b/deps/ox/src/ox/logconn/logconn.hpp index 2655de58..8a2b3ae4 100644 --- a/deps/ox/src/ox/logconn/logconn.hpp +++ b/deps/ox/src/ox/logconn/logconn.hpp @@ -38,7 +38,7 @@ class LoggerConn: public trace::Logger { LoggerConn &operator=(const LoggerConn&) noexcept = delete; ox::Error send(const trace::TraceMsg&) noexcept final; ox::Error sendInit(const trace::InitTraceMsg&) noexcept final; - ox::Error initConn(ox::CRStringView appName) noexcept; + ox::Error initConn(ox::StringViewCR appName) noexcept; ox::Error send(const char *buff, std::size_t len) const noexcept; private: void msgSend() noexcept; diff --git a/deps/ox/src/ox/model/desctypes.hpp b/deps/ox/src/ox/model/desctypes.hpp index 248c3099..6a1bcc4f 100644 --- a/deps/ox/src/ox/model/desctypes.hpp +++ b/deps/ox/src/ox/model/desctypes.hpp @@ -35,7 +35,7 @@ constexpr auto buildTypeId() noexcept { } static constexpr auto buildTypeId( - CRStringView name, int version, + StringViewCR name, int version, const TypeParamPack &typeParams = {}) noexcept { String tp; if (!typeParams.empty()) { diff --git a/deps/ox/src/ox/model/descwrite.hpp b/deps/ox/src/ox/model/descwrite.hpp index e0bf9844..089314d5 100644 --- a/deps/ox/src/ox/model/descwrite.hpp +++ b/deps/ox/src/ox/model/descwrite.hpp @@ -91,23 +91,23 @@ class TypeDescWriter { constexpr ~TypeDescWriter() noexcept = default; template - constexpr ox::Error setTypeInfo(CRStringView name = T::TypeName, - int version = T::TypeVersion, - const TypeParamPack &typeParams = {}, - std::size_t fields = ModelFieldCount_v) noexcept; + constexpr ox::Error setTypeInfo(StringViewCR name = T::TypeName, + int version = T::TypeVersion, + const TypeParamPack &typeParams = {}, + std::size_t fields = ModelFieldCount_v) noexcept; template - constexpr Error field(CRStringView name, const T *val, std::size_t valLen, + constexpr Error field(StringViewCR name, const T *val, std::size_t valLen, const SubscriptStack &subscriptStack = {}) noexcept; template - constexpr Error field(CRStringView name, UnionView val) noexcept; + constexpr Error field(StringViewCR name, UnionView val) noexcept; template - constexpr Error field(CRStringView name, const T *val) noexcept; + constexpr Error field(StringViewCR name, const T *val) noexcept; template - constexpr Error fieldCString(CRStringView name, Args&&...) noexcept; + constexpr Error fieldCString(StringViewCR name, Args&&...) noexcept; [[nodiscard]] constexpr DescriptorType *definition() noexcept { @@ -167,7 +167,7 @@ class TypeDescWriter { constexpr const DescriptorType *type(UnionView val) const noexcept; [[nodiscard]] - constexpr const DescriptorType *getType(CRStringView tn, int typeVersion, PrimitiveType t, int b, + constexpr const DescriptorType *getType(StringViewCR tn, int typeVersion, PrimitiveType t, int b, const TypeParamPack &typeParams = {}) const noexcept; }; @@ -176,8 +176,8 @@ constexpr TypeDescWriter::TypeDescWriter(TypeStore *typeStore) noexcept: m_typeS template constexpr ox::Error TypeDescWriter::setTypeInfo( - CRStringView typeName, int typeVersion, - const TypeParamPack &typeParams, std::size_t) noexcept { + StringViewCR typeName, int typeVersion, + const TypeParamPack &typeParams, std::size_t) noexcept { PrimitiveType pt; if constexpr(is_union_v) { pt = PrimitiveType::Union; @@ -193,7 +193,7 @@ constexpr ox::Error TypeDescWriter::setTypeInfo( // array handler template -constexpr Error TypeDescWriter::field(CRStringView name, const T*, std::size_t, const SubscriptStack &subscriptStack) noexcept { +constexpr Error TypeDescWriter::field(StringViewCR name, const T*, std::size_t, const SubscriptStack &subscriptStack) noexcept { if (m_type) { constexpr typename remove_pointer::type *p = nullptr; const auto t = type(p); @@ -205,7 +205,7 @@ constexpr Error TypeDescWriter::field(CRStringView name, const T*, std::size_t, } template -constexpr Error TypeDescWriter::field(CRStringView name, UnionView val) noexcept { +constexpr Error TypeDescWriter::field(StringViewCR name, UnionView val) noexcept { if (m_type) { const auto t = type(val); oxAssert(t != nullptr, "field(const char *name, T val): Type not found or generated"); @@ -216,7 +216,7 @@ constexpr Error TypeDescWriter::field(CRStringView name, UnionView val } template -constexpr Error TypeDescWriter::field(CRStringView name, const T *val) noexcept { +constexpr Error TypeDescWriter::field(StringViewCR name, const T *val) noexcept { if (m_type) { if constexpr(isVector_v || isArray_v) { typename T::value_type *data = nullptr; @@ -237,7 +237,7 @@ constexpr Error TypeDescWriter::field(CRStringView name, const T *val) noexcept } template -constexpr Error TypeDescWriter::fieldCString(CRStringView name, Args&&...) noexcept { +constexpr Error TypeDescWriter::fieldCString(StringViewCR name, Args&&...) noexcept { constexpr auto s = ""; const auto t = type(s); m_type->fieldList.emplace_back(t, String(name), 0, SubscriptStack{}, ox::String(t->typeName)); @@ -339,7 +339,7 @@ constexpr const DescriptorType *TypeDescWriter::type(const IString*) const n return getType(types::BString, 0, PT, 0); } -constexpr const DescriptorType *TypeDescWriter::getType(CRStringView tn, int typeVersion, PrimitiveType pt, int b, +constexpr const DescriptorType *TypeDescWriter::getType(StringViewCR tn, int typeVersion, PrimitiveType pt, int b, const TypeParamPack &typeParams) const noexcept { auto t = m_typeStore->get(tn, typeVersion, typeParams); if (!t.error) { diff --git a/deps/ox/src/ox/model/fieldcounter.hpp b/deps/ox/src/ox/model/fieldcounter.hpp index caebc412..55bd25f0 100644 --- a/deps/ox/src/ox/model/fieldcounter.hpp +++ b/deps/ox/src/ox/model/fieldcounter.hpp @@ -24,24 +24,24 @@ class FieldCounter { std::size_t fields = 0; template - constexpr ox::Error setTypeInfo(CRStringView = "", int = 0, const Vector& = {}, std::size_t = 0) { + constexpr ox::Error setTypeInfo(StringViewCR = "", int = 0, const Vector& = {}, std::size_t = 0) { return {}; } template - constexpr ox::Error field(CRStringView, U) noexcept { + constexpr ox::Error field(StringViewCR, U) noexcept { ++fields; return OxError(0); } template - constexpr ox::Error field(CRStringView, U, std::size_t) noexcept { + constexpr ox::Error field(StringViewCR, U, std::size_t) noexcept { ++fields; return OxError(0); } template - constexpr Error field(CRStringView, Handler) { + constexpr Error field(StringViewCR, Handler) { ++fields; return OxError(0); } diff --git a/deps/ox/src/ox/model/typestore.hpp b/deps/ox/src/ox/model/typestore.hpp index 298a71d8..4f39ea77 100644 --- a/deps/ox/src/ox/model/typestore.hpp +++ b/deps/ox/src/ox/model/typestore.hpp @@ -44,7 +44,7 @@ class TypeStore { return out->get(); } - constexpr DescriptorType *getInit(CRStringView typeName, int typeVersion, PrimitiveType pt, + constexpr DescriptorType *getInit(StringViewCR typeName, int typeVersion, PrimitiveType pt, const TypeParamPack &typeParams) noexcept { const auto typeId = buildTypeId(typeName, typeVersion, typeParams); auto &out = m_cache[typeId]; @@ -105,7 +105,7 @@ class TypeStore { return OxError(1); } - Result> loadDescriptor(ox::CRStringView name, int version, + Result> loadDescriptor(ox::StringViewCR name, int version, const ox::TypeParamPack &typeParams) noexcept { const auto typeId = buildTypeId(name, version, typeParams); return loadDescriptor(typeId); diff --git a/deps/ox/src/ox/preloader/alignmentcatcher.hpp b/deps/ox/src/ox/preloader/alignmentcatcher.hpp index 98ee847a..07b2fbb2 100644 --- a/deps/ox/src/ox/preloader/alignmentcatcher.hpp +++ b/deps/ox/src/ox/preloader/alignmentcatcher.hpp @@ -46,12 +46,12 @@ struct AlignmentCatcher: public ModelHandlerBase, OpT } template - constexpr ox::Error field(CRStringView name, const UnionView val) noexcept { + constexpr ox::Error field(StringViewCR name, const UnionView val) noexcept { return field(name, val.get()); } template - constexpr ox::Error field(CRStringView, const T *val) noexcept { + constexpr ox::Error field(StringViewCR, const T *val) noexcept { if constexpr(ox::is_pointer_v || ox::is_integer_v) { biggestAlignment = ox::max(biggestAlignment, PlatSpec::alignOf(*val)); } else { @@ -61,7 +61,7 @@ struct AlignmentCatcher: public ModelHandlerBase, OpT } template - constexpr ox::Error field(CRStringView, const T *val, std::size_t cnt) noexcept { + constexpr ox::Error field(StringViewCR, const T *val, std::size_t cnt) noexcept { for (std::size_t i = 0; i < cnt; ++i) { oxReturnError(field(nullptr, &val[i])); } diff --git a/deps/ox/src/ox/preloader/preloader.hpp b/deps/ox/src/ox/preloader/preloader.hpp index fd428bb3..cf49d00c 100644 --- a/deps/ox/src/ox/preloader/preloader.hpp +++ b/deps/ox/src/ox/preloader/preloader.hpp @@ -94,19 +94,19 @@ class Preloader: public ModelHandlerBase, OpType::Reflect> { } template - constexpr ox::Error field(CRStringView, ox::UnionView val) noexcept; + constexpr ox::Error field(StringViewCR, ox::UnionView val) noexcept; template - constexpr ox::Error field(CRStringView, const T *val) noexcept; + constexpr ox::Error field(StringViewCR, const T *val) noexcept; template - constexpr ox::Error field(CRStringView, const ox::BasicString *val) noexcept; + constexpr ox::Error field(StringViewCR, const ox::BasicString *val) noexcept; template - constexpr ox::Error field(CRStringView, const ox::Array *valArray) noexcept; + constexpr ox::Error field(StringViewCR, const ox::Array *valArray) noexcept; template - constexpr ox::Error field(CRStringView, const T **val, std::size_t cnt) noexcept; + constexpr ox::Error field(StringViewCR, const T **val, std::size_t cnt) noexcept; constexpr ox::Result startAlloc(size_t sz, size_t align) noexcept; @@ -125,14 +125,14 @@ class Preloader: public ModelHandlerBase, OpType::Reflect> { constexpr ox::Error pad(const T*) noexcept; private: - constexpr ox::Error fieldVector(CRStringView name, const ox::ModelValueVector *val) noexcept; + constexpr ox::Error fieldVector(StringViewCR name, const ox::ModelValueVector *val) noexcept; template - constexpr ox::Error fieldVector(CRStringView, const ox::Vector *val) noexcept; + constexpr ox::Error fieldVector(StringViewCR, const ox::Vector *val) noexcept; - constexpr ox::Error fieldVector(CRStringView, const auto *val, ox::VectorMemMap vecVal) noexcept; + constexpr ox::Error fieldVector(StringViewCR, const auto *val, ox::VectorMemMap vecVal) noexcept; - constexpr ox::Error fieldArray(CRStringView name, ox::ModelValueArray const*val) noexcept; + constexpr ox::Error fieldArray(StringViewCR name, ox::ModelValueArray const*val) noexcept; constexpr bool unionCheckAndIt() noexcept; @@ -158,7 +158,7 @@ Preloader::make(ox::ios_base::seekdir anchor, std::size_t sz) noexcept template template -constexpr ox::Error Preloader::field(CRStringView, const ox::UnionView val) noexcept { +constexpr ox::Error Preloader::field(StringViewCR, const ox::UnionView val) noexcept { if (!unionCheckAndIt()) { return {}; } @@ -171,7 +171,7 @@ constexpr ox::Error Preloader::field(CRStringView, const ox::UnionView template template -constexpr ox::Error Preloader::field(CRStringView name, const T *val) noexcept { +constexpr ox::Error Preloader::field(StringViewCR name, const T *val) noexcept { if (!unionCheckAndIt()) { return {}; } @@ -200,7 +200,7 @@ constexpr ox::Error Preloader::field(CRStringView name, const T *val) template template -constexpr ox::Error Preloader::field(CRStringView, const ox::BasicString *val) noexcept { +constexpr ox::Error Preloader::field(StringViewCR, const ox::BasicString *val) noexcept { if (!unionCheckAndIt()) { return {}; } @@ -230,7 +230,7 @@ constexpr ox::Error Preloader::field(CRStringView, const ox::BasicStri template template -constexpr ox::Error Preloader::field(CRStringView name, const ox::Array *val) noexcept { +constexpr ox::Error Preloader::field(StringViewCR name, const ox::Array *val) noexcept { if (!unionCheckAndIt()) { return {}; } @@ -248,7 +248,7 @@ constexpr ox::Error Preloader::field(CRStringView name, const ox::Arra template template -constexpr ox::Error Preloader::field(CRStringView, const T **val, std::size_t cnt) noexcept { +constexpr ox::Error Preloader::field(StringViewCR, const T **val, std::size_t cnt) noexcept { if (!unionCheckAndIt()) { return {}; } @@ -327,7 +327,7 @@ constexpr ox::Error Preloader::pad(const T *v) noexcept { template constexpr ox::Error Preloader::fieldVector( - CRStringView name, const ox::ModelValueVector *val) noexcept { + StringViewCR name, const ox::ModelValueVector *val) noexcept { // serialize the Vector ox::VectorMemMap vecVal{ .size = PlatSpec::correctEndianness(static_cast(val->size())), @@ -339,7 +339,7 @@ constexpr ox::Error Preloader::fieldVector( template template constexpr ox::Error Preloader::fieldVector( - CRStringView name, const ox::Vector *val) noexcept { + StringViewCR name, const ox::Vector *val) noexcept { // serialize the Vector ox::VectorMemMap vecVal{ .smallVecSize = SmallVectorSize * sizeOf(static_cast(nullptr)), @@ -353,7 +353,7 @@ constexpr ox::Error Preloader::fieldVector( template constexpr ox::Error Preloader::fieldVector( - CRStringView, const auto *val, ox::VectorMemMap vecVal) noexcept { + StringViewCR, const auto *val, ox::VectorMemMap vecVal) noexcept { oxReturnError(pad(&vecVal)); const auto vecValPt = m_writer.tellp(); // serialize the Vector elements @@ -383,7 +383,7 @@ constexpr ox::Error Preloader::fieldVector( } template -constexpr ox::Error Preloader::fieldArray(CRStringView, ox::ModelValueArray const*val) noexcept { +constexpr ox::Error Preloader::fieldArray(StringViewCR, ox::ModelValueArray const*val) noexcept { oxReturnError(pad(&(*val)[0])); for (auto const&v : *val) { oxReturnError(this->interface()->field({}, &v)); diff --git a/deps/ox/src/ox/preloader/unionsizecatcher.hpp b/deps/ox/src/ox/preloader/unionsizecatcher.hpp index 9e2d8c02..34682000 100644 --- a/deps/ox/src/ox/preloader/unionsizecatcher.hpp +++ b/deps/ox/src/ox/preloader/unionsizecatcher.hpp @@ -41,7 +41,7 @@ class UnionSizeCatcher: public ModelHandlerBase, OpTy } template - constexpr ox::Error field(CRStringView, const UnionView val) noexcept { + constexpr ox::Error field(StringViewCR, const UnionView val) noexcept { UnionSizeCatcher sc; oxReturnError(model(sc.interface(), val.get())); m_size += sc.size(); @@ -49,10 +49,10 @@ class UnionSizeCatcher: public ModelHandlerBase, OpTy } template - constexpr ox::Error field(CRStringView, const T *val) noexcept; + constexpr ox::Error field(StringViewCR, const T *val) noexcept; template - constexpr ox::Error field(CRStringView, const T **val, std::size_t cnt) noexcept; + constexpr ox::Error field(StringViewCR, const T **val, std::size_t cnt) noexcept; [[nodiscard]] constexpr auto size() const noexcept { @@ -61,24 +61,24 @@ class UnionSizeCatcher: public ModelHandlerBase, OpTy private: template - constexpr ox::Error fieldStr(CRStringView, const ox::BasicString *val) noexcept; + constexpr ox::Error fieldStr(StringViewCR, const ox::BasicString *val) noexcept; template - constexpr ox::Error fieldVector(CRStringView, const ox::Vector *val) noexcept; + constexpr ox::Error fieldVector(StringViewCR, const ox::Vector *val) noexcept; constexpr void setSize(std::size_t sz) noexcept; }; template template -constexpr ox::Error UnionSizeCatcher::field(CRStringView, const T *val) noexcept { +constexpr ox::Error UnionSizeCatcher::field(StringViewCR, const T *val) noexcept { setSize(sizeOf(val)); return {}; } template template -constexpr ox::Error UnionSizeCatcher::field(CRStringView, const T **val, std::size_t cnt) noexcept { +constexpr ox::Error UnionSizeCatcher::field(StringViewCR, const T **val, std::size_t cnt) noexcept { for (std::size_t i = 0; i < cnt; ++i) { oxReturnError(field("", &val[i])); } @@ -87,7 +87,7 @@ constexpr ox::Error UnionSizeCatcher::field(CRStringView, const T **va template template -constexpr ox::Error UnionSizeCatcher::fieldStr(CRStringView, const ox::BasicString*) noexcept { +constexpr ox::Error UnionSizeCatcher::fieldStr(StringViewCR, const ox::BasicString*) noexcept { ox::VectorMemMap v; setSize(sizeOf(v)); return {}; @@ -95,7 +95,7 @@ constexpr ox::Error UnionSizeCatcher::fieldStr(CRStringView, const ox: template template -constexpr ox::Error UnionSizeCatcher::fieldVector(CRStringView, const ox::Vector*) noexcept { +constexpr ox::Error UnionSizeCatcher::fieldVector(StringViewCR, const ox::Vector*) noexcept { ox::VectorMemMap v; setSize(sizeOf(v)); return {}; diff --git a/deps/ox/src/ox/std/assert.hpp b/deps/ox/src/ox/std/assert.hpp index b8d12a14..4ea28bf1 100644 --- a/deps/ox/src/ox/std/assert.hpp +++ b/deps/ox/src/ox/std/assert.hpp @@ -22,9 +22,9 @@ namespace ox { -void panic(CRStringView file, int line, CRStringView panicMsg, const Error &err = OxError(0)) noexcept; +void panic(StringViewCR file, int line, StringViewCR panicMsg, const Error &err = OxError(0)) noexcept; -constexpr void constexprPanic(CRStringView file, int line, CRStringView panicMsg, const Error &err = OxError(0)) noexcept { +constexpr void constexprPanic(StringViewCR file, int line, StringViewCR 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(CRStringView file, int line, CRStringView panicMsg } } -constexpr void assertFunc(CRStringView file, int line, bool pass, [[maybe_unused]]CRStringView assertTxt, [[maybe_unused]]CRStringView msg) noexcept { +constexpr void assertFunc(StringViewCR file, int line, bool pass, [[maybe_unused]]StringViewCR assertTxt, [[maybe_unused]]StringViewCR msg) noexcept { if (!pass) { if (!std::is_constant_evaluated()) { #ifdef OX_USE_STDLIB @@ -51,7 +51,7 @@ constexpr void assertFunc(CRStringView file, int line, bool pass, [[maybe_unused } } -constexpr void assertFunc(CRStringView file, int line, const Error &err, CRStringView, CRStringView assertMsg) noexcept { +constexpr void assertFunc(StringViewCR file, int line, const Error &err, StringViewCR, StringViewCR assertMsg) noexcept { if (err) { if (!std::is_constant_evaluated()) { #if defined(OX_USE_STDLIB) @@ -76,7 +76,7 @@ constexpr void assertFunc(CRStringView file, int line, const Error &err, CRStrin } } -constexpr void expect(CRStringView file, int line, const auto &actual, const auto &expected) noexcept { +constexpr void expect(StringViewCR file, int line, const auto &actual, const auto &expected) noexcept { if (actual != expected) { if (!std::is_constant_evaluated()) { #if defined(OX_USE_STDLIB) diff --git a/deps/ox/src/ox/std/istring.hpp b/deps/ox/src/ox/std/istring.hpp index 83dea255..118e6bd1 100644 --- a/deps/ox/src/ox/std/istring.hpp +++ b/deps/ox/src/ox/std/istring.hpp @@ -35,7 +35,7 @@ class IString { constexpr IString(const char *str) noexcept; - constexpr IString &operator=(CRStringView str) noexcept; + constexpr IString &operator=(StringViewCR str) noexcept; constexpr IString &operator=(const char *str) noexcept; @@ -119,7 +119,7 @@ constexpr IString &IString::operator=(Integer_c auto i) noexcept { } template -constexpr IString &IString::operator=(ox::CRStringView str) noexcept { +constexpr IString &IString::operator=(ox::StringViewCR str) noexcept { std::size_t strLen = str.len(); if (cap() < strLen) { strLen = cap(); diff --git a/deps/ox/src/ox/std/string.hpp b/deps/ox/src/ox/std/string.hpp index 324e243f..7c43bb9f 100644 --- a/deps/ox/src/ox/std/string.hpp +++ b/deps/ox/src/ox/std/string.hpp @@ -46,7 +46,7 @@ class BasicString { constexpr explicit BasicString(StringLiteral const&str) noexcept; - constexpr explicit BasicString(CRStringView str) noexcept; + constexpr explicit BasicString(StringViewCR str) noexcept; constexpr explicit BasicString(BasicString const&) noexcept; @@ -126,7 +126,7 @@ class BasicString { constexpr BasicString &operator=(BasicString &&src) noexcept; - constexpr BasicString &operator=(CRStringView src) noexcept; + constexpr BasicString &operator=(StringViewCR src) noexcept; constexpr BasicString &operator+=(const char *str) noexcept; @@ -148,7 +148,7 @@ class BasicString { constexpr BasicString operator+(Integer_c auto i) const noexcept; - constexpr BasicString operator+(CRStringView src) const noexcept; + constexpr BasicString operator+(StringViewCR src) const noexcept; constexpr BasicString operator+(BasicString const&src) const noexcept; @@ -243,7 +243,7 @@ class BasicString { constexpr std::size_t bytes() const noexcept; private: - constexpr void set(CRStringView str) noexcept; + constexpr void set(StringViewCR str) noexcept; constexpr void set(const char8_t *str) noexcept; }; @@ -278,7 +278,7 @@ constexpr BasicString::BasicString(StringLiteral const&str) n } template -constexpr BasicString::BasicString(CRStringView str) noexcept { +constexpr BasicString::BasicString(StringViewCR str) noexcept { set(str); } @@ -343,7 +343,7 @@ constexpr BasicString &BasicString::operat } template -constexpr BasicString &BasicString::operator=(CRStringView src) noexcept { +constexpr BasicString &BasicString::operator=(StringViewCR src) noexcept { set(src); return *this; } @@ -416,7 +416,7 @@ constexpr BasicString BasicString::operato } template -constexpr BasicString BasicString::operator+(CRStringView src) const noexcept { +constexpr BasicString BasicString::operator+(StringViewCR src) const noexcept { const std::size_t strLen = src.len(); const auto currentLen = len(); BasicString cpy(currentLen + strLen); @@ -521,7 +521,7 @@ constexpr std::size_t BasicString::len() const noexcept { } template -constexpr void BasicString::set(CRStringView str) noexcept { +constexpr void BasicString::set(StringViewCR str) noexcept { std::size_t const strBytes = str.bytes(); m_buff.resize(strBytes + 1); copy_n(str.data(), strBytes, m_buff.data()); @@ -543,7 +543,7 @@ using CRString = String const&; [[nodiscard]] -constexpr ox::String toString(ox::CRStringView sv) noexcept { +constexpr ox::String toString(ox::StringViewCR sv) noexcept { return ox::String(sv); } diff --git a/deps/ox/src/ox/std/stringview.hpp b/deps/ox/src/ox/std/stringview.hpp index 63f57a9a..c9c6af77 100644 --- a/deps/ox/src/ox/std/stringview.hpp +++ b/deps/ox/src/ox/std/stringview.hpp @@ -58,16 +58,16 @@ class StringView: public detail::BaseStringView { }; -using CRStringView = const StringView&; +using StringViewCR = const StringView&; -constexpr auto operator==(CRStringView s1, CRStringView s2) noexcept { +constexpr auto operator==(StringViewCR s1, StringViewCR s2) noexcept { if (s2.len() != s1.len()) { return false; } return ox::strncmp(s1.data(), s2.data(), s1.len()) == 0; } -constexpr auto operator<=>(CRStringView s1, CRStringView s2) noexcept { +constexpr auto operator<=>(StringViewCR s1, StringViewCR s2) noexcept { const auto maxLen = ox::min(s1.len(), s2.len()); const auto a = &s1.front(); const auto b = &s2.front(); @@ -87,18 +87,18 @@ constexpr auto operator<=>(CRStringView s1, CRStringView s2) noexcept { } } -constexpr auto write(Writer_c auto &writer, ox::CRStringView sv) noexcept { +constexpr auto write(Writer_c auto &writer, ox::StringViewCR sv) noexcept { return writer.write(sv.data(), sv.bytes()); } #ifdef OX_USE_STDLIB -constexpr auto toStdStringView(CRStringView sv) noexcept { +constexpr auto toStdStringView(StringViewCR sv) noexcept { return std::string_view(sv.data(), sv.bytes()); } #endif -constexpr ox::Result atoi(ox::CRStringView str) noexcept { +constexpr ox::Result atoi(ox::StringViewCR str) noexcept { int total = 0; int multiplier = 1; for (auto i = static_cast(str.len()) - 1; i != -1; --i) { diff --git a/deps/ox/src/ox/std/strops.hpp b/deps/ox/src/ox/std/strops.hpp index ef0dfa20..260ec83d 100644 --- a/deps/ox/src/ox/std/strops.hpp +++ b/deps/ox/src/ox/std/strops.hpp @@ -34,19 +34,19 @@ constexpr ox::StringView substr(ox::StringView const&str, std::size_t start, std } [[nodiscard]] -constexpr bool beginsWith(CRStringView base, CRStringView beginning) noexcept { +constexpr bool beginsWith(StringViewCR base, StringViewCR beginning) noexcept { const auto beginningLen = ox::min(beginning.len(), base.len()); return base.len() >= beginning.len() && ox::strncmp(base.data(), beginning, beginningLen) == 0; } [[nodiscard]] -constexpr bool endsWith(CRStringView base, CRStringView ending) noexcept { +constexpr bool endsWith(StringViewCR base, StringViewCR ending) noexcept { const auto endingLen = ending.len(); return base.len() >= endingLen && ox::strcmp(base.data() + (base.len() - endingLen), ending) == 0; } [[nodiscard]] -constexpr std::size_t find(CRStringView str, char search) noexcept { +constexpr std::size_t find(StringViewCR str, char search) noexcept { std::size_t i = 0; for (; i < str.len(); ++i) { if (str[i] == search) { @@ -57,7 +57,7 @@ constexpr std::size_t find(CRStringView str, char search) noexcept { } [[nodiscard]] -constexpr std::size_t find(CRStringView str, CRStringView search) noexcept { +constexpr std::size_t find(StringViewCR str, StringViewCR search) noexcept { std::size_t i = 0; for (; i < str.len(); ++i) { if (beginsWith(substr(str, i), search)) { @@ -69,9 +69,9 @@ constexpr std::size_t find(CRStringView str, CRStringView search) noexcept { template [[nodiscard]] -constexpr ox::Vector split(CRStringView str, char del) noexcept { +constexpr ox::Vector split(StringViewCR str, char del) noexcept { ox::Vector out; - constexpr auto nextSeg = [](CRStringView current, char del) { + constexpr auto nextSeg = [](StringViewCR current, char del) { return substr(current, find(current, del) + 1); }; for (auto current = str; current.len(); current = nextSeg(current, del)) { @@ -86,9 +86,9 @@ constexpr ox::Vector split(CRStringView str, char del) template [[nodiscard]] -constexpr ox::Vector split(CRStringView str, CRStringView del) noexcept { +constexpr ox::Vector split(StringViewCR str, StringViewCR del) noexcept { ox::Vector out; - constexpr auto nextSeg = [](CRStringView current, CRStringView del) { + constexpr auto nextSeg = [](StringViewCR current, StringViewCR del) { return substr(current, find(current, del) + del.len()); }; for (auto current = str; current.len(); current = nextSeg(current, del)) { @@ -102,7 +102,7 @@ constexpr ox::Vector split(CRStringView str, CRStringVi } [[nodiscard]] -constexpr ox::Result lastIndexOf(ox::CRStringView str, int character) noexcept { +constexpr ox::Result lastIndexOf(ox::StringViewCR str, int character) noexcept { ox::Result retval = OxError(1, "Character not found"); for (auto i = static_cast(str.bytes() - 1); i >= 0; --i) { if (str[static_cast(i)] == character) { diff --git a/deps/ox/src/ox/std/tracehook.cpp b/deps/ox/src/ox/std/tracehook.cpp index 740322b7..fd194b44 100644 --- a/deps/ox/src/ox/std/tracehook.cpp +++ b/deps/ox/src/ox/std/tracehook.cpp @@ -24,10 +24,10 @@ static const auto OxPrintTrace = std::getenv("OXTRACE") != nullptr; #define REG_MGBA_DEBUG_FLAGS *reinterpret_cast(0x4FFF700) #define REG_MGBA_DEBUG_STRING (reinterpret_cast(0x4FFF600)) -inline void nullLog(ox::CRStringView) {} -inline void (*infoLog)(ox::CRStringView) = nullLog; -inline void (*debugLog)(ox::CRStringView) = nullLog; -inline void (*errorLog)(ox::CRStringView) = nullLog; +inline void nullLog(ox::StringViewCR) {} +inline void (*infoLog)(ox::StringViewCR) = nullLog; +inline void (*debugLog)(ox::StringViewCR) = nullLog; +inline void (*errorLog)(ox::StringViewCR) = nullLog; namespace mgba { @@ -40,7 +40,7 @@ enum LogChan { }; template -static void log(ox::CRStringView str) { +static void log(ox::StringViewCR str) { const auto sz = ox::min(0x100, str.bytes()); ox::strncpy(REG_MGBA_DEBUG_STRING, str.data(), sz); REG_MGBA_DEBUG_FLAGS = chan | 0x100; diff --git a/deps/ox/src/ox/std/uuid.hpp b/deps/ox/src/ox/std/uuid.hpp index 80b66f1b..5e55925b 100644 --- a/deps/ox/src/ox/std/uuid.hpp +++ b/deps/ox/src/ox/std/uuid.hpp @@ -31,7 +31,7 @@ constexpr auto isHexChar(char c) noexcept { || (c >= 'A' && c <= 'F'); } -constexpr ox::Result fromHex(ox::CRStringView v) noexcept { +constexpr ox::Result fromHex(ox::StringViewCR v) noexcept { constexpr auto valMap = [] { ox::Array out; out['A'] = out['a'] = 10; @@ -125,7 +125,7 @@ class UUID { } } - static constexpr ox::Result fromString(ox::CRStringView s) noexcept { + static constexpr ox::Result fromString(ox::StringViewCR s) noexcept { if (s.len() < 36) { return OxError(1, "Insufficient data to contain a complete UUID"); }