diff --git a/deps/ox/src/ox/model/CMakeLists.txt b/deps/ox/src/ox/model/CMakeLists.txt index d5270449..b2c59eb2 100644 --- a/deps/ox/src/ox/model/CMakeLists.txt +++ b/deps/ox/src/ox/model/CMakeLists.txt @@ -20,6 +20,7 @@ endif() install( FILES + def.hpp descread.hpp desctypes.hpp descwrite.hpp diff --git a/deps/ox/src/ox/model/def.hpp b/deps/ox/src/ox/model/def.hpp new file mode 100644 index 00000000..016f7be9 --- /dev/null +++ b/deps/ox/src/ox/model/def.hpp @@ -0,0 +1,14 @@ +/* + * Copyright 2015 - 2022 gary@drinkingtea.net + * + * This Source Code Form is subject to the terms of the Mozilla Public + * 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 + +#define oxModelBegin(modelName) template constexpr ox::Error model(T *io, modelName *o) noexcept { io->template setTypeInfo(); +#define oxModelEnd() return OxError(0); } +#define oxModelField(fieldName) oxReturnError(io->field(#fieldName, &o->fieldName)); +#define oxModelFriend(modelName) template friend ox::Error model(T*, modelName*) diff --git a/deps/ox/src/ox/model/model.hpp b/deps/ox/src/ox/model/model.hpp index c768b57c..1ca0a2b0 100644 --- a/deps/ox/src/ox/model/model.hpp +++ b/deps/ox/src/ox/model/model.hpp @@ -8,6 +8,7 @@ #pragma once +#include "def.hpp" #include "descread.hpp" #include "desctypes.hpp" #include "descwrite.hpp"