[ox] Make model system's setTypeInfo return an Error

This commit is contained in:
2023-06-09 20:49:36 -05:00
parent 7c3aaf99c2
commit e22743961a
28 changed files with 137 additions and 74 deletions

View File

@@ -26,8 +26,13 @@ struct AlignmentCatcher: public ModelHandlerBase<AlignmentCatcher<PlatSpec>> {
std::size_t biggestAlignment = 1;
template<typename T>
constexpr void setTypeInfo(const char* = T::TypeName, int = T::TypeVersion,
const Vector<String>& = {}, std::size_t = ModelFieldCount_v<T>) noexcept {}
constexpr ox::Error setTypeInfo(
const char* = T::TypeName,
int = T::TypeVersion,
const Vector<String>& = {},
std::size_t = ModelFieldCount_v<T>) noexcept {
return {};
}
template<typename T, bool force>
constexpr ox::Error field(CRStringView name, const UnionView<T, force> val) noexcept {

View File

@@ -78,11 +78,13 @@ class Preloader: public ModelHandlerBase<Preloader<PlatSpec>> {
std::size_t sz = 0) noexcept;
template<typename T>
constexpr void setTypeInfo(
ox::CRStringView = T::TypeName,
constexpr ox::Error setTypeInfo(
const char* = T::TypeName,
int = T::TypeVersion,
const Vector<String>& = {},
std::size_t = ModelFieldCount_v<T>) noexcept {}
std::size_t = ModelFieldCount_v<T>) noexcept {
return {};
}
template<typename U, bool force>
constexpr ox::Error field(CRStringView, const ox::UnionView<U, force> val) noexcept;

View File

@@ -32,8 +32,13 @@ class SizeCatcher: public ModelHandlerBase<SizeCatcher<PlatSpec>> {
constexpr explicit SizeCatcher() noexcept = default;
template<typename T>
constexpr void setTypeInfo(const char* = T::TypeName, int = T::TypeVersion,
const Vector<String>& = {}, std::size_t = ModelFieldCount_v<T>) noexcept {}
constexpr ox::Error setTypeInfo(
const char* = T::TypeName,
int = T::TypeVersion,
const Vector<String>& = {},
std::size_t = ModelFieldCount_v<T>) noexcept {
return {};
}
template<typename T, bool force>
constexpr ox::Error field(const char*, UnionView<T, force>) noexcept;

View File

@@ -19,9 +19,15 @@ class UnionSizeCatcher: public ModelHandlerBase<UnionSizeCatcher<PlatSpec>> {
std::size_t m_size = 0;
public:
template<typename T>
constexpr void setTypeInfo(const char* = T::TypeName, int = T::TypeVersion,
const Vector<String>& = {}, std::size_t = ModelFieldCount_v<T>) noexcept {}
constexpr ox::Error setTypeInfo(
const char* = T::TypeName,
int = T::TypeVersion,
const Vector<String>& = {},
std::size_t = ModelFieldCount_v<T>) noexcept {
return {};
}
template<typename T, bool force>
constexpr ox::Error field(CRStringView, const UnionView<T, force> val) noexcept {