MyGUI_GenericFactory.h
Go to the documentation of this file.
/*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#ifndef MYGUI_GENERIC_FACTORY_H_
#define MYGUI_GENERIC_FACTORY_H_
#include "MyGUI_Prerequest.h"
#include "MyGUI_Types.h"
#include "MyGUI_Delegate.h"
#include "MyGUI_IObject.h"
namespace MyGUI
{
template<typename Type>
class GenericFactory
{
public:
using Delegate = delegates::Delegate<IObject*&>;
static typename Delegate::IDelegate* getFactory()
{
return newDelegate(createFromFactory);
}
private:
static void createFromFactory(IObject*& _instance)
{
_instance = new Type();
}
};
} // namespace MyGUI
#endif // MYGUI_GENERIC_FACTORY_H_
MyGUI_Delegate.h
MyGUI_IObject.h
MyGUI_Prerequest.h
MyGUI_Types.h
MyGUI::GenericFactory
Definition MyGUI_GenericFactory.h:20
MyGUI::GenericFactory::getFactory
static Delegate::IDelegate * getFactory()
Definition MyGUI_GenericFactory.h:23
MyGUI::GenericFactory::Delegate
delegates::Delegate< IObject *& > Delegate
Definition MyGUI_GenericFactory.h:22
MyGUI::IObject
Definition MyGUI_IObject.h:17
MyGUI::delegates::Delegate
Definition MyGUI_Delegate.h:158
MyGUI::delegates::Delegate< IObject *& >::IDelegate
DelegateFunction< Args... > IDelegate
Definition MyGUI_Delegate.h:160
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::newDelegate
delegates::DelegateFunction< Args... > * newDelegate(void(*_func)(Args... args))
Definition MyGUI_Delegate.h:100