diff --git a/deps/ox/src/ox/std/CMakeLists.txt b/deps/ox/src/ox/std/CMakeLists.txt index ae2b9410..67de0f90 100644 --- a/deps/ox/src/ox/std/CMakeLists.txt +++ b/deps/ox/src/ox/std/CMakeLists.txt @@ -109,6 +109,7 @@ install( error.hpp fmt.hpp hardware.hpp + hash.hpp hashmap.hpp heapmgr.hpp ignore.hpp diff --git a/src/olympic/keel/include/keel/assetmanager.hpp b/src/olympic/keel/include/keel/assetmanager.hpp index a857879d..5c22a702 100644 --- a/src/olympic/keel/include/keel/assetmanager.hpp +++ b/src/olympic/keel/include/keel/assetmanager.hpp @@ -196,15 +196,15 @@ class AssetManager { template class AssetTypeManager: public AssetTypeManagerBase { public: - using Loader = std::function(ox::StringView assetId)>; + using Loader = std::function(ox::StringViewCR assetId)>; private: Loader m_loader{}; ox::HashMap>> m_cache; public: - AssetTypeManager(Loader loader) noexcept: m_loader(loader) {} + AssetTypeManager(Loader &&loader) noexcept: m_loader(std::move(loader)) {} - ox::Result> getAsset(ox::StringView const assetId) const noexcept { + ox::Result> getAsset(ox::StringViewCR assetId) const noexcept { OX_REQUIRE(out, m_cache.at(assetId)); if (!out || !*out) { return ox::Error(1, "asset is null"); @@ -212,7 +212,7 @@ class AssetManager { return AssetRef(out->get()); } - ox::Result> loadAsset(ox::StringView const assetId) noexcept { + ox::Result> loadAsset(ox::StringViewCR assetId) noexcept { auto &p = m_cache[assetId]; OX_REQUIRE_M(obj, m_loader(assetId)); if (!p) { @@ -224,7 +224,7 @@ class AssetManager { return AssetRef(p.get()); } - ox::Error reloadAsset(ox::StringView const assetId) noexcept { + ox::Error reloadAsset(ox::StringViewCR assetId) noexcept { auto &p = m_cache[assetId]; OX_REQUIRE_M(obj, m_loader(assetId)); if (!p) { @@ -247,7 +247,7 @@ class AssetManager { }; ox::HashMap> m_assetTypeManagers; - ox::HashMap> m_fileUpdated; + ox::HashMap> m_fileUpdated; template ox::Result*> getTypeManager() noexcept { @@ -273,18 +273,18 @@ class AssetManager { } template - ox::Result> getAsset(ox::StringView assetId) noexcept { + ox::Result> getAsset(ox::StringViewCR assetId) noexcept { OX_REQUIRE(m, getTypeManager()); return m->getAsset(assetId); } - ox::Error reloadAsset(ox::StringView assetId) noexcept { + ox::Error reloadAsset(ox::StringViewCR assetId) noexcept { m_fileUpdated[assetId].emit(assetId); return {}; } template - ox::Result> loadAsset(ox::StringView assetId) noexcept { + ox::Result> loadAsset(ox::StringViewCR assetId) noexcept { OX_REQUIRE(m, getTypeManager()); OX_REQUIRE(out, m->loadAsset(assetId)); m_fileUpdated[assetId].connect(m, &AssetTypeManager::reloadAsset);