metaforce/Runtime/IFactory.hpp

34 lines
1.1 KiB
C++
Raw Normal View History

2016-04-13 06:07:23 +00:00
#ifndef __URDE_IFACTORY_HPP__
#define __URDE_IFACTORY_HPP__
2015-08-18 05:54:43 +00:00
2015-08-23 06:42:29 +00:00
#include <memory>
2015-08-22 01:58:41 +00:00
#include "RetroTypes.hpp"
2016-03-04 23:04:53 +00:00
namespace urde
2015-08-18 05:54:43 +00:00
{
2015-08-22 01:58:41 +00:00
class CVParamTransfer;
class IObj;
2015-08-18 05:54:43 +00:00
2016-04-13 06:07:23 +00:00
using CFactoryFnReturn = std::unique_ptr<IObj>;
using FFactoryFunc = std::function<CFactoryFnReturn(const urde::SObjectTag& tag,
urde::CInputStream& in,
const urde::CVParamTransfer& vparms)>;
using FMemFactoryFunc = std::function<CFactoryFnReturn(const urde::SObjectTag& tag,
std::unique_ptr<u8[]>&& in, u32 len,
const urde::CVParamTransfer& vparms)>;
2015-08-18 05:54:43 +00:00
class IFactory
{
2015-08-22 01:58:41 +00:00
public:
virtual ~IFactory() = default;
2016-04-13 06:07:23 +00:00
virtual CFactoryFnReturn Build(const SObjectTag&, const CVParamTransfer&)=0;
2015-08-22 01:58:41 +00:00
virtual void BuildAsync(const SObjectTag&, const CVParamTransfer&, IObj**)=0;
virtual void CancelBuild(const SObjectTag&)=0;
virtual bool CanBuild(const SObjectTag&)=0;
2015-08-28 00:11:31 +00:00
virtual const SObjectTag* GetResourceIdByName(const char*) const=0;
2015-08-18 05:54:43 +00:00
};
}
2016-04-13 06:07:23 +00:00
#endif // __URDE_IFACTORY_HPP__