diff --git a/deps/ox/src/ox/claw/test/tests.cpp b/deps/ox/src/ox/claw/test/tests.cpp index 25eaa909..988ce7a5 100644 --- a/deps/ox/src/ox/claw/test/tests.cpp +++ b/deps/ox/src/ox/claw/test/tests.cpp @@ -66,7 +66,7 @@ struct TestStruct { template constexpr ox::Error model(T *io, ox::CommonPtrWith auto *obj) { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); oxReturnError(io->field("Bool", &obj->Bool)); oxReturnError(io->field("Int", &obj->Int)); oxReturnError(io->fieldCString("String", &obj->String)); @@ -75,7 +75,7 @@ constexpr ox::Error model(T *io, ox::CommonPtrWith auto *obj) { template constexpr ox::Error model(T *io, ox::CommonPtrWith auto *obj) { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); oxReturnError(io->field("Bool", &obj->Bool)); oxReturnError(io->field("Int", &obj->Int)); oxReturnError(io->field("String", &obj->String)); @@ -84,7 +84,7 @@ constexpr ox::Error model(T *io, ox::CommonPtrWith auto *obj) { template constexpr ox::Error model(T *io, ox::CommonPtrWith auto *obj) { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); oxReturnError(io->field("Bool", &obj->Bool)); oxReturnError(io->field("Int", &obj->Int)); oxReturnError(io->field("Int1", &obj->Int1)); diff --git a/deps/ox/src/ox/claw/write.hpp b/deps/ox/src/ox/claw/write.hpp index 88b23331..421d76ba 100644 --- a/deps/ox/src/ox/claw/write.hpp +++ b/deps/ox/src/ox/claw/write.hpp @@ -27,14 +27,15 @@ struct TypeInfoCatcher { const char *name = nullptr; int version = 0; - template - constexpr void setTypeInfo( - const char *name = T::TypeName, - int v = T::TypeVersion, + template + constexpr ox::Error setTypeInfo( + const char *pName = T::TypeName, + int pVersion = T::TypeVersion, const Vector& = {}, std::size_t = 0) noexcept { - this->name = name; - this->version = v; + this->name = pName; + this->version = pVersion; + return {}; } constexpr Error field(...) noexcept { diff --git a/deps/ox/src/ox/fs/filesystem/filelocation.hpp b/deps/ox/src/ox/fs/filesystem/filelocation.hpp index d2ba6a57..b0cf5a73 100644 --- a/deps/ox/src/ox/fs/filesystem/filelocation.hpp +++ b/deps/ox/src/ox/fs/filesystem/filelocation.hpp @@ -145,7 +145,7 @@ constexpr const char *getModelTypeName() noexcept { template constexpr Error model(T *io, CommonPtrWith auto *obj) noexcept { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); oxReturnError(io->fieldCString("path", &obj->path)); oxReturnError(io->fieldCString("constPath", &obj->path)); oxReturnError(io->field("inode", &obj->inode)); @@ -154,7 +154,7 @@ constexpr Error model(T *io, CommonPtrWith auto *obj) noexcep template constexpr Error model(T *io, CommonPtrWith auto *fa) noexcept { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); if constexpr(T::opType() == OpType::Reflect) { int8_t type = 0; oxReturnError(io->field("type", &type)); diff --git a/deps/ox/src/ox/mc/read.hpp b/deps/ox/src/ox/mc/read.hpp index 27165cfb..e0f7778f 100644 --- a/deps/ox/src/ox/mc/read.hpp +++ b/deps/ox/src/ox/mc/read.hpp @@ -99,8 +99,11 @@ class MetalClawReaderTemplate { constexpr StringLength stringLength(const char *name) noexcept; template - constexpr void setTypeInfo(const char *name = T::TypeName, int version = T::TypeVersion, - const Vector& = {}, std::size_t fields = ModelFieldCount_v) noexcept; + constexpr ox::Error setTypeInfo( + const char *name = T::TypeName, + int version = T::TypeVersion, + const Vector& = {}, + std::size_t fields = ModelFieldCount_v) noexcept; /** * Returns a MetalClawReader to parse a child object. @@ -225,7 +228,7 @@ constexpr Error MetalClawReaderTemplate::field(const char *name, a if (valLen >= len) { auto reader = child(""); auto handler = HandlerMaker(&reader); - handler.setTypeInfo("List", 0, {}, static_cast(len)); + oxReturnError(handler.setTypeInfo("List", 0, {}, static_cast(len))); for (std::size_t i = 0; i < len; ++i) { oxReturnError(handler.field("", &val[i])); } @@ -254,7 +257,7 @@ constexpr Error MetalClawReaderTemplate::field(const char*, HashMa // read the list auto reader = child(""); auto handler = HandlerMaker(&reader); - handler.setTypeInfo("List", 0, {}, static_cast(len)); + oxReturnError(handler.setTypeInfo("List", 0, {}, static_cast(len))); for (std::size_t i = 0; i < len; ++i) { const auto keyLen = handler.stringLength(nullptr); auto wkey = ox_malloca(keyLen + 1, char, 0); @@ -512,7 +515,7 @@ constexpr Error MetalClawReaderTemplate::field(const char*, CB cb) // read the list auto reader = child(""); auto handler = HandlerMaker(&reader); - handler.setTypeInfo("List", 0, {}, static_cast(len)); + oxReturnError(handler.setTypeInfo("List", 0, {}, static_cast(len))); for (std::size_t i = 0; i < len; ++i) { T val; oxReturnError(handler.field("", &val)); @@ -539,11 +542,13 @@ constexpr StringLength MetalClawReaderTemplate::stringLength(const template template -constexpr void MetalClawReaderTemplate::setTypeInfo(const char*, int, const Vector&, std::size_t fields) noexcept { +constexpr ox::Error MetalClawReaderTemplate::setTypeInfo( + const char*, int, const Vector&, std::size_t fields) noexcept { m_fields = fields; m_buffIt = static_cast((fields / 8 + 1) - (fields % 8 == 0)); m_fieldPresence.setFields(static_cast(fields)); m_fieldPresence.setMaxLen(static_cast(m_buffIt)); + return {}; } template diff --git a/deps/ox/src/ox/mc/test/tests.cpp b/deps/ox/src/ox/mc/test/tests.cpp index 6d01965f..031ec630 100644 --- a/deps/ox/src/ox/mc/test/tests.cpp +++ b/deps/ox/src/ox/mc/test/tests.cpp @@ -61,7 +61,7 @@ struct TestStruct { template constexpr ox::Error model(T *io, ox::CommonPtrWith auto *obj) noexcept { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); oxReturnError(io->field("Bool", &obj->Bool)); oxReturnError(io->field("Int", &obj->Int)); oxReturnError(io->fieldCString("CString", &obj->CString)); @@ -76,7 +76,7 @@ oxModelEnd() template constexpr ox::Error model(T *io, ox::CommonPtrWith auto *obj) noexcept { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); oxReturnError(io->field("Vector", &obj->Vector)); oxReturnError(io->field("Bool", &obj->Bool)); oxReturnError(io->field("Int", &obj->Int)); diff --git a/deps/ox/src/ox/mc/write.hpp b/deps/ox/src/ox/mc/write.hpp index 4ca71022..38917dbf 100644 --- a/deps/ox/src/ox/mc/write.hpp +++ b/deps/ox/src/ox/mc/write.hpp @@ -103,8 +103,11 @@ class MetalClawWriter { constexpr Error field(const char*, UnionView val) noexcept; template - constexpr void setTypeInfo(const char *name = T::TypeName, int version = T::TypeVersion, - const Vector& = {}, std::size_t fields = ModelFieldCount_v) noexcept; + constexpr ox::Error setTypeInfo( + const char *name = T::TypeName, + int version = T::TypeVersion, + const Vector& = {}, + std::size_t fields = ModelFieldCount_v) noexcept; /** * stringLength is not implemented in MetalClawWriter @@ -328,7 +331,7 @@ constexpr Error MetalClawWriter::field(const char*, T *val, std::size_t oxReturnError(m_writer.write(reinterpret_cast(arrLen.data), arrLen.length)); MetalClawWriter writer(m_writer); ModelHandlerInterface handler{&writer}; - handler.template setTypeInfo("List", 0, {}, static_cast(len)); + oxReturnError(handler.template setTypeInfo("List", 0, {}, static_cast(len))); // write the array for (std::size_t i = 0; i < len; i++) { oxReturnError(handler.field("", &val[i])); @@ -355,7 +358,7 @@ constexpr Error MetalClawWriter::field(const char*, const HashMap writer(m_writer); ModelHandlerInterface handler{&writer}; // double len for both key and value - handler.setTypeInfo("Map", 0, {}, len * 2); + oxReturnError(handler.setTypeInfo("Map", 0, {}, len * 2)); // write the array for (std::size_t i = 0; i < len; i++) { const auto &key = keys[i]; @@ -382,7 +385,7 @@ constexpr Error MetalClawWriter::field(const char *name, HashMap template -constexpr void MetalClawWriter::setTypeInfo( +constexpr ox::Error MetalClawWriter::setTypeInfo( const char*, int, const Vector&, @@ -393,6 +396,7 @@ constexpr void MetalClawWriter::setTypeInfo( m_presenceMapBuff.resize(fieldPresenceLen); m_fieldPresence.setBuffer(m_presenceMapBuff.data(), m_presenceMapBuff.size()); m_fieldPresence.setFields(static_cast(fields)); + return {}; } template diff --git a/deps/ox/src/ox/model/def.hpp b/deps/ox/src/ox/model/def.hpp index 253df49c..2648363d 100644 --- a/deps/ox/src/ox/model/def.hpp +++ b/deps/ox/src/ox/model/def.hpp @@ -10,7 +10,7 @@ #include -#define oxModelBegin(modelName) constexpr ox::Error model(auto *io, [[maybe_unused]] ox::CommonPtrWith auto *o) noexcept { io->template setTypeInfo(); +#define oxModelBegin(modelName) constexpr ox::Error model(auto *io, [[maybe_unused]] ox::CommonPtrWith auto *o) noexcept { oxReturnError(io->template setTypeInfo()); #define oxModelEnd() return OxError(0); } #define oxModelField(fieldName) oxReturnError(io->field(#fieldName, &o->fieldName)); #define oxModelFieldRename(serFieldName, objFieldName) oxReturnError(io->field(#serFieldName, &o->objFieldName)); diff --git a/deps/ox/src/ox/model/desctypes.hpp b/deps/ox/src/ox/model/desctypes.hpp index e2169e0d..e1e6f0b6 100644 --- a/deps/ox/src/ox/model/desctypes.hpp +++ b/deps/ox/src/ox/model/desctypes.hpp @@ -75,7 +75,7 @@ struct Subscript { template constexpr Error model(T *io, CommonPtrWith auto *type) noexcept { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); if constexpr(T::opType() == OpType::Reflect) { uint32_t st = 0; oxReturnError(io->field("subscriptType", &st)); @@ -183,7 +183,7 @@ constexpr auto buildTypeId(const DescriptorType &t) noexcept { template constexpr Error model(T *io, CommonPtrWith auto *type) noexcept { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); oxReturnError(io->field("typeName", &type->typeName)); oxReturnError(io->field("typeVersion", &type->typeVersion)); if constexpr(T::opType() == OpType::Reflect) { @@ -206,7 +206,7 @@ constexpr Error model(T *io, CommonPtrWith auto *type) noexcept template constexpr Error model(T *io, CommonPtrWith auto *field) noexcept { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); oxReturnError(io->field("typeId", &field->typeId)); oxReturnError(io->field("fieldName", &field->fieldName)); oxReturnError(io->field("subscriptLevels", &field->subscriptLevels)); diff --git a/deps/ox/src/ox/model/descwrite.hpp b/deps/ox/src/ox/model/descwrite.hpp index 17612d7c..0ea3cb08 100644 --- a/deps/ox/src/ox/model/descwrite.hpp +++ b/deps/ox/src/ox/model/descwrite.hpp @@ -91,7 +91,7 @@ class TypeDescWriter { constexpr ~TypeDescWriter() noexcept = default; template - constexpr void setTypeInfo(CRStringView name = T::TypeName, + constexpr ox::Error setTypeInfo(CRStringView name = T::TypeName, int version = T::TypeVersion, const TypeParamPack &typeParams = {}, std::size_t fields = ModelFieldCount_v) noexcept; @@ -175,7 +175,7 @@ class TypeDescWriter { constexpr TypeDescWriter::TypeDescWriter(TypeStore *typeStore) noexcept: m_typeStore(typeStore) {} template -constexpr void TypeDescWriter::setTypeInfo(CRStringView typeName, int typeVersion, +constexpr ox::Error TypeDescWriter::setTypeInfo(CRStringView typeName, int typeVersion, const TypeParamPack &typeParams, std::size_t) noexcept { PrimitiveType pt; if constexpr(is_union_v) { @@ -187,6 +187,7 @@ constexpr void TypeDescWriter::setTypeInfo(CRStringView typeName, int typeVersio } m_type = m_typeStore->getInit(typeName, typeVersion, pt, typeParams); m_type->preloadable = preloadable::value; + return {}; } // array handler diff --git a/deps/ox/src/ox/model/fieldcounter.hpp b/deps/ox/src/ox/model/fieldcounter.hpp index 12006821..9ea8bce8 100644 --- a/deps/ox/src/ox/model/fieldcounter.hpp +++ b/deps/ox/src/ox/model/fieldcounter.hpp @@ -21,10 +21,11 @@ namespace detail { template class FieldCounter { public: - int fields = 0; + std::size_t fields = 0; template - constexpr void setTypeInfo(CRStringView = "", int = 0, const Vector& = {}, std::size_t = 0) { + constexpr ox::Error setTypeInfo(CRStringView = "", int = 0, const Vector& = {}, std::size_t = 0) { + return {}; } template diff --git a/deps/ox/src/ox/model/modelhandleradaptor.hpp b/deps/ox/src/ox/model/modelhandleradaptor.hpp index 881a7810..098f13f1 100644 --- a/deps/ox/src/ox/model/modelhandleradaptor.hpp +++ b/deps/ox/src/ox/model/modelhandleradaptor.hpp @@ -24,12 +24,12 @@ class ModelHandlerInterface { } template - constexpr void setTypeInfo( + constexpr ox::Error setTypeInfo( const char *name = T::TypeName, int version = T::TypeVersion, const Vector &typeParams = {}, std::size_t fields = ModelFieldCount_v) noexcept { - m_handler->template setTypeInfo(name, version, typeParams, fields); + return m_handler->template setTypeInfo(name, version, typeParams, fields); } template diff --git a/deps/ox/src/ox/model/modelops.hpp b/deps/ox/src/ox/model/modelops.hpp index 864ebf0d..f1e918ca 100644 --- a/deps/ox/src/ox/model/modelops.hpp +++ b/deps/ox/src/ox/model/modelops.hpp @@ -71,9 +71,13 @@ class MemberList { return OxError(0); } - template - constexpr void setTypeInfo(const char* = T::TypeName, int = ModelTypeVersion_v, - const Vector& = {}, int = ModelFieldCount_v) noexcept { + template + constexpr ox::Error setTypeInfo( + const char* = T::TypeName, + int = T::TypeVersion, + const Vector& = {}, + std::size_t = ModelFieldCount_v) noexcept { + return {}; } [[nodiscard]] @@ -128,7 +132,12 @@ class Copier { } template - constexpr void setTypeInfo(const char* = T::TypeName, int = T::TypeVersion, const Vector& = {}, int = ModelFieldCount_v) noexcept { + constexpr ox::Error setTypeInfo( + const char* = T::TypeName, + int = T::TypeVersion, + const Vector& = {}, + int = ModelFieldCount_v) noexcept { + return {}; } [[nodiscard]] @@ -185,7 +194,12 @@ class Mover { } template - constexpr void setTypeInfo(const char* = T::TypeName, int = T::TypeVersion, const Vector& = {}, int = ModelFieldCount_v) noexcept { + constexpr ox::Error setTypeInfo( + const char* = T::TypeName, + int = T::TypeVersion, + const Vector& = {}, + int = ModelFieldCount_v) noexcept { + return {}; } [[nodiscard]] diff --git a/deps/ox/src/ox/model/modelvalue.hpp b/deps/ox/src/ox/model/modelvalue.hpp index b81f74a9..4f9c29ae 100644 --- a/deps/ox/src/ox/model/modelvalue.hpp +++ b/deps/ox/src/ox/model/modelvalue.hpp @@ -769,7 +769,7 @@ constexpr std::size_t alignOf(const ModelValue &t) noexcept { } constexpr Error model(auto *h, CommonPtrWith auto *obj) noexcept { - h->template setTypeInfo(obj->typeName().c_str(), obj->typeVersion(), {}, obj->m_fieldsOrder.size()); + oxReturnError(h->template setTypeInfo(obj->typeName().c_str(), obj->typeVersion(), {}, obj->m_fieldsOrder.size())); for (auto &f : obj->m_fieldsOrder) { oxReturnError(h->field(f->name.c_str(), &f->value)); } @@ -777,7 +777,7 @@ constexpr Error model(auto *h, CommonPtrWith auto *obj) noexcept { } constexpr Error model(auto *h, CommonPtrWith auto *obj) noexcept { - h->template setTypeInfo(obj->typeName().c_str(), obj->typeVersion(), {}, obj->m_fieldsOrder.size()); + oxReturnError(h->template setTypeInfo(obj->typeName().c_str(), obj->typeVersion(), {}, obj->m_fieldsOrder.size())); for (auto &f : obj->m_fieldsOrder) { oxReturnError(h->field(f->name.c_str(), &f->value)); } diff --git a/deps/ox/src/ox/model/typenamecatcher.hpp b/deps/ox/src/ox/model/typenamecatcher.hpp index cf918a58..3f235722 100644 --- a/deps/ox/src/ox/model/typenamecatcher.hpp +++ b/deps/ox/src/ox/model/typenamecatcher.hpp @@ -24,12 +24,18 @@ struct TypeNameCatcher { constexpr TypeNameCatcher() noexcept = default; - template - constexpr void setTypeInfo(const char *n = T::TypeName, int v = T::TypeVersion, const Vector& = {}, std::size_t = 0) noexcept { + template + constexpr ox::Error setTypeInfo( + const char *n = T::TypeName, + int v = T::TypeVersion, + const Vector& = {}, + std::size_t = ModelFieldCount_v) noexcept { this->name = n; this->version = v; + return {}; } + template constexpr Error field(const char*, T*, std::size_t) noexcept { return OxError(0); @@ -59,9 +65,14 @@ struct TypeInfoCatcher { constexpr TypeInfoCatcher() noexcept = default; template - constexpr void setTypeInfo(const char *n = T::TypeName, int v = T::TypeVersion, const Vector& = {}, std::size_t = 0) noexcept { + constexpr ox::Error setTypeInfo( + const char *n = T::TypeName, + int v = T::TypeVersion, + const Vector& = {}, + std::size_t = 0) noexcept { this->name = n; this->version = v; + return {}; } template diff --git a/deps/ox/src/ox/model/walk.hpp b/deps/ox/src/ox/model/walk.hpp index 5175d01f..a0add7d4 100644 --- a/deps/ox/src/ox/model/walk.hpp +++ b/deps/ox/src/ox/model/walk.hpp @@ -89,7 +89,7 @@ static constexpr Error parseField(const DescriptorField &field, Reader *rdr, Dat // add array handling oxRequire(arrayLen, rdr->arrayLength(field.fieldName.c_str(), true)); auto child = rdr->child(field.fieldName.c_str()); - child.setTypeInfo(field.type->typeName.c_str(), field.type->typeVersion, field.type->typeParams, arrayLen); + oxReturnError(child.setTypeInfo(field.type->typeName.c_str(), field.type->typeVersion, field.type->typeParams, arrayLen)); DescriptorField f(field); // create mutable copy --f.subscriptLevels; String subscript; @@ -137,7 +137,7 @@ constexpr Error model(Reader *rdr, DataWalker *walker) noexcept { auto typeVersion = type->typeVersion; auto typeParams = type->typeParams; auto &fields = type->fieldList; - rdr->setTypeInfo(typeName, typeVersion, typeParams, fields.size()); + oxReturnError(rdr->setTypeInfo(typeName, typeVersion, typeParams, fields.size())); for (const auto &field : fields) { oxReturnError(parseField(field, rdr, walker)); } diff --git a/deps/ox/src/ox/oc/read.hpp b/deps/ox/src/ox/oc/read.hpp index dd4fb68b..ba636c10 100644 --- a/deps/ox/src/ox/oc/read.hpp +++ b/deps/ox/src/ox/oc/read.hpp @@ -93,19 +93,23 @@ class OrganicClawReader { std::size_t stringLength(const char *name) noexcept; template - constexpr void setTypeInfo() noexcept { + constexpr ox::Error setTypeInfo() noexcept { + return {}; } template - constexpr void setTypeInfo(const char*) noexcept { + constexpr ox::Error setTypeInfo(const char*) noexcept { + return {}; } template - constexpr void setTypeInfo(const char*, int, const Vector& = {}) noexcept { + constexpr ox::Error setTypeInfo(const char*, int, const Vector& = {}) noexcept { + return {}; } template - constexpr void setTypeInfo(const char*, int, const Vector& = {}, std::size_t = {}) noexcept { + constexpr ox::Error setTypeInfo(const char*, int, const Vector& = {}, std::size_t = {}) noexcept { + return {}; } /** diff --git a/deps/ox/src/ox/oc/test/tests.cpp b/deps/ox/src/ox/oc/test/tests.cpp index 4c0ececa..3b4cebe1 100644 --- a/deps/ox/src/ox/oc/test/tests.cpp +++ b/deps/ox/src/ox/oc/test/tests.cpp @@ -74,7 +74,7 @@ struct TestStruct { }; constexpr ox::Error model(auto *io, ox::CommonPtrWith auto *obj) noexcept { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); oxReturnError(io->field("Bool", &obj->Bool)); oxReturnError(io->field("Int", &obj->Int)); oxReturnError(io->fieldCString("String", &obj->String)); @@ -82,7 +82,7 @@ constexpr ox::Error model(auto *io, ox::CommonPtrWith auto *obj) noex } constexpr ox::Error model(auto *io, ox::CommonPtrWith auto *obj) noexcept { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); oxReturnError(io->field("Bool", &obj->Bool)); oxReturnError(io->field("Int", &obj->Int)); oxReturnError(io->field("String", &obj->String)); @@ -90,7 +90,7 @@ constexpr ox::Error model(auto *io, ox::CommonPtrWith auto *obj) } constexpr ox::Error model(auto *io, ox::CommonPtrWith auto *obj) noexcept { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); oxReturnError(io->field("Bool", &obj->Bool)); oxReturnError(io->field("Int", &obj->Int)); oxReturnError(io->field("Int1", &obj->Int1)); diff --git a/deps/ox/src/ox/oc/write.hpp b/deps/ox/src/ox/oc/write.hpp index b4458439..fe681a2c 100644 --- a/deps/ox/src/ox/oc/write.hpp +++ b/deps/ox/src/ox/oc/write.hpp @@ -184,9 +184,13 @@ class OrganicClawWriter { template Error field(const char*, T *val) noexcept; - template - constexpr void setTypeInfo(const char* = T::TypeName, int = T::TypeVersion, - const Vector& = {}, std::size_t = ModelFieldCount_v) noexcept { + template + constexpr ox::Error setTypeInfo( + const char* = T::TypeName, + int = T::TypeVersion, + const Vector& = {}, + std::size_t = ModelFieldCount_v) noexcept { + return {}; } static constexpr auto opType() noexcept { diff --git a/deps/ox/src/ox/preloader/alignmentcatcher.hpp b/deps/ox/src/ox/preloader/alignmentcatcher.hpp index c3de252a..9464c71a 100644 --- a/deps/ox/src/ox/preloader/alignmentcatcher.hpp +++ b/deps/ox/src/ox/preloader/alignmentcatcher.hpp @@ -26,8 +26,13 @@ struct AlignmentCatcher: public ModelHandlerBase> { std::size_t biggestAlignment = 1; template - constexpr void setTypeInfo(const char* = T::TypeName, int = T::TypeVersion, - const Vector& = {}, std::size_t = ModelFieldCount_v) noexcept {} + constexpr ox::Error setTypeInfo( + const char* = T::TypeName, + int = T::TypeVersion, + const Vector& = {}, + std::size_t = ModelFieldCount_v) noexcept { + return {}; + } template constexpr ox::Error field(CRStringView name, const UnionView val) noexcept { diff --git a/deps/ox/src/ox/preloader/preloader.hpp b/deps/ox/src/ox/preloader/preloader.hpp index f4d982a2..bd38f43a 100644 --- a/deps/ox/src/ox/preloader/preloader.hpp +++ b/deps/ox/src/ox/preloader/preloader.hpp @@ -78,11 +78,13 @@ class Preloader: public ModelHandlerBase> { std::size_t sz = 0) noexcept; template - constexpr void setTypeInfo( - ox::CRStringView = T::TypeName, + constexpr ox::Error setTypeInfo( + const char* = T::TypeName, int = T::TypeVersion, const Vector& = {}, - std::size_t = ModelFieldCount_v) noexcept {} + std::size_t = ModelFieldCount_v) noexcept { + return {}; + } template constexpr ox::Error field(CRStringView, const ox::UnionView val) noexcept; diff --git a/deps/ox/src/ox/preloader/sizecatcher.hpp b/deps/ox/src/ox/preloader/sizecatcher.hpp index 7b872e8b..4e01b3a5 100644 --- a/deps/ox/src/ox/preloader/sizecatcher.hpp +++ b/deps/ox/src/ox/preloader/sizecatcher.hpp @@ -32,8 +32,13 @@ class SizeCatcher: public ModelHandlerBase> { constexpr explicit SizeCatcher() noexcept = default; template - constexpr void setTypeInfo(const char* = T::TypeName, int = T::TypeVersion, - const Vector& = {}, std::size_t = ModelFieldCount_v) noexcept {} + constexpr ox::Error setTypeInfo( + const char* = T::TypeName, + int = T::TypeVersion, + const Vector& = {}, + std::size_t = ModelFieldCount_v) noexcept { + return {}; + } template constexpr ox::Error field(const char*, UnionView) noexcept; diff --git a/deps/ox/src/ox/preloader/unionsizecatcher.hpp b/deps/ox/src/ox/preloader/unionsizecatcher.hpp index 110e645f..2421f66a 100644 --- a/deps/ox/src/ox/preloader/unionsizecatcher.hpp +++ b/deps/ox/src/ox/preloader/unionsizecatcher.hpp @@ -19,9 +19,15 @@ class UnionSizeCatcher: public ModelHandlerBase> { std::size_t m_size = 0; public: + template - constexpr void setTypeInfo(const char* = T::TypeName, int = T::TypeVersion, - const Vector& = {}, std::size_t = ModelFieldCount_v) noexcept {} + constexpr ox::Error setTypeInfo( + const char* = T::TypeName, + int = T::TypeVersion, + const Vector& = {}, + std::size_t = ModelFieldCount_v) noexcept { + return {}; + } template constexpr ox::Error field(CRStringView, const UnionView val) noexcept { diff --git a/deps/ox/src/ox/std/bounds.hpp b/deps/ox/src/ox/std/bounds.hpp index 260cf23f..df52a9a8 100644 --- a/deps/ox/src/ox/std/bounds.hpp +++ b/deps/ox/src/ox/std/bounds.hpp @@ -126,7 +126,7 @@ constexpr void Bounds::set(const Point &pt1, const Point &pt2) noexcept { template constexpr Error model(T *io, ox::CommonPtrWith auto *obj) noexcept { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); oxReturnError(io->field("x", &obj->x)); oxReturnError(io->field("y", &obj->y)); oxReturnError(io->field("width", &obj->width)); diff --git a/deps/ox/src/ox/std/point.hpp b/deps/ox/src/ox/std/point.hpp index 6abbd4c6..14f3a293 100644 --- a/deps/ox/src/ox/std/point.hpp +++ b/deps/ox/src/ox/std/point.hpp @@ -186,7 +186,7 @@ constexpr bool Point::operator!=(const Point &p) const noexcept { template constexpr Error model(T *io, ox::CommonPtrWith auto *obj) noexcept { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); oxReturnError(io->field("x", &obj->x)); oxReturnError(io->field("y", &obj->y)); return {}; diff --git a/deps/ox/src/ox/std/size.hpp b/deps/ox/src/ox/std/size.hpp index c5c746e8..e4c4025b 100644 --- a/deps/ox/src/ox/std/size.hpp +++ b/deps/ox/src/ox/std/size.hpp @@ -187,7 +187,7 @@ constexpr bool Size::operator!=(const Size &p) const noexcept { template constexpr Error model(T *io, ox::CommonPtrWith auto *obj) noexcept { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); oxReturnError(io->field("width", &obj->width)); oxReturnError(io->field("height", &obj->height)); return {}; diff --git a/deps/ox/src/ox/std/trace.hpp b/deps/ox/src/ox/std/trace.hpp index 98c370f8..79f8e36b 100644 --- a/deps/ox/src/ox/std/trace.hpp +++ b/deps/ox/src/ox/std/trace.hpp @@ -48,7 +48,7 @@ struct TraceMsgRcv { template constexpr Error model(T *io, ox::CommonPtrWith auto *obj) noexcept { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); oxReturnError(io->field("file", &obj->file)); oxReturnError(io->field("line", &obj->line)); oxReturnError(io->field("time", &obj->time)); @@ -69,7 +69,7 @@ struct TraceMsg { template constexpr Error model(T *io, ox::CommonPtrWith auto *obj) noexcept { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); oxReturnError(io->fieldCString("file", &obj->file)); oxReturnError(io->field("line", &obj->line)); oxReturnError(io->field("time", &obj->time)); @@ -87,7 +87,7 @@ struct InitTraceMsgRcv { template constexpr Error model(T *io, ox::CommonPtrWith auto *obj) noexcept { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); oxReturnError(io->field("appName", &obj->appName)); return {}; } @@ -101,7 +101,7 @@ struct InitTraceMsg { template constexpr Error model(T *io, ox::CommonPtrWith auto *obj) noexcept { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); oxReturnError(io->fieldCString("appName", &obj->appName)); return {}; } diff --git a/deps/ox/src/ox/std/uuid.hpp b/deps/ox/src/ox/std/uuid.hpp index 9cc3c3b2..6a049e04 100644 --- a/deps/ox/src/ox/std/uuid.hpp +++ b/deps/ox/src/ox/std/uuid.hpp @@ -176,7 +176,7 @@ class UUID { template constexpr Error model(T *io, ox::CommonPtrWith auto *obj) noexcept { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); oxReturnError(io->field("value", &obj->m_value)); return {}; } diff --git a/deps/ox/src/ox/std/vec.hpp b/deps/ox/src/ox/std/vec.hpp index 9b6415c3..3d92a264 100644 --- a/deps/ox/src/ox/std/vec.hpp +++ b/deps/ox/src/ox/std/vec.hpp @@ -262,7 +262,7 @@ using Vec2 = Vec; template constexpr Error model(T *io, ox::CommonPtrWith auto *obj) noexcept { - io->template setTypeInfo(); + oxReturnError(io->template setTypeInfo()); oxReturnError(io->field("x", &obj->x)); oxReturnError(io->field("y", &obj->y)); return {};