/// 代理工厂 #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 stateDelegateCreator); StateDelegate* createStateDelegate(const std::string& creatorKey); private: DelegateFactory() = default; ~DelegateFactory() = default; private: std::map> _stateDelegateCreators; }; NS_RU_END #endif /* RUDelegateFactory_h */