From 9b7be419c9dcc6ebd1e504713c7b2676ca3d2fdf Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Wed, 23 Oct 2024 21:54:28 +0200 Subject: `clang-format` --- src/crepe/api/AssetManager.h | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'src/crepe/api/AssetManager.h') diff --git a/src/crepe/api/AssetManager.h b/src/crepe/api/AssetManager.h index 1b8b86f..f3f1307 100644 --- a/src/crepe/api/AssetManager.h +++ b/src/crepe/api/AssetManager.h @@ -1,22 +1,18 @@ #pragma once - - #include #include #include #include #include +namespace crepe::api { -namespace crepe::api{ - -class AssetManager{ - +class AssetManager { private: - std::unordered_map< std::string, std::any> asset_cache; - + std::unordered_map asset_cache; + private: AssetManager(); virtual ~AssetManager(); @@ -24,27 +20,27 @@ private: public: AssetManager(const AssetManager &) = delete; AssetManager(AssetManager &&) = delete; - AssetManager &operator=(const AssetManager &) = delete; - AssetManager &operator=(AssetManager &&) = delete; - - - static AssetManager& get_instance(); + AssetManager & operator=(const AssetManager &) = delete; + AssetManager & operator=(AssetManager &&) = delete; + static AssetManager & get_instance(); public: - template - std::shared_ptr cache(const std::string& file_path, bool reload = false){ + template + std::shared_ptr cache(const std::string & file_path, + bool reload = false) { auto it = asset_cache.find(file_path); if (!reload && it != asset_cache.end()) { return std::any_cast>(it->second); } - std::shared_ptr new_asset = std::make_shared(file_path.c_str()); + std::shared_ptr new_asset + = std::make_shared(file_path.c_str()); asset_cache[file_path] = new_asset; return new_asset; } }; -} +} // namespace crepe::api -- cgit v1.2.3