12345678910111213141516171819202122232425262728 |
- /// 代理工厂
- #ifndef RUDelegateFactory_h
- #define RUDelegateFactory_h
- #include "RUDefine.h"
- #include "RUStateDelegate.h"
- NS_RU_BEGIN
- class DelegateFactory
- {
- public:
- static DelegateFactory* getInstance();
- /// 向工厂注册一个状态代理类的注册器
- void registerStateDelegateCreator(const std::string& creatorKey, std::function<StateDelegate*(void)> stateDelegateCreator);
- StateDelegate* createStateDelegate(const std::string& creatorKey);
- private:
- DelegateFactory() = default;
- ~DelegateFactory() = default;
- private:
- std::map<std::string, std::function<StateDelegate*(void)>> _stateDelegateCreators;
- };
- NS_RU_END
- #endif /* RUDelegateFactory_h */
|