[ox] Make setTypeInfo functions in model handlers consistent
This commit is contained in:
parent
50e2fadcd1
commit
593a57a0ce
2
deps/ox/src/ox/model/modelhandleradaptor.hpp
vendored
2
deps/ox/src/ox/model/modelhandleradaptor.hpp
vendored
@ -26,7 +26,7 @@ class ModelHandlerInterface {
|
||||
template<typename T = std::nullptr_t>
|
||||
constexpr void setTypeInfo(const char *name = T::TypeName, int version = T::TypeVersion,
|
||||
const Vector<String> &typeParams = {}, int fields = ModelFieldCount_v<T>) noexcept {
|
||||
m_handler->setTypeInfo(name, version, typeParams, fields);
|
||||
m_handler->template setTypeInfo<T>(name, version, typeParams, fields);
|
||||
}
|
||||
|
||||
template<std::size_t len>
|
||||
|
4
deps/ox/src/ox/model/modelvalue.hpp
vendored
4
deps/ox/src/ox/model/modelvalue.hpp
vendored
@ -744,7 +744,7 @@ class ModelUnion {
|
||||
};
|
||||
|
||||
constexpr Error model(auto *h, CommonPtrWith<ModelObject> auto *obj) noexcept {
|
||||
h->setTypeInfo(obj->m_typeName.c_str(), obj->m_typeVersion, {}, static_cast<int>(obj->m_fieldsOrder.size()));
|
||||
h->template setTypeInfo<ModelObject>(obj->m_typeName.c_str(), obj->m_typeVersion, {}, static_cast<int>(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<ModelObject> auto *obj) noexcept {
|
||||
}
|
||||
|
||||
constexpr Error model(auto *h, CommonPtrWith<ModelUnion> auto *obj) noexcept {
|
||||
h->setTypeInfo(obj->m_typeName.c_str(), obj->m_typeVersion, {}, static_cast<int>(obj->m_fieldsOrder.size()));
|
||||
h->template setTypeInfo<ModelUnion>(obj->m_typeName.c_str(), obj->m_typeVersion, {}, static_cast<int>(obj->m_fieldsOrder.size()));
|
||||
for (auto &f : obj->m_fieldsOrder) {
|
||||
oxReturnError(h->field(f->name.c_str(), &f->value));
|
||||
}
|
||||
|
@ -25,9 +25,9 @@ template<typename PlatSpec>
|
||||
struct AlignmentCatcher: public ModelHandlerBase<AlignmentCatcher<PlatSpec>> {
|
||||
std::size_t biggestAlignment = 1;
|
||||
|
||||
template<typename ...T>
|
||||
constexpr void setTypeInfo(T&&...) const noexcept {
|
||||
}
|
||||
template<typename T>
|
||||
constexpr void setTypeInfo(const char* = T::TypeName, int = T::TypeVersion,
|
||||
const Vector<String>& = {}, int = ModelFieldCount_v<T>) noexcept {}
|
||||
|
||||
template<typename T, bool force>
|
||||
constexpr ox::Error field(CRStringView name, const UnionView<T, force> val) noexcept {
|
||||
|
4
deps/ox/src/ox/preloader/preloader.hpp
vendored
4
deps/ox/src/ox/preloader/preloader.hpp
vendored
@ -58,7 +58,9 @@ class Preloader: public ModelHandlerBase<Preloader<PlatSpec>> {
|
||||
constexpr static ox::Result<ox::UniquePtr<Preloader>> make(ox::ios_base::seekdir anchor = ox::ios_base::cur,
|
||||
std::size_t sz = 0) noexcept;
|
||||
|
||||
constexpr void setTypeInfo(CRStringView, int, const ox::Vector<String>& = {}, int = 0) noexcept {}
|
||||
template<typename T>
|
||||
constexpr void setTypeInfo(const char* = T::TypeName, int = T::TypeVersion,
|
||||
const Vector<String>& = {}, int = ModelFieldCount_v<T>) noexcept {}
|
||||
|
||||
template<typename U, bool force>
|
||||
constexpr ox::Error field(CRStringView, const ox::UnionView<U, force> val) noexcept;
|
||||
|
6
deps/ox/src/ox/preloader/sizecatcher.hpp
vendored
6
deps/ox/src/ox/preloader/sizecatcher.hpp
vendored
@ -31,9 +31,9 @@ class SizeCatcher: public ModelHandlerBase<SizeCatcher<PlatSpec>> {
|
||||
public:
|
||||
constexpr explicit SizeCatcher() noexcept = default;
|
||||
|
||||
template<typename ...T>
|
||||
constexpr void setTypeInfo(T&&...) const noexcept {
|
||||
}
|
||||
template<typename T>
|
||||
constexpr void setTypeInfo(const char* = T::TypeName, int = T::TypeVersion,
|
||||
const Vector<String>& = {}, int = ModelFieldCount_v<T>) noexcept {}
|
||||
|
||||
template<typename T, bool force>
|
||||
constexpr ox::Error field(const char*, UnionView<T, force>) noexcept;
|
||||
|
@ -19,9 +19,9 @@ class UnionSizeCatcher: public ModelHandlerBase<UnionSizeCatcher<PlatSpec>> {
|
||||
std::size_t m_size = 0;
|
||||
|
||||
public:
|
||||
template<typename ...T>
|
||||
constexpr void setTypeInfo(T&&...) const noexcept {
|
||||
}
|
||||
template<typename T>
|
||||
constexpr void setTypeInfo(const char* = T::TypeName, int = T::TypeVersion,
|
||||
const Vector<String>& = {}, int = ModelFieldCount_v<T>) noexcept {}
|
||||
|
||||
template<typename T, bool force>
|
||||
constexpr ox::Error field(CRStringView, const UnionView<T, force> val) noexcept {
|
||||
|
Loading…
Reference in New Issue
Block a user