[ox/model] Make field counting automatic

This commit is contained in:
2021-07-29 22:24:08 -05:00
parent 55f14eb548
commit cc5cc01e70
6 changed files with 141 additions and 46 deletions

63
deps/ox/src/ox/model/metadata.hpp vendored Normal file
View File

@@ -0,0 +1,63 @@
/*
* Copyright 2015 - 2021 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
#include <ox/std/byteswap.hpp>
#include <ox/std/bstring.hpp>
#include <ox/std/memory.hpp>
#include <ox/std/string.hpp>
#include <ox/std/trace.hpp>
#include <ox/std/types.hpp>
#include <ox/std/vector.hpp>
#include "desctypes.hpp"
#include "fieldcounter.hpp"
#include "optype.hpp"
#include "typenamecatcher.hpp"
#include "types.hpp"
namespace ox {
namespace detail {
template<bool>
struct BoolWrapper {
};
template<typename T, typename = BoolWrapper<true>>
struct preloadable : false_type {
};
template<typename T>
struct preloadable<T, BoolWrapper<T::Preloadable>> {
static constexpr bool value = T::Preloadable;
};
// cannot be done until C++20
//struct PseudoString {
// constexpr PseudoString(const char* = "") noexcept {}
//};
//
//template<PseudoString>
//struct StringWrapper {
//};
//
//template<typename T, typename = StringWrapper<"">>
//struct ModelTypeName {
// static constexpr const char *value = "";
//};
//
//template<typename T>
//struct ModelTypeName<T, detail::StringWrapper<T::TypeName>> {
// static constexpr const char *value = T::TypeName;
//};
}
}