diff --git a/deps/ox/src/ox/model/desctypes.hpp b/deps/ox/src/ox/model/desctypes.hpp index dda267b7..c54ec669 100644 --- a/deps/ox/src/ox/model/desctypes.hpp +++ b/deps/ox/src/ox/model/desctypes.hpp @@ -106,6 +106,7 @@ struct DescriptorType { // - number of bytes for integer and float types // - number of fields for structs and lists int64_t length = 0; + bool preloadable = false; DescriptorType() = default; @@ -125,6 +126,7 @@ Error model(T *io, DescriptorType *type) { err |= io->field("primitiveType", &type->primitiveType); err |= io->field("fieldList", &type->fieldList); err |= io->field("length", &type->length); + err |= io->field("preloadable", &type->preloadable); return err; } diff --git a/deps/ox/src/ox/model/descwrite.cpp b/deps/ox/src/ox/model/descwrite.cpp index 93196c8b..0d000856 100644 --- a/deps/ox/src/ox/model/descwrite.cpp +++ b/deps/ox/src/ox/model/descwrite.cpp @@ -12,6 +12,26 @@ namespace ox { +namespace detail { + +struct preloadable_type { + static constexpr auto Preloadable = true; +}; + +struct non_preloadable_type { + static constexpr auto Preloadable = false; +}; + +struct non_preloadable_type2 { +}; + +static_assert(preloadable::value); +static_assert(!preloadable::value); +static_assert(!preloadable::value); + +} + + static_assert([] { int i = 0; return indirectionLevels(i) == 0; diff --git a/deps/ox/src/ox/model/descwrite.hpp b/deps/ox/src/ox/model/descwrite.hpp index a0feb83c..5ca8e9de 100644 --- a/deps/ox/src/ox/model/descwrite.hpp +++ b/deps/ox/src/ox/model/descwrite.hpp @@ -21,6 +21,22 @@ namespace ox { +namespace detail { + +template +struct BoolWrapper { +}; + +template> +struct preloadable: false_type {}; + +template +struct preloadable> { + static constexpr bool value = T::Preloadable; +}; + +} + template static constexpr int indirectionLevels(T) { return 0; @@ -187,11 +203,12 @@ void TypeDescWriter::setTypeInfo(const char *name, int) { } m_type = t; m_type->typeName = name; - if (ox::is_union_v) { + if (is_union_v) { m_type->primitiveType = PrimitiveType::Union; } else { m_type->primitiveType = PrimitiveType::Struct; } + m_type->preloadable = detail::preloadable::value; } template