7#ifndef MYGUI_FACTORY_MANAGER_H_
8#define MYGUI_FACTORY_MANAGER_H_
28 using Delegate = delegates::Delegate<IObject*&>;
30 void registerFactory(std::string_view _category, std::string_view _type, Delegate::IDelegate* _delegate);
32 void unregisterFactory(std::string_view _category, std::string_view _type);
34 void unregisterFactory(std::string_view _category);
37 bool isFactoryExist(std::string_view _category, std::string_view _type);
40 template<
typename Type>
41 void registerFactory(std::string_view _category)
43 registerFactory(_category, Type::getClassTypeName(), GenericFactory<Type>::getFactory());
47 template<
typename Type>
48 void registerFactory(std::string_view _category, std::string_view _type)
50 registerFactory(_category, _type, GenericFactory<Type>::getFactory());
54 template<
typename Type>
55 void unregisterFactory(std::string_view _category)
57 unregisterFactory(_category, Type::getClassTypeName());
61 IObject* createObject(std::string_view _category, std::string_view _type);
63 template<
typename Type>
64 Type* createObject(std::string_view _category)
66 IObject* item = createObject(_category, Type::getClassTypeName());
68 return item->castType<Type>(
false);
73 void destroyObject(IObject* _object);
76 using MapFactoryItem = std::map<std::string, Delegate, std::less<>>;
77 using MapRegisterFactoryItem = std::map<std::string, MapFactoryItem, std::less<>>;
78 MapRegisterFactoryItem mRegisterFactoryItems;
80 bool mIsInitialise{
false};
#define MYGUI_SINGLETON_DECLARATION(ClassName)