class
IResourceFactoryAn 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.
- 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.