From 74bb9cd27242b9320f99ff4d2b50c3051576cc14 Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 8 Feb 2022 16:53:51 +0800 Subject: ... --- include/cru/ui/mapper/MapperRegistry.hpp | 58 -------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 include/cru/ui/mapper/MapperRegistry.hpp (limited to 'include/cru/ui/mapper/MapperRegistry.hpp') diff --git a/include/cru/ui/mapper/MapperRegistry.hpp b/include/cru/ui/mapper/MapperRegistry.hpp deleted file mode 100644 index 1c02be49..00000000 --- a/include/cru/ui/mapper/MapperRegistry.hpp +++ /dev/null @@ -1,58 +0,0 @@ -#pragma once - -#include "Mapper.hpp" - -#include -#include - -namespace cru::ui::mapper { -class CRU_UI_API MapperRegistry { - public: - static MapperRegistry* GetInstance(); - - MapperRegistry(); - - CRU_DELETE_COPY(MapperRegistry) - CRU_DELETE_MOVE(MapperRegistry) - - ~MapperRegistry(); - - const std::vector& GetAllMappers() const { return mapper_list_; } - - template - BasicMapper* GetMapper() const { - for (auto mapper : mapper_list_) { - if (mapper->GetTypeIndex() == typeid(T)) { - return static_cast*>(mapper); - } - } - return nullptr; - } - - template - BasicRefMapper* GetRefMapper() const { - return GetMapper>(); - } - - template - BasicPtrMapper* GetPtrMapper() const { - return GetMapper>(); - } - - template - std::vector GetMappersByInterface() const { - std::vector result; - for (auto mapper : mapper_list_) { - auto m = dynamic_cast(mapper); - if (m) result.push_back(m); - } - return result; - } - - void RegisterMapper(MapperBase* mapper); - void UnregisterMapper(MapperBase* mapper); - - private: - std::vector mapper_list_; -}; -} // namespace cru::ui::mapper -- cgit v1.2.3