From 6b720042d0604131df1ff69a1ba3e35d083851ac Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Fri, 16 Oct 2020 19:43:10 -0500 Subject: [PATCH] [ox] Rename ValErr to Result --- deps/ox/src/ox/claw/read.cpp | 4 +- deps/ox/src/ox/claw/read.hpp | 4 +- deps/ox/src/ox/claw/write.hpp | 4 +- .../src/ox/fs/filestore/filestoretemplate.hpp | 12 +++--- deps/ox/src/ox/fs/filesystem/directory.hpp | 8 ++-- deps/ox/src/ox/fs/filesystem/filelocation.hpp | 4 +- deps/ox/src/ox/fs/filesystem/filesystem.cpp | 4 +- deps/ox/src/ox/fs/filesystem/filesystem.hpp | 40 +++++++++---------- .../ox/src/ox/fs/filesystem/passthroughfs.cpp | 8 ++-- .../ox/src/ox/fs/filesystem/passthroughfs.hpp | 8 ++-- deps/ox/src/ox/fs/filesystem/pathiterator.cpp | 2 +- deps/ox/src/ox/fs/filesystem/pathiterator.hpp | 2 +- deps/ox/src/ox/mc/intops.hpp | 4 +- deps/ox/src/ox/mc/presenceindicator.cpp | 2 +- deps/ox/src/ox/mc/presenceindicator.hpp | 2 +- deps/ox/src/ox/mc/read.cpp | 2 +- deps/ox/src/ox/mc/read.hpp | 2 +- deps/ox/src/ox/mc/write.hpp | 2 +- deps/ox/src/ox/model/descwrite.hpp | 2 +- deps/ox/src/ox/oc/read.cpp | 2 +- deps/ox/src/ox/oc/read.hpp | 4 +- deps/ox/src/ox/oc/write.hpp | 4 +- deps/ox/src/ox/std/error.hpp | 10 ++--- 23 files changed, 68 insertions(+), 68 deletions(-) diff --git a/deps/ox/src/ox/claw/read.cpp b/deps/ox/src/ox/claw/read.cpp index 3c69dcad..7adbb6b6 100644 --- a/deps/ox/src/ox/claw/read.cpp +++ b/deps/ox/src/ox/claw/read.cpp @@ -12,7 +12,7 @@ namespace ox { namespace detail { -ValErr readHeader(const char *buff, std::size_t buffLen) noexcept { +Result readHeader(const char *buff, std::size_t buffLen) noexcept { const auto s1End = ox_strchr(buff, ';', buffLen); if (!s1End) { return OxError(1); @@ -57,7 +57,7 @@ ValErr readHeader(const char *buff, std::size_t buffLen) noexcept { } -ValErr> stripClawHeader(const char *buff, std::size_t buffLen) noexcept { +Result> stripClawHeader(const char *buff, std::size_t buffLen) noexcept { auto header = detail::readHeader(buff, buffLen); oxReturnError(header); Vector out(header.value.dataSize); diff --git a/deps/ox/src/ox/claw/read.hpp b/deps/ox/src/ox/claw/read.hpp index aad7af5e..0bcdc8cd 100644 --- a/deps/ox/src/ox/claw/read.hpp +++ b/deps/ox/src/ox/claw/read.hpp @@ -27,11 +27,11 @@ struct ClawHeader { std::size_t dataSize = 0; }; -ValErr readHeader(const char *buff, std::size_t buffLen) noexcept; +Result readHeader(const char *buff, std::size_t buffLen) noexcept; } -ValErr> stripClawHeader(const char *buff, std::size_t buffLen) noexcept; +Result> stripClawHeader(const char *buff, std::size_t buffLen) noexcept; template Error readClaw(char *buff, std::size_t buffLen, T *val) { diff --git a/deps/ox/src/ox/claw/write.hpp b/deps/ox/src/ox/claw/write.hpp index e6f70b17..8347e617 100644 --- a/deps/ox/src/ox/claw/write.hpp +++ b/deps/ox/src/ox/claw/write.hpp @@ -65,7 +65,7 @@ constexpr const char *getTypeName(T *t) noexcept { } template -ValErr writeClawHeader(T *t, ClawFormat fmt) noexcept { +Result writeClawHeader(T *t, ClawFormat fmt) noexcept { String out; switch (fmt) { case ClawFormat::Metal: @@ -90,7 +90,7 @@ ValErr writeClawHeader(T *t, ClawFormat fmt) noexcept { } template -ValErr> writeClaw(T *t, ClawFormat fmt) { +Result> writeClaw(T *t, ClawFormat fmt) { auto [header, headerErr] = detail::writeClawHeader(t, fmt); oxReturnError(headerErr); const auto [data, dataErr] = fmt == ClawFormat::Metal ? writeMC(t) : writeOC(t); diff --git a/deps/ox/src/ox/fs/filestore/filestoretemplate.hpp b/deps/ox/src/ox/fs/filestore/filestoretemplate.hpp index d8cb2898..4591286f 100644 --- a/deps/ox/src/ox/fs/filestore/filestoretemplate.hpp +++ b/deps/ox/src/ox/fs/filestore/filestoretemplate.hpp @@ -110,7 +110,7 @@ class FileStoreTemplate { FsSize_t readSize, T *data, FsSize_t *size) const; - ValErr stat(InodeId_t id); + Result stat(InodeId_t id); Error resize(); @@ -126,7 +126,7 @@ class FileStoreTemplate { Error walk(Error(*cb)(uint8_t, uint64_t, uint64_t)); - ValErr generateInodeId(); + Result generateInodeId(); bool valid() const; @@ -435,17 +435,17 @@ Error FileStoreTemplate::resize(std::size_t size, void *newBuff) { } template -ValErr FileStoreTemplate::stat(InodeId_t id) { +Result FileStoreTemplate::stat(InodeId_t id) { auto inode = find(id); if (inode.valid()) { - return ValErr({ + return Result({ id, inode->links, inode->size(), inode->fileType, }); } - return ValErr({}, OxError(0)); + return Result({}, OxError(0)); } template @@ -477,7 +477,7 @@ Error FileStoreTemplate::walk(Error(*cb)(uint8_t, uint64_t, uint64_t)) { } template -ValErr::InodeId_t> FileStoreTemplate::generateInodeId() { +Result::InodeId_t> FileStoreTemplate::generateInodeId() { auto fsData = fileStoreData(); if (fsData) { for (auto i = 0; i < 100; i++) { diff --git a/deps/ox/src/ox/fs/filesystem/directory.hpp b/deps/ox/src/ox/fs/filesystem/directory.hpp index bd527c4f..2939087c 100644 --- a/deps/ox/src/ox/fs/filesystem/directory.hpp +++ b/deps/ox/src/ox/fs/filesystem/directory.hpp @@ -113,9 +113,9 @@ class Directory { template Error ls(F cb) noexcept; - ValErr findEntry(const FileName &name) const noexcept; + Result findEntry(const FileName &name) const noexcept; - ValErr find(PathIterator name, FileName *nameBuff = nullptr) const noexcept; + Result find(PathIterator name, FileName *nameBuff = nullptr) const noexcept; }; @@ -314,7 +314,7 @@ ox::Error Directory::ls(F cb) noexcept { } template -ValErr Directory::findEntry(const FileName &name) const noexcept { +Result Directory::findEntry(const FileName &name) const noexcept { oxTrace("ox::fs::Directory::findEntry") << name.c_str(); auto buff = m_fs.read(m_inodeId).template to(); if (!buff.valid()) { @@ -339,7 +339,7 @@ ValErr Directory::findEntry } template -ValErr Directory::find(PathIterator path, FileName *nameBuff) const noexcept { +Result Directory::find(PathIterator path, FileName *nameBuff) const noexcept { // reuse nameBuff if it has already been allocated, as it is a rather large variable if (nameBuff == nullptr) { nameBuff = reinterpret_cast(ox_alloca(sizeof(FileName))); diff --git a/deps/ox/src/ox/fs/filesystem/filelocation.hpp b/deps/ox/src/ox/fs/filesystem/filelocation.hpp index 96cd7594..62baa878 100644 --- a/deps/ox/src/ox/fs/filesystem/filelocation.hpp +++ b/deps/ox/src/ox/fs/filesystem/filelocation.hpp @@ -68,7 +68,7 @@ class FileAddress { } } - ValErr getInode() const noexcept { + Result getInode() const noexcept { switch (m_type) { case FileAddressType::Inode: return m_data.inode; @@ -77,7 +77,7 @@ class FileAddress { } } - ValErr getPath() const noexcept { + Result getPath() const noexcept { switch (m_type) { case FileAddressType::Path: return m_data.path; diff --git a/deps/ox/src/ox/fs/filesystem/filesystem.cpp b/deps/ox/src/ox/fs/filesystem/filesystem.cpp index ca771818..751f8b8d 100644 --- a/deps/ox/src/ox/fs/filesystem/filesystem.cpp +++ b/deps/ox/src/ox/fs/filesystem/filesystem.cpp @@ -10,7 +10,7 @@ namespace ox { -ValErr FileSystem::read(FileAddress addr) { +Result FileSystem::read(FileAddress addr) { switch (addr.type()) { case FileAddressType::Inode: return read(addr.getInode().value); @@ -70,7 +70,7 @@ ox::Error FileSystem::write(FileAddress addr, void *buffer, uint64_t size, uint8 } } -ox::ValErr FileSystem::stat(FileAddress addr) { +ox::Result FileSystem::stat(FileAddress addr) { switch (addr.type()) { case FileAddressType::Inode: return stat(addr.getInode().value); diff --git a/deps/ox/src/ox/fs/filesystem/filesystem.hpp b/deps/ox/src/ox/fs/filesystem/filesystem.hpp index 35afd60d..1fd12294 100644 --- a/deps/ox/src/ox/fs/filesystem/filesystem.hpp +++ b/deps/ox/src/ox/fs/filesystem/filesystem.hpp @@ -32,19 +32,19 @@ class FileSystem { virtual Error read(const char *path, void *buffer, std::size_t buffSize) = 0; - virtual ValErr read(const char *path) = 0; + virtual Result read(const char *path) = 0; virtual Error read(uint64_t inode, void *buffer, std::size_t size) = 0; virtual Error read(uint64_t inode, std::size_t readStart, std::size_t readSize, void *buffer, std::size_t *size) = 0; - virtual ValErr read(uint64_t inode) = 0; + virtual Result read(uint64_t inode) = 0; Error read(FileAddress addr, void *buffer, std::size_t size); Error read(FileAddress addr, std::size_t readStart, std::size_t readSize, void *buffer, std::size_t *size); - ValErr read(FileAddress addr); + Result read(FileAddress addr); virtual Error remove(const char *path, bool recursive = false) = 0; @@ -58,11 +58,11 @@ class FileSystem { Error write(FileAddress addr, void *buffer, uint64_t size, uint8_t fileType = FileType_NormalFile); - virtual ValErr stat(uint64_t inode) = 0; + virtual Result stat(uint64_t inode) = 0; - virtual ValErr stat(const char *path) = 0; + virtual Result stat(const char *path) = 0; - ValErr stat(FileAddress addr); + Result stat(FileAddress addr); [[nodiscard]] virtual uint64_t spaceNeeded(uint64_t size) = 0; @@ -113,13 +113,13 @@ class FileSystemTemplate: public FileSystem { Error read(const char *path, void *buffer, std::size_t buffSize) override; - ValErr read(const char*) override; + Result read(const char*) override; Error read(uint64_t inode, void *buffer, std::size_t size) override; Error read(uint64_t inode, std::size_t readStart, std::size_t readSize, void *buffer, std::size_t *size) override; - ValErr read(uint64_t) override; + Result read(uint64_t) override; template Error ls(const char *dir, F cb); @@ -137,9 +137,9 @@ class FileSystemTemplate: public FileSystem { Error write(uint64_t inode, void *buffer, uint64_t size, uint8_t fileType = FileType_NormalFile) override; - ValErr stat(uint64_t inode) override; + Result stat(uint64_t inode) override; - ValErr stat(const char *path) override; + Result stat(const char *path) override; uint64_t spaceNeeded(uint64_t size) override; @@ -154,14 +154,14 @@ class FileSystemTemplate: public FileSystem { bool valid() const override; private: - ValErr fileSystemData() const noexcept; + Result fileSystemData() const noexcept; /** * Finds the inode ID at the given path. */ - ValErr find(const char *path) const noexcept; + Result find(const char *path) const noexcept; - ValErr rootDir() const noexcept; + Result rootDir() const noexcept; }; @@ -236,7 +236,7 @@ ox::Error FileSystemTemplate::read(const char *path, void } template -ValErr FileSystemTemplate::read(const char *path) { +Result FileSystemTemplate::read(const char *path) { auto fd = fileSystemData(); oxReturnError(fd.error); Directory rootDir(m_fs, fd.value.rootDirInode); @@ -256,7 +256,7 @@ ox::Error FileSystemTemplate::read(uint64_t inode, std::si } template -ValErr FileSystemTemplate::read(uint64_t inode) { +Result FileSystemTemplate::read(uint64_t inode) { auto data = m_fs.read(inode); if (!data.valid()) { return OxError(1); @@ -328,7 +328,7 @@ ox::Error FileSystemTemplate::write(uint64_t inode, void * } template -ValErr FileSystemTemplate::stat(uint64_t inode) { +Result FileSystemTemplate::stat(uint64_t inode) { auto s = m_fs.stat(inode); FileStat out; out.inode = s.value.inode; @@ -339,7 +339,7 @@ ValErr FileSystemTemplate::stat(uint64_t inode) } template -ValErr FileSystemTemplate::stat(const char *path) { +Result FileSystemTemplate::stat(const char *path) { auto inode = find(path); if (inode.error) { return {{}, inode.error}; @@ -378,7 +378,7 @@ bool FileSystemTemplate::valid() const { } template -ValErr::FileSystemData> FileSystemTemplate::fileSystemData() const noexcept { +Result::FileSystemData> FileSystemTemplate::fileSystemData() const noexcept { FileSystemData fd; auto err = m_fs.read(InodeFsData, &fd, sizeof(fd)); if (err != 0) { @@ -388,7 +388,7 @@ ValErr::FileSystemData> FileSy } template -ValErr FileSystemTemplate::find(const char *path) const noexcept { +Result FileSystemTemplate::find(const char *path) const noexcept { auto fd = fileSystemData(); if (fd.error) { return {0, fd.error}; @@ -406,7 +406,7 @@ ValErr FileSystemTemplate::find(const char *path } template -ValErr FileSystemTemplate::rootDir() const noexcept { +Result FileSystemTemplate::rootDir() const noexcept { auto fd = fileSystemData(); if (fd.error) { return {{}, fd.error}; diff --git a/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp b/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp index 44e42019..9e17d5ef 100644 --- a/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp +++ b/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp @@ -64,7 +64,7 @@ Error PassThroughFS::read(const char *path, void *buffer, std::size_t buffSize) return OxError(0); } -ValErr PassThroughFS::read(const char*) { +Result PassThroughFS::read(const char*) { return OxError(1); } @@ -78,7 +78,7 @@ Error PassThroughFS::read(uint64_t, std::size_t, std::size_t, void*, std::size_t return OxError(1); } -ValErr PassThroughFS::read(uint64_t) { +Result PassThroughFS::read(uint64_t) { return OxError(1); } @@ -112,12 +112,12 @@ Error PassThroughFS::write(uint64_t, void*, uint64_t, uint8_t) { return OxError(1); } -ValErr PassThroughFS::stat(uint64_t) { +Result PassThroughFS::stat(uint64_t) { // unsupported return {{}, OxError(1)}; } -ValErr PassThroughFS::stat(const char *path) { +Result PassThroughFS::stat(const char *path) { std::error_code ec; const auto p = m_path / stripSlash(path); uint8_t type = std::filesystem::is_directory(p, ec) ? diff --git a/deps/ox/src/ox/fs/filesystem/passthroughfs.hpp b/deps/ox/src/ox/fs/filesystem/passthroughfs.hpp index ff5464ce..3a98d4fb 100644 --- a/deps/ox/src/ox/fs/filesystem/passthroughfs.hpp +++ b/deps/ox/src/ox/fs/filesystem/passthroughfs.hpp @@ -43,13 +43,13 @@ class PassThroughFS: public FileSystem { ox::Error read(const char *path, void *buffer, std::size_t buffSize) override; - ox::ValErr read(const char*) override; + ox::Result read(const char*) override; ox::Error read(uint64_t inode, void *buffer, std::size_t size) override; ox::Error read(uint64_t inode, std::size_t readStart, std::size_t readSize, void *buffer, std::size_t *size) override; - ox::ValErr read(uint64_t) override; + ox::Result read(uint64_t) override; template ox::Error ls(const char *dir, F cb); @@ -62,9 +62,9 @@ class PassThroughFS: public FileSystem { ox::Error write(uint64_t inode, void *buffer, uint64_t size, uint8_t fileType = FileType_NormalFile) override; - ox::ValErr stat(uint64_t inode) override; + ox::Result stat(uint64_t inode) override; - ox::ValErr stat(const char *path) override; + ox::Result stat(const char *path) override; uint64_t spaceNeeded(uint64_t size) override; diff --git a/deps/ox/src/ox/fs/filesystem/pathiterator.cpp b/deps/ox/src/ox/fs/filesystem/pathiterator.cpp index 3d0a9191..146f99fe 100644 --- a/deps/ox/src/ox/fs/filesystem/pathiterator.cpp +++ b/deps/ox/src/ox/fs/filesystem/pathiterator.cpp @@ -140,7 +140,7 @@ Error PathIterator::next(BString *fileName) { return next(fileName->data(), fileName->cap()); } -ValErr PathIterator::nextSize() const { +Result PathIterator::nextSize() const { std::size_t size = 0; auto retval = OxError(1); auto it = m_iterator; diff --git a/deps/ox/src/ox/fs/filesystem/pathiterator.hpp b/deps/ox/src/ox/fs/filesystem/pathiterator.hpp index 3d4172c5..4f6a61fc 100644 --- a/deps/ox/src/ox/fs/filesystem/pathiterator.hpp +++ b/deps/ox/src/ox/fs/filesystem/pathiterator.hpp @@ -59,7 +59,7 @@ class PathIterator { /** * @return 0 if no error */ - ValErr nextSize() const; + Result nextSize() const; bool hasNext() const; diff --git a/deps/ox/src/ox/mc/intops.hpp b/deps/ox/src/ox/mc/intops.hpp index e1a35524..2fb33154 100644 --- a/deps/ox/src/ox/mc/intops.hpp +++ b/deps/ox/src/ox/mc/intops.hpp @@ -114,7 +114,7 @@ static_assert(countBytes(0b01111111) == 8); static_assert(countBytes(0b11111111) == 9); template -ValErr decodeInteger(uint8_t buff[9], std::size_t buffLen, std::size_t *bytesRead) noexcept { +Result decodeInteger(uint8_t buff[9], std::size_t buffLen, std::size_t *bytesRead) noexcept { const auto bytes = countBytes(buff[0]); if (bytes == 9) { *bytesRead = bytes; @@ -144,7 +144,7 @@ ValErr decodeInteger(uint8_t buff[9], std::size_t buffLen, std::size_t *bytes } template -ValErr decodeInteger(McInt m) noexcept { +Result decodeInteger(McInt m) noexcept { std::size_t bytesRead; return decodeInteger(m.data, 9, &bytesRead); } diff --git a/deps/ox/src/ox/mc/presenceindicator.cpp b/deps/ox/src/ox/mc/presenceindicator.cpp index 02a311c6..80fbd4ef 100644 --- a/deps/ox/src/ox/mc/presenceindicator.cpp +++ b/deps/ox/src/ox/mc/presenceindicator.cpp @@ -18,7 +18,7 @@ FieldPresenceIndicator::FieldPresenceIndicator(uint8_t *mask, std::size_t maxLen m_maskLen = maxLen; } -ValErr FieldPresenceIndicator::get(std::size_t i) const { +Result FieldPresenceIndicator::get(std::size_t i) const { if (i / 8 < m_maskLen) { return (m_mask[i / 8] >> (i % 8)) & 1; } else { diff --git a/deps/ox/src/ox/mc/presenceindicator.hpp b/deps/ox/src/ox/mc/presenceindicator.hpp index 1a9fbeb1..d429be02 100644 --- a/deps/ox/src/ox/mc/presenceindicator.hpp +++ b/deps/ox/src/ox/mc/presenceindicator.hpp @@ -22,7 +22,7 @@ class FieldPresenceIndicator { public: FieldPresenceIndicator(uint8_t *mask, std::size_t maxLen); - ValErr get(std::size_t i) const; + Result get(std::size_t i) const; Error set(std::size_t i, bool on); diff --git a/deps/ox/src/ox/mc/read.cpp b/deps/ox/src/ox/mc/read.cpp index cc99a199..85adc539 100644 --- a/deps/ox/src/ox/mc/read.cpp +++ b/deps/ox/src/ox/mc/read.cpp @@ -109,7 +109,7 @@ Error MetalClawReader::field(const char*, SerStr val) { return OxError(0); } -ValErr MetalClawReader::arrayLength(const char*, bool pass) { +Result MetalClawReader::arrayLength(const char*, bool pass) { if ((m_unionIdx == -1 || m_unionIdx == m_field) && m_fieldPresence.get(m_field)) { // read the length if (m_buffIt >= m_buffLen) { diff --git a/deps/ox/src/ox/mc/read.hpp b/deps/ox/src/ox/mc/read.hpp index 5968d00f..f7d560b9 100644 --- a/deps/ox/src/ox/mc/read.hpp +++ b/deps/ox/src/ox/mc/read.hpp @@ -81,7 +81,7 @@ class MetalClawReader { * Reads an array length from the current location in the buffer. * @param pass indicates that the parsing should iterate past the array length */ - ValErr arrayLength(const char *name, bool pass = true); + Result arrayLength(const char *name, bool pass = true); /** * Reads an string length from the current location in the buffer. diff --git a/deps/ox/src/ox/mc/write.hpp b/deps/ox/src/ox/mc/write.hpp index 5d58f0a6..b20692b0 100644 --- a/deps/ox/src/ox/mc/write.hpp +++ b/deps/ox/src/ox/mc/write.hpp @@ -228,7 +228,7 @@ void MetalClawWriter::setTypeInfo(const char*, int fields) { } template -ValErr> writeMC(T *val) { +Result> writeMC(T *val) { Vector buff(10 * units::MB); MetalClawWriter writer(bit_cast(buff.data()), buff.size()); oxReturnError(model(&writer, val)); diff --git a/deps/ox/src/ox/model/descwrite.hpp b/deps/ox/src/ox/model/descwrite.hpp index 56f27b5c..9729c7e7 100644 --- a/deps/ox/src/ox/model/descwrite.hpp +++ b/deps/ox/src/ox/model/descwrite.hpp @@ -234,7 +234,7 @@ void TypeDescWriter::setTypeInfo(const char *name, int) { } template -ValErr buildTypeDef(T *val) { +Result buildTypeDef(T *val) { TypeDescWriter writer; Error err = model(&writer, val); return {writer.definition(), err}; diff --git a/deps/ox/src/ox/oc/read.cpp b/deps/ox/src/ox/oc/read.cpp index ea6851e6..44b9b9ac 100644 --- a/deps/ox/src/ox/oc/read.cpp +++ b/deps/ox/src/ox/oc/read.cpp @@ -208,7 +208,7 @@ Error OrganicClawReader::field(const char *key, SerStr val) { return err; } -ValErr OrganicClawReader::arrayLength(const char *key, bool) { +Result OrganicClawReader::arrayLength(const char *key, bool) { const auto &jv = value(key); if (jv.empty()) { return 0; diff --git a/deps/ox/src/ox/oc/read.hpp b/deps/ox/src/ox/oc/read.hpp index b7a7acb6..baff5a1f 100644 --- a/deps/ox/src/ox/oc/read.hpp +++ b/deps/ox/src/ox/oc/read.hpp @@ -72,7 +72,7 @@ class OrganicClawReader { * Reads an array length from the current location in the buffer. * @param pass indicates that the parsing should iterate past the array length */ - ValErr arrayLength(const char *key, bool pass = true); + Result arrayLength(const char *key, bool pass = true); /** * Reads an string length from the current location in the buffer. @@ -195,7 +195,7 @@ Error readOC(const char *json, std::size_t jsonSize, T *val) noexcept { } template -ValErr> readOC(const char *json) { +Result> readOC(const char *json) { auto val = std::make_unique(); oxReturnError(readOC(json, ox_strlen(json), val.get())); return {std::move(val), OxError(0)}; diff --git a/deps/ox/src/ox/oc/write.hpp b/deps/ox/src/ox/oc/write.hpp index 2ebbc154..53f2200f 100644 --- a/deps/ox/src/ox/oc/write.hpp +++ b/deps/ox/src/ox/oc/write.hpp @@ -21,7 +21,7 @@ namespace ox { class OrganicClawWriter { template - friend ValErr> writeOC(T *val); + friend Result> writeOC(T *val); protected: Json::Value m_json; @@ -149,7 +149,7 @@ Error OrganicClawWriter::field(const char *key, ox::HashMap *val) { } template -ValErr> writeOC(T *val) { +Result> writeOC(T *val) { OrganicClawWriter writer; oxReturnError(model(&writer, val)); Json::StreamWriterBuilder jsonBuilder; diff --git a/deps/ox/src/ox/std/error.hpp b/deps/ox/src/ox/std/error.hpp index 7ff16601..156e0abb 100644 --- a/deps/ox/src/ox/std/error.hpp +++ b/deps/ox/src/ox/std/error.hpp @@ -57,18 +57,18 @@ constexpr Error _error(const char *file, uint32_t line, uint64_t errCode, const } template -struct [[nodiscard]] ValErr { +struct [[nodiscard]] Result { T value; Error error; - constexpr ValErr() noexcept: error(0) { + constexpr Result() noexcept: error(0) { } - constexpr ValErr(Error error) noexcept: value(ox::move(value)), error(error) { + constexpr Result(Error error) noexcept: value(ox::move(value)), error(error) { this->error = error; } - constexpr ValErr(T value, Error error = OxError(0)) noexcept: value(ox::move(value)), error(error) { + constexpr Result(T value, Error error = OxError(0)) noexcept: value(ox::move(value)), error(error) { } explicit constexpr operator const T&() const noexcept { @@ -97,7 +97,7 @@ constexpr Error toError(ox::Error e) noexcept { } template -constexpr Error toError(const ox::ValErr &ve) noexcept { +constexpr Error toError(const ox::Result &ve) noexcept { return ve.error; }