[nostalgia/common] Update models
This commit is contained in:
parent
8f7de171af
commit
ec711331d1
@ -5,6 +5,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "point.hpp"
|
||||
@ -12,7 +13,11 @@
|
||||
namespace nostalgia::common {
|
||||
|
||||
class Bounds {
|
||||
|
||||
public:
|
||||
static constexpr auto TypeName = "net.drinkingtea.nostalgia.common.Bounds";
|
||||
static constexpr auto Fields = 4;
|
||||
static constexpr auto TypeVersion = 1;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int width = 0;
|
||||
@ -33,17 +38,17 @@ class Bounds {
|
||||
[[nodiscard]] Point pt1();
|
||||
|
||||
[[nodiscard]] Point pt2();
|
||||
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
ox::Error model(T *io, Bounds *obj) {
|
||||
auto err = OxError(0);
|
||||
io->setTypeInfo("nostalgia::common::Bounds", 4);
|
||||
err |= io->field("x", &obj->x);
|
||||
err |= io->field("y", &obj->y);
|
||||
err |= io->field("width", &obj->width);
|
||||
err |= io->field("height", &obj->height);
|
||||
return err;
|
||||
io->template setTypeInfo<Point>();
|
||||
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 OxError(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,10 +5,9 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
#ifndef NOSTALGIA_COMMON_COMMON_HPP
|
||||
#define NOSTALGIA_COMMON_COMMON_HPP
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "bounds.hpp"
|
||||
#include "point.hpp"
|
||||
|
||||
#endif
|
||||
#include "size.hpp"
|
||||
|
@ -14,6 +14,9 @@ namespace nostalgia::common {
|
||||
|
||||
class Point {
|
||||
public:
|
||||
static constexpr auto TypeName = "net.drinkingtea.nostalgia.common.Point";
|
||||
static constexpr auto Fields = 2;
|
||||
static constexpr auto TypeVersion = 1;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
||||
@ -183,7 +186,7 @@ constexpr bool Point::operator!=(const Point &p) const {
|
||||
|
||||
template<typename T>
|
||||
ox::Error model(T *io, Point *obj) {
|
||||
io->setTypeInfo("nostalgia::common::Bounds", 2);
|
||||
io->template setTypeInfo<Point>();
|
||||
oxReturnError(io->field("x", &obj->x));
|
||||
oxReturnError(io->field("y", &obj->y));
|
||||
return OxError(0);
|
||||
|
@ -14,6 +14,9 @@ namespace nostalgia::common {
|
||||
|
||||
class Size {
|
||||
public:
|
||||
static constexpr auto TypeName = "net.drinkingtea.nostalgia.common.Size";
|
||||
static constexpr auto Fields = 2;
|
||||
static constexpr auto TypeVersion = 1;
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
|
||||
@ -183,7 +186,7 @@ constexpr bool Size::operator!=(const Size &p) const {
|
||||
|
||||
template<typename T>
|
||||
ox::Error model(T *io, Size *obj) {
|
||||
io->setTypeInfo("nostalgia::common::Bounds", 2);
|
||||
io->template setTypeInfo<Size>();
|
||||
oxReturnError(io->field("width", &obj->width));
|
||||
oxReturnError(io->field("height", &obj->height));
|
||||
return OxError(0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user