diff --git a/deps/ox/src/ox/std/bounds.hpp b/deps/ox/src/ox/std/bounds.hpp index 266389c1..260cf23f 100644 --- a/deps/ox/src/ox/std/bounds.hpp +++ b/deps/ox/src/ox/std/bounds.hpp @@ -8,7 +8,6 @@ #pragma once -#include #include #include @@ -125,11 +124,15 @@ constexpr void Bounds::set(const Point &pt1, const Point &pt2) noexcept { this->height = y2 - y1; } -oxModelBegin(Bounds) - oxModelField(x) - oxModelField(y) - oxModelField(width) - oxModelField(height) -oxModelEnd() +template +constexpr Error model(T *io, ox::CommonPtrWith auto *obj) noexcept { + io->template setTypeInfo(); + oxReturnError(io->field("x", &obj->x)); + oxReturnError(io->field("y", &obj->y)); + oxReturnError(io->field("width", &obj->width)); + oxReturnError(io->field("height", &obj->height)); + return {}; +} + } diff --git a/deps/ox/src/ox/std/point.hpp b/deps/ox/src/ox/std/point.hpp index 94269251..6abbd4c6 100644 --- a/deps/ox/src/ox/std/point.hpp +++ b/deps/ox/src/ox/std/point.hpp @@ -184,9 +184,12 @@ constexpr bool Point::operator!=(const Point &p) const noexcept { return x != p.x || y != p.y; } -oxModelBegin(Point) - oxModelField(x) - oxModelField(y) -oxModelEnd() +template +constexpr Error model(T *io, ox::CommonPtrWith auto *obj) noexcept { + io->template setTypeInfo(); + oxReturnError(io->field("x", &obj->x)); + oxReturnError(io->field("y", &obj->y)); + return {}; +} } diff --git a/deps/ox/src/ox/std/size.hpp b/deps/ox/src/ox/std/size.hpp index b4071974..c5c746e8 100644 --- a/deps/ox/src/ox/std/size.hpp +++ b/deps/ox/src/ox/std/size.hpp @@ -9,6 +9,7 @@ #pragma once #include +#include namespace ox { @@ -184,9 +185,12 @@ constexpr bool Size::operator!=(const Size &p) const noexcept { } -oxModelBegin(Size) - oxModelField(width) - oxModelField(height) -oxModelEnd() +template +constexpr Error model(T *io, ox::CommonPtrWith auto *obj) noexcept { + io->template setTypeInfo(); + oxReturnError(io->field("width", &obj->width)); + oxReturnError(io->field("height", &obj->height)); + return {}; +} } diff --git a/deps/ox/src/ox/std/vec.hpp b/deps/ox/src/ox/std/vec.hpp index 376f28e0..9b6415c3 100644 --- a/deps/ox/src/ox/std/vec.hpp +++ b/deps/ox/src/ox/std/vec.hpp @@ -260,9 +260,12 @@ struct Vec { using Vec2 = Vec; -oxModelBegin(Vec2) - oxModelField(x) - oxModelField(y) -oxModelEnd() +template +constexpr Error model(T *io, ox::CommonPtrWith auto *obj) noexcept { + io->template setTypeInfo(); + oxReturnError(io->field("x", &obj->x)); + oxReturnError(io->field("y", &obj->y)); + return {}; +} }