[ox] Make model system's setTypeInfo return an Error
This commit is contained in:
12
deps/ox/src/ox/oc/read.hpp
vendored
12
deps/ox/src/ox/oc/read.hpp
vendored
@@ -93,19 +93,23 @@ class OrganicClawReader {
|
||||
std::size_t stringLength(const char *name) noexcept;
|
||||
|
||||
template<typename T = void>
|
||||
constexpr void setTypeInfo() noexcept {
|
||||
constexpr ox::Error setTypeInfo() noexcept {
|
||||
return {};
|
||||
}
|
||||
|
||||
template<typename T = void>
|
||||
constexpr void setTypeInfo(const char*) noexcept {
|
||||
constexpr ox::Error setTypeInfo(const char*) noexcept {
|
||||
return {};
|
||||
}
|
||||
|
||||
template<typename T = void>
|
||||
constexpr void setTypeInfo(const char*, int, const Vector<String>& = {}) noexcept {
|
||||
constexpr ox::Error setTypeInfo(const char*, int, const Vector<String>& = {}) noexcept {
|
||||
return {};
|
||||
}
|
||||
|
||||
template<typename T = void>
|
||||
constexpr void setTypeInfo(const char*, int, const Vector<String>& = {}, std::size_t = {}) noexcept {
|
||||
constexpr ox::Error setTypeInfo(const char*, int, const Vector<String>& = {}, std::size_t = {}) noexcept {
|
||||
return {};
|
||||
}
|
||||
|
||||
/**
|
||||
|
6
deps/ox/src/ox/oc/test/tests.cpp
vendored
6
deps/ox/src/ox/oc/test/tests.cpp
vendored
@@ -74,7 +74,7 @@ struct TestStruct {
|
||||
};
|
||||
|
||||
constexpr ox::Error model(auto *io, ox::CommonPtrWith<TestUnion> auto *obj) noexcept {
|
||||
io->template setTypeInfo<TestUnion>();
|
||||
oxReturnError(io->template setTypeInfo<TestUnion>());
|
||||
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<TestUnion> auto *obj) noex
|
||||
}
|
||||
|
||||
constexpr ox::Error model(auto *io, ox::CommonPtrWith<TestStructNest> auto *obj) noexcept {
|
||||
io->template setTypeInfo<TestStructNest>();
|
||||
oxReturnError(io->template setTypeInfo<TestStructNest>());
|
||||
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<TestStructNest> auto *obj)
|
||||
}
|
||||
|
||||
constexpr ox::Error model(auto *io, ox::CommonPtrWith<TestStruct> auto *obj) noexcept {
|
||||
io->template setTypeInfo<TestStruct>();
|
||||
oxReturnError(io->template setTypeInfo<TestStruct>());
|
||||
oxReturnError(io->field("Bool", &obj->Bool));
|
||||
oxReturnError(io->field("Int", &obj->Int));
|
||||
oxReturnError(io->field("Int1", &obj->Int1));
|
||||
|
10
deps/ox/src/ox/oc/write.hpp
vendored
10
deps/ox/src/ox/oc/write.hpp
vendored
@@ -184,9 +184,13 @@ class OrganicClawWriter {
|
||||
template<typename T>
|
||||
Error field(const char*, T *val) noexcept;
|
||||
|
||||
template<typename T = void>
|
||||
constexpr void setTypeInfo(const char* = T::TypeName, int = T::TypeVersion,
|
||||
const Vector<String>& = {}, std::size_t = ModelFieldCount_v<T>) noexcept {
|
||||
template<typename T>
|
||||
constexpr ox::Error setTypeInfo(
|
||||
const char* = T::TypeName,
|
||||
int = T::TypeVersion,
|
||||
const Vector<String>& = {},
|
||||
std::size_t = ModelFieldCount_v<T>) noexcept {
|
||||
return {};
|
||||
}
|
||||
|
||||
static constexpr auto opType() noexcept {
|
||||
|
Reference in New Issue
Block a user