The resource collection interface. More...
#include "murl_resource_i_collection.h"
Public Member Functions | |
virtual ICollection * | GetCollectionInterface ()=0 |
Get the mutable ICollection interface. More... | |
virtual const ICollection * | GetCollectionInterface () const =0 |
Get the constant ICollection interface. More... | |
virtual const ICollectionFactory * | GetCreator () const =0 |
Get the factory object used to create this collection. More... | |
virtual Bool | Init ()=0 |
Initialize this collection. More... | |
virtual Bool | DeInit ()=0 |
De-initialize this collection. More... | |
virtual Bool | RegisterPackageData (const String &name, const ConstData &data)=0 |
Register a specific package from a block of memory. More... | |
virtual Bool | UnregisterPackageData (const String &name)=0 |
Unregister a package previously registered through RegisterPackageData(). More... | |
virtual const IPackage * | CreatePackageFromFile (const String &id, const ICondition *condition, const String &fileName, IEnums::FileCategory fileCategory, Result &result)=0 |
Create a resource package from a file. More... | |
virtual const IPackage * | CreatePackageFromMemory (const String &id, const ICondition *condition, const String &fileName, IEnums::FileCategory fileCategory, const ConstData &data, Bool &dataCanBeDisposed, Result &result)=0 |
Create a resource package from a block of memory. More... | |
virtual const IPackage * | CreatePackageReference (const IPackage *referencedPackage, const String &id, const ICondition *condition)=0 |
Create a reference to an existing resource package. More... | |
virtual Bool | DestroyPackage (const IPackage *&package)=0 |
Destroy a previously created package. More... | |
virtual Bool | QueryPackageFromFile (const String &fileName, IEnums::FileCategory fileCategory, String *id, UInt32 *revision, Bool *isDataValid, Bool *isVersionValid, Bool *isChecksumValid) const =0 |
Query information about a package file. More... | |
virtual Bool | QueryPackageFromMemory (const ConstData &data, String *id, UInt32 *revision, Bool *isDataValid, Bool *isVersionValid, Bool *isChecksumValid) const =0 |
Query information about a package in memory. More... | |
virtual UInt32 | GetNumberOfPackages () const =0 |
Get the total number of packages in this collection. More... | |
virtual const IPackage * | GetPackage (UInt32 index) const =0 |
Get the package at a given index. More... | |
virtual const ICondition * | GetPackageCondition (UInt32 index) const =0 |
Get the condition of a package at a given index. More... | |
virtual const IPackage * | GetPackage (const String &id) const =0 |
Get a package by its ID. More... | |
virtual const IObject * | GetObject (const String &id) const =0 |
Get a single generic resource object by its package/object ID. More... | |
virtual const IBinary * | GetBinary (const String &id) const =0 |
Get a single object as a specialized Resource::IBinary. More... | |
virtual const IGraph * | GetGraph (const String &id) const =0 |
Get a single object as a specialized Resource::IGraph. More... | |
virtual const IImage * | GetImage (const String &id) const =0 |
Get a single object as a specialized Resource::IImage. More... | |
virtual const IMesh * | GetMesh (const String &id) const =0 |
Get a single object as a specialized Resource::IMesh. More... | |
virtual const IFont * | GetFont (const String &id) const =0 |
Get a single object as a specialized Resource::IFont. More... | |
virtual const IShader * | GetShader (const String &id) const =0 |
Get a single object as a specialized Resource::IShader. More... | |
virtual const IAudio * | GetAudio (const String &id) const =0 |
Get a single object as a specialized Resource::IAudio. More... | |
virtual const IAnimation * | GetAnimation (const String &id) const =0 |
Get a single object as a specialized Resource::IAnimation. More... | |
virtual const IAtlas * | GetAtlas (const String &id) const =0 |
Get a single object as a specialized Resource::IAtlas. More... | |
virtual const IArchive * | GetArchive (const String &id) const =0 |
Get a single object as a specialized Resource::IArchive. More... | |
virtual const IVideo * | GetVideo (const String &id) const =0 |
Get a single object as a specialized Resource::IVideo. More... | |
virtual const IScript * | GetScript (const String &id) const =0 |
Get a single object as a specialized Resource::IScript. More... | |
virtual const IDictionary * | GetDictionary (const String &id) const =0 |
Get a single object as a specialized Resource::IDictionary. More... | |
virtual const IGrid * | GetGrid (const String &id) const =0 |
Get a single object as a specialized Resource::IGrid. More... | |
virtual const IText * | GetText (const String &id) const =0 |
Get a single text resource. More... | |
virtual Bool | SetParentPackage (const IPackage *parentPackage)=0 |
Set the optional parent package this collection belongs to. More... | |
virtual const IPackage * | GetParentPackage () const =0 |
Get the optional parent package this collection belongs to. More... | |
virtual Bool | SetParentCollection (const ICollection *parentCollection)=0 |
Set the optional parent collection. More... | |
virtual const ICollection * | GetParentCollection () const =0 |
Get the optional parent collection. More... | |
virtual UInt32 | GetNumberOfAllocatedResourceBytes () const =0 |
Query the total number of allocated resource bytes in this collection. More... | |
virtual Bool | CollectStatisticsObjects (Index< const IStatisticsObject * > &objects) const =0 |
Populate a given index with all objects currently present in the collection. More... | |
Public Member Functions inherited from Murl::IFactoryObject< ICollection > | |
~IFactoryObject () override | |
The destructor. | |
virtual const ClassInfo * | GetObjectClassInfo () const=0 |
Get the object instance's class info, if present. More... | |
virtual void | ResetObjectProperties ()=0 |
Reset the object instance's properties to their default values. | |
Additional Inherited Members | |
Public Types inherited from Murl::IFactoryObject< ICollection > | |
using | ClassInfoArray = Array< const ClassInfo * > |
Definition of an array of ClassInfo objects. | |
Static Public Member Functions inherited from Murl::IFactoryObject< ICollection > | |
static const PropertyInfo * | GetPropertyInfo () |
Get the class' property info struct. More... | |
static const AttributeInfo * | GetAttributeInfo () |
Get the class' attribute info struct. More... | |
static void | ResetProperties (IFactoryObject< ICollection > *object) |
Reset an object instance's properties to their default values. More... | |
Detailed Description
The resource collection interface.
A resource collection provides methods to manage individual Resource::IPackage objects, which contain a number of individual Resource::IObject instances. The resource collection also provides methods to retrieve individual objects via a package/object identifier pair in the form "packageId:objectId", as in GetObject() and related methods.
Member Function Documentation
◆ GetCollectionInterface() [1/2]
|
pure virtual |
Get the mutable ICollection interface.
- Returns
- The ICollection interface.
◆ GetCollectionInterface() [2/2]
|
pure virtual |
Get the constant ICollection interface.
- Returns
- The ICollection interface.
◆ GetCreator()
|
pure virtual |
Get the factory object used to create this collection.
- Returns
- The creator factory.
◆ Init()
|
pure virtual |
Initialize this collection.
- Returns
- true if successful.
◆ DeInit()
|
pure virtual |
De-initialize this collection.
- Returns
- true if successful.
◆ RegisterPackageData()
|
pure virtual |
Register a specific package from a block of memory.
This method can be used to register a package from memory as if it was a file on disk. Internally, the CreatePackageFromFile() first checks if any package with the given file name was registered through this method before actually searching the file system.
- Parameters
-
name The file name to register. data A Data object containing the binary package.
- Returns
- true if successful.
◆ UnregisterPackageData()
Unregister a package previously registered through RegisterPackageData().
- Parameters
-
name The file name to unregister.
- Returns
- true if successful.
◆ CreatePackageFromFile()
|
pure virtual |
Create a resource package from a file.
- Parameters
-
id The internal package ID. condition An optional condition interface to check. fileName The name of the package file, relative to the given file category below. fileCategory The file system category where to look for the given file. result The object to receive the result of the operation.
- Returns
- The newly created package, or null if failed.
◆ CreatePackageFromMemory()
|
pure virtual |
Create a resource package from a block of memory.
- Parameters
-
id The internal package ID. condition An optional condition interface to check. fileName The file name of the package, relative to which any individual file sub-resources/-packages are accessed from the file system. fileCategory The file system category to prepend to the file name. data The binary package data. dataCanBeDisposed A reference to a Bool variable receiving true whenever it is safe to delete the input data right after package creation. If this value receives false, the input data must be kept until the package is destroyed using DestroyPackage(). result The object to receive the result of the operation.
- Returns
- The newly created package, or null if failed.
◆ CreatePackageReference()
|
pure virtual |
Create a reference to an existing resource package.
- Parameters
-
referencedPackage The package to refer to. id The internal package ID. condition An optional condition interface to check.
- Returns
- The referenced package, or null if failed.
◆ DestroyPackage()
Destroy a previously created package.
- Parameters
-
package A reference to a pointer holding the package to destroy.
- Returns
- true if successful.
◆ QueryPackageFromFile()
|
pure virtual |
Query information about a package file.
- Parameters
-
fileName The name of the package file, relative to the given file category below. fileCategory The file system category where to look for the given file. id An optional pointer to receive the package ID, if present. revision An optional pointer to receive the user-defined package revision, if present. isDataValid An optional pointer to receive the result of the overall data validity check. isVersionValid An optional pointer to receive the result of the version check. isChecksumValid An optional pointer to receive the result of the checksum comparison, if the package does include one.
- Returns
- true if the package could be loaded in the first place.
◆ QueryPackageFromMemory()
|
pure virtual |
Query information about a package in memory.
- Parameters
-
data The binary package data. id An optional pointer to receive the package ID, if present. revision An optional pointer to receive the user-defined package revision, if present. isDataValid An optional pointer to receive the result of the overall data validity check. isVersionValid An optional pointer to receive the result of the version check. isChecksumValid An optional pointer to receive the result of the checksum comparison, if the package does include one.
- Returns
- true if the package could be loaded in the first place.
◆ GetNumberOfPackages()
|
pure virtual |
Get the total number of packages in this collection.
- Returns
- The number of packages.
◆ GetPackage() [1/2]
Get the package at a given index.
- Parameters
-
index The index of the package, from 0 to GetNumberOfPackages()-1.
- Returns
- A pointer to the package, or null if the index is out of range.
◆ GetPackageCondition()
|
pure virtual |
Get the condition of a package at a given index.
- Parameters
-
index The index of the package, from 0 to GetNumberOfPackages()-1.
- Returns
- The condition, or null if unconditional or the index is out of range.
◆ GetPackage() [2/2]
|
pure virtual |
Get a package by its ID.
- Parameters
-
id The package ID to query.
- Returns
- A pointer to the package, or null if a package with given ID was not found.
◆ GetObject()
|
pure virtual |
Get a single generic resource object by its package/object ID.
The given ID must be in the form "/packageId/objectId", to reference an object in a specific loaded package. If the package contains sub-packages, the resource may be referenced via e.g. "/packageId/subPackageId/objectId".
- Parameters
-
id The ID of the object to retrieve.
- Returns
- A pointer to the generic object, or null if not found.
◆ GetBinary()
|
pure virtual |
Get a single object as a specialized Resource::IBinary.
See GetObject().
- Parameters
-
id The ID of the object to retrieve.
- Returns
- A pointer to the specialized object, or null if not found.
◆ GetGraph()
Get a single object as a specialized Resource::IGraph.
See GetObject().
- Parameters
-
id The ID of the object to retrieve.
- Returns
- A pointer to the specialized object, or null if not found.
◆ GetImage()
Get a single object as a specialized Resource::IImage.
See GetObject().
- Parameters
-
id The ID of the object to retrieve.
- Returns
- A pointer to the specialized object, or null if not found.
◆ GetMesh()
Get a single object as a specialized Resource::IMesh.
See GetObject().
- Parameters
-
id The ID of the object to retrieve.
- Returns
- A pointer to the specialized object, or null if not found.
◆ GetFont()
Get a single object as a specialized Resource::IFont.
See GetObject().
- Parameters
-
id The ID of the object to retrieve.
- Returns
- A pointer to the specialized object, or null if not found.
◆ GetShader()
|
pure virtual |
Get a single object as a specialized Resource::IShader.
See GetObject().
- Parameters
-
id The ID of the object to retrieve.
- Returns
- A pointer to the specialized object, or null if not found.
◆ GetAudio()
Get a single object as a specialized Resource::IAudio.
See GetObject().
- Parameters
-
id The ID of the object to retrieve.
- Returns
- A pointer to the specialized object, or null if not found.
◆ GetAnimation()
|
pure virtual |
Get a single object as a specialized Resource::IAnimation.
See GetObject().
- Parameters
-
id The ID of the object to retrieve.
- Returns
- A pointer to the specialized object, or null if not found.
◆ GetAtlas()
Get a single object as a specialized Resource::IAtlas.
See GetObject().
- Parameters
-
id The ID of the object to retrieve.
- Returns
- A pointer to the specialized object, or null if not found.
◆ GetArchive()
|
pure virtual |
Get a single object as a specialized Resource::IArchive.
See GetObject().
- Parameters
-
id The ID of the object to retrieve.
- Returns
- A pointer to the specialized object, or null if not found.
◆ GetVideo()
Get a single object as a specialized Resource::IVideo.
See GetObject().
- Parameters
-
id The ID of the object to retrieve.
- Returns
- A pointer to the specialized object, or null if not found.
◆ GetScript()
|
pure virtual |
Get a single object as a specialized Resource::IScript.
See GetObject().
- Parameters
-
id The ID of the object to retrieve.
- Returns
- A pointer to the specialized object, or null if not found.
◆ GetDictionary()
|
pure virtual |
Get a single object as a specialized Resource::IDictionary.
See GetObject().
- Parameters
-
id The ID of the object to retrieve.
- Returns
- A pointer to the specialized object, or null if not found.
◆ GetGrid()
Get a single object as a specialized Resource::IGrid.
See GetObject().
- Parameters
-
id The ID of the object to retrieve.
- Returns
- A pointer to the specialized object, or null if not found.
◆ GetText()
Get a single text resource.
See GetObject().
- Parameters
-
id The ID of the text to retrieve.
- Returns
- A pointer to the text object, or null if not found.
◆ SetParentPackage()
|
pure virtual |
Set the optional parent package this collection belongs to.
- Parameters
-
parentPackage The containing package, or null for removing.
- Returns
- true if successful.
◆ GetParentPackage()
|
pure virtual |
Get the optional parent package this collection belongs to.
- Returns
- The containing package, or null if the collection is not contained in another package.
◆ SetParentCollection()
|
pure virtual |
Set the optional parent collection.
An optional parent collection can be defined to perform an additional search for a resource (via package and object ID) if it cannot be found in this collection.
- Parameters
-
parentCollection The parent collection, or null for removing.
- Returns
- true if successful.
◆ GetParentCollection()
|
pure virtual |
Get the optional parent collection.
- Returns
- The parent collection, or null if not defined.
◆ GetNumberOfAllocatedResourceBytes()
|
pure virtual |
Query the total number of allocated resource bytes in this collection.
- Returns
- The number of allocated bytes.
◆ CollectStatisticsObjects()
|
pure virtual |
Populate a given index with all objects currently present in the collection.
For this method to successfully return all the present objects, the method IEngineConfiguration::SetExtendedObjectStatisticsEnabled(true) must be called in the app's Configure() method.
- Parameters
-
objects An index to receive all the present objects.
- Returns
- true if successful.
The documentation for this interface was generated from the following file:
- murl_resource_i_collection.h