[ox/model] Add macros to simplify model definition
This commit is contained in:
parent
f687134943
commit
fcc4cf3308
1
deps/ox/src/ox/model/CMakeLists.txt
vendored
1
deps/ox/src/ox/model/CMakeLists.txt
vendored
@ -20,6 +20,7 @@ endif()
|
||||
|
||||
install(
|
||||
FILES
|
||||
def.hpp
|
||||
descread.hpp
|
||||
desctypes.hpp
|
||||
descwrite.hpp
|
||||
|
14
deps/ox/src/ox/model/def.hpp
vendored
Normal file
14
deps/ox/src/ox/model/def.hpp
vendored
Normal file
@ -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<typename T> constexpr ox::Error model(T *io, modelName *o) noexcept { io->template setTypeInfo<modelName>();
|
||||
#define oxModelEnd() return OxError(0); }
|
||||
#define oxModelField(fieldName) oxReturnError(io->field(#fieldName, &o->fieldName));
|
||||
#define oxModelFriend(modelName) template<typename T> friend ox::Error model(T*, modelName*)
|
1
deps/ox/src/ox/model/model.hpp
vendored
1
deps/ox/src/ox/model/model.hpp
vendored
@ -8,6 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "def.hpp"
|
||||
#include "descread.hpp"
|
||||
#include "desctypes.hpp"
|
||||
#include "descwrite.hpp"
|
||||
|
Loading…
x
Reference in New Issue
Block a user