Resource::IResourceFactory class

An interface that can be used to create resources of certain types.

Resource factories are mapped into the IResourceManager so that when a resource is accessed the correct object is returned (e.g. if you access a .png file, you get the Texture object directly). The resources created must inherit from ResourceObject.

Base classes

class ThreadedObject

Derived classes

class App::cPropManager
The implementation of IPropManager; this should only be used for extending and detouring.

Public functions

auto Initialize() -> bool pure virtual
auto Dispose() -> bool pure virtual
auto GetType() -> uint32_t pure virtual
auto CreateResource(IPFRecord* pRecord, ResourceObject*& pDst, int, uint32_t typeID) -> bool pure virtual
Creates a new resource of the specified type, using the file record given.
auto AsyncAccess(IPFRecord** ppDst, int, DBPF* pDBPF, int, int, int) -> bool pure virtual
auto Read(IPFRecord* pRecord, ResourceObject* pResource, int, uint32_t typeID) -> bool pure virtual
Reads the data into the resource given.
auto Write(ResourceObject* pResource, IPFRecord* pRecord, int, uint32_t typeID) -> bool pure virtual
Reads the resource into the file given.
auto GetSupportedTypes(uint32_t* pDstTypes, size_t count) const -> size_t pure virtual
This method must tell all the type IDs that are accepted by this factory.
auto IsValid(uint32_t typeID, uint32_t subTypeID) -> bool pure virtual
This method must tell whether this type ID (which might be a generic one, e.g.

Function documentation

bool Resource::IResourceFactory::CreateResource(IPFRecord* pRecord, ResourceObject*& pDst, int, uint32_t typeID) pure virtual

Creates a new resource of the specified type, using the file record given.

Parameters
pRecord The IPFRecord that points to the file used by the resource (either for reading or for writing).
pDst out A pointer where the ResourceObject created must be written.
typeID The type ID of the file to read, which might be used to differentiate between different file formats or resource types.

bool Resource::IResourceFactory::Read(IPFRecord* pRecord, ResourceObject* pResource, int, uint32_t typeID) pure virtual

Reads the data into the resource given.

Parameters
pRecord The IPFRecord that points to the file that must be read.
pResource The ResourceObject where the data must be loaded.
typeID The type ID of the file to read, which might be used to differentiate between different file formats.

bool Resource::IResourceFactory::Write(ResourceObject* pResource, IPFRecord* pRecord, int, uint32_t typeID) pure virtual

Reads the resource into the file given.

Parameters
pResource The ResourceObject that must be saved.
pRecord The IPFRecord that points to the file that must be written.
typeID The type ID of the file to write, which might be used to differentiate between different file formats.

size_t Resource::IResourceFactory::GetSupportedTypes(uint32_t* pDstTypes, size_t count) const pure virtual

This method must tell all the type IDs that are accepted by this factory.

Parameters
pDstTypes out The uint32_t array where the type IDs must be written.
count The size of the pDstTypes array.
Returns How many type IDs are supported.

The method must return how many type IDs are supported.

bool Resource::IResourceFactory::IsValid(uint32_t typeID, uint32_t subTypeID) pure virtual

This method must tell whether this type ID (which might be a generic one, e.g.

Parameters
typeID
subTypeID

.image) and the sub type ID (e.g. .png) are accepted by this factory. The subtypeID might be 0, in which case only the type ID matters.