MyGUI
3.2.0
|
00001 00006 #ifndef __MYGUI_GENERIC_FACTORY_H__ 00007 #define __MYGUI_GENERIC_FACTORY_H__ 00008 00009 #include "MyGUI_Prerequest.h" 00010 #include "MyGUI_Types.h" 00011 #include "MyGUI_Delegate.h" 00012 00013 namespace MyGUI 00014 { 00015 00016 template <typename Type> 00017 class GenericFactory 00018 { 00019 public: 00020 typedef delegates::CDelegate1<IObject*&> Delegate; 00021 static typename Delegate::IDelegate* getFactory() 00022 { 00023 return newDelegate(createFromFactory); 00024 } 00025 00026 private: 00027 static void createFromFactory(IObject*& _instance) 00028 { 00029 _instance = new Type(); 00030 } 00031 }; 00032 00033 } // namespace MyGUI 00034 00035 #endif // __MYGUI_GENERIC_FACTORY_H__