MyGUI 3.4.1
MyGUI_GenericFactory.h
Go to the documentation of this file.
1/*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7#ifndef MYGUI_GENERIC_FACTORY_H_
8#define MYGUI_GENERIC_FACTORY_H_
9
10#include "MyGUI_Prerequest.h"
11#include "MyGUI_Types.h"
12#include "MyGUI_Delegate.h"
13#include "MyGUI_IObject.h"
14
15namespace MyGUI
16{
17
18 template <typename Type>
20 {
21 public:
24 {
25 return newDelegate(createFromFactory);
26 }
27
28 private:
29 static void createFromFactory(IObject*& _instance)
30 {
31 _instance = new Type();
32 }
33 };
34
35} // namespace MyGUI
36
37#endif // MYGUI_GENERIC_FACTORY_H_
static Delegate::IDelegate * getFactory()
delegates::DelegateFunction< Args... > * newDelegate(void(*_func)(Args... args))