[ox] Make model type version mandatory
This commit is contained in:
4
deps/ox/src/ox/oc/read.hpp
vendored
4
deps/ox/src/ox/oc/read.hpp
vendored
@@ -96,6 +96,10 @@ class OrganicClawReader {
|
||||
constexpr void setTypeInfo(const char*, int) noexcept {
|
||||
}
|
||||
|
||||
template<typename T = void>
|
||||
constexpr void setTypeInfo(const char*, int, int) noexcept {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a OrganicClawReader to parse a child object.
|
||||
*/
|
||||
|
3
deps/ox/src/ox/oc/test/tests.cpp
vendored
3
deps/ox/src/ox/oc/test/tests.cpp
vendored
@@ -16,6 +16,7 @@
|
||||
|
||||
union TestUnion {
|
||||
static constexpr auto TypeName = "TestUnion";
|
||||
static constexpr auto TypeVersion = 1;
|
||||
bool Bool;
|
||||
uint32_t Int = 5;
|
||||
char String[32];
|
||||
@@ -23,6 +24,7 @@ union TestUnion {
|
||||
|
||||
struct TestStructNest {
|
||||
static constexpr auto TypeName = "TestStructNest";
|
||||
static constexpr auto TypeVersion = 1;
|
||||
bool Bool = false;
|
||||
uint32_t Int = 0;
|
||||
ox::BString<32> String = "";
|
||||
@@ -30,6 +32,7 @@ struct TestStructNest {
|
||||
|
||||
struct TestStruct {
|
||||
static constexpr auto TypeName = "TestStruct";
|
||||
static constexpr auto TypeVersion = 1;
|
||||
bool Bool = false;
|
||||
int32_t Int = 0;
|
||||
int32_t Int1 = 0;
|
||||
|
2
deps/ox/src/ox/oc/write.hpp
vendored
2
deps/ox/src/ox/oc/write.hpp
vendored
@@ -69,7 +69,7 @@ class OrganicClawWriter {
|
||||
Error field(const char*, T *val) noexcept;
|
||||
|
||||
template<typename T = void>
|
||||
constexpr void setTypeInfo(const char* = T::TypeName, int = countFields<T>()) noexcept {
|
||||
constexpr void setTypeInfo(const char* = T::TypeName, int = T::TypeVersion, int = ModelFieldCount_v<T>) noexcept {
|
||||
}
|
||||
|
||||
static constexpr auto opType() noexcept {
|
||||
|
Reference in New Issue
Block a user