[ox/model] Add constexpr ModelTypeId_v
This commit is contained in:
parent
0c09c5306e
commit
7941a514ba
15
deps/ox/src/ox/model/typenamecatcher.hpp
vendored
15
deps/ox/src/ox/model/typenamecatcher.hpp
vendored
@ -147,4 +147,19 @@ constexpr auto ModelTypeName_v = getModelTypeName<T, Str>();
|
||||
template<typename T, typename Str = const char*>
|
||||
constexpr auto ModelTypeVersion_v = requireModelTypeVersion<T>();
|
||||
|
||||
template<typename T, typename Str = const char*>
|
||||
constexpr auto ModelTypeVersionStr_v = [] {
|
||||
constexpr auto version = ModelTypeVersion_v<T>;
|
||||
constexpr auto versionStr = ox::sfmt("{}", version);
|
||||
return ox::BString<versionStr.len()>{versionStr};
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
constexpr auto ModelTypeId_v = [] {
|
||||
constexpr auto name = ModelTypeName_v<T, ox::StringView>;
|
||||
constexpr auto version = ModelTypeVersion_v<T>;
|
||||
constexpr auto versionStr = ox::sfmt<ox::BString<19>>("{}", version);
|
||||
return ox::sfmt<ox::BString<name.len() + versionStr.len() + 1>>("{};{}", name, versionStr);
|
||||
}();
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user