class
#include <Spore/Resource/IResourceFactory.h>
IResourceFactory An interface that can be used to create resources of certain types.
Contents
- Reference
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.
- class UTFWin::cCursorManager
Public functions
- auto Initialize() -> bool pure virtual
- auto Dispose() -> bool pure virtual
- auto GetFactoryType() -> uint32_t pure virtual
- auto CreateResource(IRecord* pRecord, ResourceObjectPtr& pDst, void* extraData, uint32_t typeID) -> bool pure virtual
- Creates a new resource of the specified type, using the file record given.
- auto CreateResourceAsync(IAsyncRequestPtr* ppDst, int16_t, IRecord* pRecord, void* extraData, uint32_t typeID, int) -> bool pure virtual
- auto ReadResource(IRecord* pRecord, ResourceObject* pResource, void* extraData, uint32_t typeID) -> bool pure virtual
- Reads the data into the resource given.
- auto WriteResource(ResourceObject* pResource, IRecord* pRecord, void* extraData, 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 CanConvert(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(IRecord* pRecord,
ResourceObjectPtr& pDst,
void* extraData,
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. |
extraData | |
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:: ReadResource(IRecord* pRecord,
ResourceObject* pResource,
void* extraData,
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. |
extraData | |
typeID | The type ID of the file to read, which might be used to differentiate between different file formats. |
bool Resource:: IResourceFactory:: WriteResource(ResourceObject* pResource,
IRecord* pRecord,
void* extraData,
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. |
extraData | |
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:: CanConvert(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.