From 593a57a0cef66a7cd315c14d7e33789491ac3f8d Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Thu, 1 Dec 2022 00:09:05 -0600 Subject: [PATCH] [ox] Make setTypeInfo functions in model handlers consistent --- deps/ox/src/ox/model/modelhandleradaptor.hpp | 2 +- deps/ox/src/ox/model/modelvalue.hpp | 4 ++-- deps/ox/src/ox/preloader/alignmentcatcher.hpp | 6 +++--- deps/ox/src/ox/preloader/preloader.hpp | 4 +++- deps/ox/src/ox/preloader/sizecatcher.hpp | 6 +++--- deps/ox/src/ox/preloader/unionsizecatcher.hpp | 6 +++--- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/deps/ox/src/ox/model/modelhandleradaptor.hpp b/deps/ox/src/ox/model/modelhandleradaptor.hpp index f6995772..2e9a17da 100644 --- a/deps/ox/src/ox/model/modelhandleradaptor.hpp +++ b/deps/ox/src/ox/model/modelhandleradaptor.hpp @@ -26,7 +26,7 @@ class ModelHandlerInterface { template constexpr void setTypeInfo(const char *name = T::TypeName, int version = T::TypeVersion, const Vector &typeParams = {}, int fields = ModelFieldCount_v) noexcept { - m_handler->setTypeInfo(name, version, typeParams, fields); + m_handler->template setTypeInfo(name, version, typeParams, fields); } template diff --git a/deps/ox/src/ox/model/modelvalue.hpp b/deps/ox/src/ox/model/modelvalue.hpp index bc40df38..f448a303 100644 --- a/deps/ox/src/ox/model/modelvalue.hpp +++ b/deps/ox/src/ox/model/modelvalue.hpp @@ -744,7 +744,7 @@ class ModelUnion { }; constexpr Error model(auto *h, CommonPtrWith auto *obj) noexcept { - h->setTypeInfo(obj->m_typeName.c_str(), obj->m_typeVersion, {}, static_cast(obj->m_fieldsOrder.size())); + h->template setTypeInfo(obj->m_typeName.c_str(), obj->m_typeVersion, {}, static_cast(obj->m_fieldsOrder.size())); for (auto &f : obj->m_fieldsOrder) { oxReturnError(h->field(f->name.c_str(), &f->value)); } @@ -752,7 +752,7 @@ constexpr Error model(auto *h, CommonPtrWith auto *obj) noexcept { } constexpr Error model(auto *h, CommonPtrWith auto *obj) noexcept { - h->setTypeInfo(obj->m_typeName.c_str(), obj->m_typeVersion, {}, static_cast(obj->m_fieldsOrder.size())); + h->template setTypeInfo(obj->m_typeName.c_str(), obj->m_typeVersion, {}, static_cast(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/preloader/alignmentcatcher.hpp b/deps/ox/src/ox/preloader/alignmentcatcher.hpp index 5789ff74..88078256 100644 --- a/deps/ox/src/ox/preloader/alignmentcatcher.hpp +++ b/deps/ox/src/ox/preloader/alignmentcatcher.hpp @@ -25,9 +25,9 @@ template struct AlignmentCatcher: public ModelHandlerBase> { std::size_t biggestAlignment = 1; - template - constexpr void setTypeInfo(T&&...) const noexcept { - } + template + constexpr void setTypeInfo(const char* = T::TypeName, int = T::TypeVersion, + const Vector& = {}, int = ModelFieldCount_v) noexcept {} 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 9ecae890..02f02811 100644 --- a/deps/ox/src/ox/preloader/preloader.hpp +++ b/deps/ox/src/ox/preloader/preloader.hpp @@ -58,7 +58,9 @@ class Preloader: public ModelHandlerBase> { constexpr static ox::Result> make(ox::ios_base::seekdir anchor = ox::ios_base::cur, std::size_t sz = 0) noexcept; - constexpr void setTypeInfo(CRStringView, int, const ox::Vector& = {}, int = 0) noexcept {} + template + constexpr void setTypeInfo(const char* = T::TypeName, int = T::TypeVersion, + const Vector& = {}, int = ModelFieldCount_v) noexcept {} 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 77a16665..2b57338b 100644 --- a/deps/ox/src/ox/preloader/sizecatcher.hpp +++ b/deps/ox/src/ox/preloader/sizecatcher.hpp @@ -31,9 +31,9 @@ class SizeCatcher: public ModelHandlerBase> { public: constexpr explicit SizeCatcher() noexcept = default; - template - constexpr void setTypeInfo(T&&...) const noexcept { - } + template + constexpr void setTypeInfo(const char* = T::TypeName, int = T::TypeVersion, + const Vector& = {}, int = ModelFieldCount_v) noexcept {} 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 53b876c9..a3c00439 100644 --- a/deps/ox/src/ox/preloader/unionsizecatcher.hpp +++ b/deps/ox/src/ox/preloader/unionsizecatcher.hpp @@ -19,9 +19,9 @@ class UnionSizeCatcher: public ModelHandlerBase> { std::size_t m_size = 0; public: - template - constexpr void setTypeInfo(T&&...) const noexcept { - } + template + constexpr void setTypeInfo(const char* = T::TypeName, int = T::TypeVersion, + const Vector& = {}, int = ModelFieldCount_v) noexcept {} template constexpr ox::Error field(CRStringView, const UnionView val) noexcept {