MyGUI 3.2.0

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files
- Examples

- File List
- Globals

MyGUI_GenericFactory.h
Go to the documentation of this file.
1
6 #ifndef __MYGUI_GENERIC_FACTORY_H__
7 #define __MYGUI_GENERIC_FACTORY_H__
8
9 #include "MyGUI_Prerequest.h"
10 #include "MyGUI_Types.h"
11 #include "MyGUI_Delegate.h"
12
13 namespace MyGUI
14 {
15
16 template <typename Type>
17 class GenericFactory
18 {
19 public:
20 typedef delegates::CDelegate1<IObject*&> Delegate;
21 static typename Delegate::IDelegate* getFactory()
22 {
23 return newDelegate(createFromFactory);
24 }
25
26 private:
27 static void createFromFactory(IObject*& _instance)
28 {
29 _instance = new Type();
30 }
31 };
32
33 } // namespace MyGUI
34
35 #endif // __MYGUI_GENERIC_FACTORY_H__
MyGUI::delegates::CDelegate1
Definition: MyGUI_Delegate.h:169
MyGUI::GenericFactory::Delegate
delegates::CDelegate1< IObject *& > Delegate
Definition: MyGUI_GenericFactory.h:20
MyGUI_Prerequest.h
MyGUI::newDelegate
delegates::IDelegate0 * newDelegate(void(*_func)())
Definition: MyGUI_Delegate.h:150
MyGUI::delegates::IDelegate1
Definition: MyGUI_Delegate.h:41
MyGUI_Types.h
MyGUI::GenericFactory::getFactory
static Delegate::IDelegate * getFactory()
Definition: MyGUI_GenericFactory.h:21
MyGUI::GenericFactory
Definition: MyGUI_GenericFactory.h:17
MyGUI::IObject
Definition: MyGUI_IObject.h:31
MyGUI_Delegate.h