[nostalgia] Use requireTypeNameModel in place of getTypeNameModel where it makes sense
This commit is contained in:
parent
7aead742eb
commit
e0364925a3
@ -170,7 +170,7 @@ class AssetManager {
|
||||
|
||||
template<typename T>
|
||||
AssetTypeManager<T> *getTypeManager() noexcept {
|
||||
constexpr auto typeName = ox::ModelTypeName_v<T>;
|
||||
constexpr auto typeName = ox::requireModelTypeName<T>();
|
||||
static_assert(ox_strcmp(typeName, "") != 0, "Types must have TypeName to use AssetManager");
|
||||
auto &am = m_assetTypeManagers[typeName];
|
||||
if (!am) {
|
||||
|
@ -40,7 +40,7 @@ constexpr auto ConfigDir = [] {
|
||||
}();
|
||||
|
||||
template<typename T>
|
||||
ox::Result<T> readConfig(core::Context *ctx, const ox::String &name = ox::getModelTypeName<T>()) noexcept {
|
||||
ox::Result<T> readConfig(core::Context *ctx, const ox::String &name) noexcept {
|
||||
oxAssert(name != "", "Config type has no TypeName");
|
||||
const auto homeDir = std::getenv("HOME");
|
||||
const auto configPath = ox::sfmt(ConfigDir, homeDir, ctx->appName).toStdString();
|
||||
@ -62,6 +62,12 @@ ox::Result<T> readConfig(core::Context *ctx, const ox::String &name = ox::getMod
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
ox::Result<T> readConfig(core::Context *ctx) noexcept {
|
||||
constexpr auto TypeName = ox::requireModelTypeName<T>();
|
||||
return readConfig<T>(ctx, TypeName);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
ox::Error writeConfig(core::Context *ctx, const ox::String &name, T *data) noexcept {
|
||||
oxAssert(name != "", "Config type has no TypeName");
|
||||
@ -91,7 +97,7 @@ ox::Error writeConfig(core::Context *ctx, const ox::String &name, T *data) noexc
|
||||
|
||||
template<typename T>
|
||||
ox::Error writeConfig(core::Context *ctx, T *data) noexcept {
|
||||
const auto TypeName = ox::getModelTypeName<T>();
|
||||
constexpr auto TypeName = ox::requireModelTypeName<T>();
|
||||
return writeConfig(ctx, TypeName, data);
|
||||
}
|
||||
|
||||
@ -104,7 +110,7 @@ void openConfig(core::Context *ctx, const ox::String &name, Func f) noexcept {
|
||||
|
||||
template<typename T, typename Func>
|
||||
void openConfig(core::Context *ctx, Func f) noexcept {
|
||||
const auto TypeName = ox::getModelTypeName<T>();
|
||||
constexpr auto TypeName = ox::requireModelTypeName<T>();
|
||||
openConfig<T>(ctx, TypeName, f);
|
||||
}
|
||||
|
||||
@ -118,7 +124,7 @@ void editConfig(core::Context *ctx, const ox::String &name, Func f) noexcept {
|
||||
|
||||
template<typename T, typename Func>
|
||||
void editConfig(core::Context *ctx, Func f) noexcept {
|
||||
const auto TypeName = ox::getModelTypeName<T>();
|
||||
constexpr auto TypeName = ox::requireModelTypeName<T>();
|
||||
editConfig<T>(ctx, TypeName, f);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user