The resource collection interface. More...

#include "murl_resource_i_collection.h"

Inheritance diagram for Murl::Resource::ICollection:

Public Member Functions

virtual ICollectionGetCollectionInterface ()=0
 Get the mutable ICollection interface. More...
 
virtual const ICollectionGetCollectionInterface () const =0
 Get the constant ICollection interface. More...
 
virtual const ICollectionFactoryGetCreator () 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 IPackageCreatePackageFromFile (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 IPackageCreatePackageFromMemory (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 IPackageCreatePackageReference (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 IPackageGetPackage (UInt32 index) const =0
 Get the package at a given index. More...
 
virtual const IConditionGetPackageCondition (UInt32 index) const =0
 Get the condition of a package at a given index. More...
 
virtual const IPackageGetPackage (const String &id) const =0
 Get a package by its ID. More...
 
virtual const IObjectGetObject (const String &id) const =0
 Get a single generic resource object by its package/object ID. More...
 
virtual const IBinaryGetBinary (const String &id) const =0
 Get a single object as a specialized Resource::IBinary. More...
 
virtual const IGraphGetGraph (const String &id) const =0
 Get a single object as a specialized Resource::IGraph. More...
 
virtual const IImageGetImage (const String &id) const =0
 Get a single object as a specialized Resource::IImage. More...
 
virtual const IMeshGetMesh (const String &id) const =0
 Get a single object as a specialized Resource::IMesh. More...
 
virtual const IFontGetFont (const String &id) const =0
 Get a single object as a specialized Resource::IFont. More...
 
virtual const IShaderGetShader (const String &id) const =0
 Get a single object as a specialized Resource::IShader. More...
 
virtual const IAudioGetAudio (const String &id) const =0
 Get a single object as a specialized Resource::IAudio. More...
 
virtual const IAnimationGetAnimation (const String &id) const =0
 Get a single object as a specialized Resource::IAnimation. More...
 
virtual const IAtlasGetAtlas (const String &id) const =0
 Get a single object as a specialized Resource::IAtlas. More...
 
virtual const IArchiveGetArchive (const String &id) const =0
 Get a single object as a specialized Resource::IArchive. More...
 
virtual const IVideoGetVideo (const String &id) const =0
 Get a single object as a specialized Resource::IVideo. More...
 
virtual const IScriptGetScript (const String &id) const =0
 Get a single object as a specialized Resource::IScript. More...
 
virtual const IDictionaryGetDictionary (const String &id) const =0
 Get a single object as a specialized Resource::IDictionary. More...
 
virtual const IGridGetGrid (const String &id) const =0
 Get a single object as a specialized Resource::IGrid. More...
 
virtual const ITextGetText (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 IPackageGetParentPackage () 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 ICollectionGetParentCollection () 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 PropertyInfoGetPropertyInfo ()
 Get the class' property info struct. More...
 
static const AttributeInfoGetAttributeInfo ()
 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]

virtual ICollection* Murl::Resource::ICollection::GetCollectionInterface ( )
pure virtual

Get the mutable ICollection interface.

Returns
The ICollection interface.

◆ GetCollectionInterface() [2/2]

virtual const ICollection* Murl::Resource::ICollection::GetCollectionInterface ( ) const
pure virtual

Get the constant ICollection interface.

Returns
The ICollection interface.

◆ GetCreator()

virtual const ICollectionFactory* Murl::Resource::ICollection::GetCreator ( ) const
pure virtual

Get the factory object used to create this collection.

Returns
The creator factory.

◆ Init()

virtual Bool Murl::Resource::ICollection::Init ( )
pure virtual

Initialize this collection.

Returns
true if successful.

◆ DeInit()

virtual Bool Murl::Resource::ICollection::DeInit ( )
pure virtual

De-initialize this collection.

Returns
true if successful.

◆ RegisterPackageData()

virtual Bool Murl::Resource::ICollection::RegisterPackageData ( const String name,
const ConstData data 
)
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
nameThe file name to register.
dataA Data object containing the binary package.
Returns
true if successful.

◆ UnregisterPackageData()

virtual Bool Murl::Resource::ICollection::UnregisterPackageData ( const String name)
pure virtual

Unregister a package previously registered through RegisterPackageData().

Parameters
nameThe file name to unregister.
Returns
true if successful.

◆ CreatePackageFromFile()

virtual const IPackage* Murl::Resource::ICollection::CreatePackageFromFile ( const String id,
const ICondition condition,
const String fileName,
IEnums::FileCategory  fileCategory,
Result result 
)
pure virtual

Create a resource package from a file.

Parameters
idThe internal package ID.
conditionAn optional condition interface to check.
fileNameThe name of the package file, relative to the given file category below.
fileCategoryThe file system category where to look for the given file.
resultThe object to receive the result of the operation.
Returns
The newly created package, or null if failed.

◆ CreatePackageFromMemory()

virtual const IPackage* Murl::Resource::ICollection::CreatePackageFromMemory ( const String id,
const ICondition condition,
const String fileName,
IEnums::FileCategory  fileCategory,
const ConstData data,
Bool dataCanBeDisposed,
Result result 
)
pure virtual

Create a resource package from a block of memory.

Parameters
idThe internal package ID.
conditionAn optional condition interface to check.
fileNameThe file name of the package, relative to which any individual file sub-resources/-packages are accessed from the file system.
fileCategoryThe file system category to prepend to the file name.
dataThe binary package data.
dataCanBeDisposedA 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().
resultThe object to receive the result of the operation.
Returns
The newly created package, or null if failed.

◆ CreatePackageReference()

virtual const IPackage* Murl::Resource::ICollection::CreatePackageReference ( const IPackage referencedPackage,
const String id,
const ICondition condition 
)
pure virtual

Create a reference to an existing resource package.

Parameters
referencedPackageThe package to refer to.
idThe internal package ID.
conditionAn optional condition interface to check.
Returns
The referenced package, or null if failed.

◆ DestroyPackage()

virtual Bool Murl::Resource::ICollection::DestroyPackage ( const IPackage *&  package)
pure virtual

Destroy a previously created package.

Parameters
packageA reference to a pointer holding the package to destroy.
Returns
true if successful.

◆ QueryPackageFromFile()

virtual Bool Murl::Resource::ICollection::QueryPackageFromFile ( const String fileName,
IEnums::FileCategory  fileCategory,
String id,
UInt32 revision,
Bool isDataValid,
Bool isVersionValid,
Bool isChecksumValid 
) const
pure virtual

Query information about a package file.

Parameters
fileNameThe name of the package file, relative to the given file category below.
fileCategoryThe file system category where to look for the given file.
idAn optional pointer to receive the package ID, if present.
revisionAn optional pointer to receive the user-defined package revision, if present.
isDataValidAn optional pointer to receive the result of the overall data validity check.
isVersionValidAn optional pointer to receive the result of the version check.
isChecksumValidAn 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()

virtual Bool Murl::Resource::ICollection::QueryPackageFromMemory ( const ConstData data,
String id,
UInt32 revision,
Bool isDataValid,
Bool isVersionValid,
Bool isChecksumValid 
) const
pure virtual

Query information about a package in memory.

Parameters
dataThe binary package data.
idAn optional pointer to receive the package ID, if present.
revisionAn optional pointer to receive the user-defined package revision, if present.
isDataValidAn optional pointer to receive the result of the overall data validity check.
isVersionValidAn optional pointer to receive the result of the version check.
isChecksumValidAn 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()

virtual UInt32 Murl::Resource::ICollection::GetNumberOfPackages ( ) const
pure virtual

Get the total number of packages in this collection.

Returns
The number of packages.

◆ GetPackage() [1/2]

virtual const IPackage* Murl::Resource::ICollection::GetPackage ( UInt32  index) const
pure virtual

Get the package at a given index.

Parameters
indexThe 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()

virtual const ICondition* Murl::Resource::ICollection::GetPackageCondition ( UInt32  index) const
pure virtual

Get the condition of a package at a given index.

Parameters
indexThe 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]

virtual const IPackage* Murl::Resource::ICollection::GetPackage ( const String id) const
pure virtual

Get a package by its ID.

Parameters
idThe package ID to query.
Returns
A pointer to the package, or null if a package with given ID was not found.

◆ GetObject()

virtual const IObject* Murl::Resource::ICollection::GetObject ( const String id) const
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
idThe ID of the object to retrieve.
Returns
A pointer to the generic object, or null if not found.

◆ GetBinary()

virtual const IBinary* Murl::Resource::ICollection::GetBinary ( const String id) const
pure virtual

Get a single object as a specialized Resource::IBinary.

See GetObject().

Parameters
idThe ID of the object to retrieve.
Returns
A pointer to the specialized object, or null if not found.

◆ GetGraph()

virtual const IGraph* Murl::Resource::ICollection::GetGraph ( const String id) const
pure virtual

Get a single object as a specialized Resource::IGraph.

See GetObject().

Parameters
idThe ID of the object to retrieve.
Returns
A pointer to the specialized object, or null if not found.

◆ GetImage()

virtual const IImage* Murl::Resource::ICollection::GetImage ( const String id) const
pure virtual

Get a single object as a specialized Resource::IImage.

See GetObject().

Parameters
idThe ID of the object to retrieve.
Returns
A pointer to the specialized object, or null if not found.

◆ GetMesh()

virtual const IMesh* Murl::Resource::ICollection::GetMesh ( const String id) const
pure virtual

Get a single object as a specialized Resource::IMesh.

See GetObject().

Parameters
idThe ID of the object to retrieve.
Returns
A pointer to the specialized object, or null if not found.

◆ GetFont()

virtual const IFont* Murl::Resource::ICollection::GetFont ( const String id) const
pure virtual

Get a single object as a specialized Resource::IFont.

See GetObject().

Parameters
idThe ID of the object to retrieve.
Returns
A pointer to the specialized object, or null if not found.

◆ GetShader()

virtual const IShader* Murl::Resource::ICollection::GetShader ( const String id) const
pure virtual

Get a single object as a specialized Resource::IShader.

See GetObject().

Parameters
idThe ID of the object to retrieve.
Returns
A pointer to the specialized object, or null if not found.

◆ GetAudio()

virtual const IAudio* Murl::Resource::ICollection::GetAudio ( const String id) const
pure virtual

Get a single object as a specialized Resource::IAudio.

See GetObject().

Parameters
idThe ID of the object to retrieve.
Returns
A pointer to the specialized object, or null if not found.

◆ GetAnimation()

virtual const IAnimation* Murl::Resource::ICollection::GetAnimation ( const String id) const
pure virtual

Get a single object as a specialized Resource::IAnimation.

See GetObject().

Parameters
idThe ID of the object to retrieve.
Returns
A pointer to the specialized object, or null if not found.

◆ GetAtlas()

virtual const IAtlas* Murl::Resource::ICollection::GetAtlas ( const String id) const
pure virtual

Get a single object as a specialized Resource::IAtlas.

See GetObject().

Parameters
idThe ID of the object to retrieve.
Returns
A pointer to the specialized object, or null if not found.

◆ GetArchive()

virtual const IArchive* Murl::Resource::ICollection::GetArchive ( const String id) const
pure virtual

Get a single object as a specialized Resource::IArchive.

See GetObject().

Parameters
idThe ID of the object to retrieve.
Returns
A pointer to the specialized object, or null if not found.

◆ GetVideo()

virtual const IVideo* Murl::Resource::ICollection::GetVideo ( const String id) const
pure virtual

Get a single object as a specialized Resource::IVideo.

See GetObject().

Parameters
idThe ID of the object to retrieve.
Returns
A pointer to the specialized object, or null if not found.

◆ GetScript()

virtual const IScript* Murl::Resource::ICollection::GetScript ( const String id) const
pure virtual

Get a single object as a specialized Resource::IScript.

See GetObject().

Parameters
idThe ID of the object to retrieve.
Returns
A pointer to the specialized object, or null if not found.

◆ GetDictionary()

virtual const IDictionary* Murl::Resource::ICollection::GetDictionary ( const String id) const
pure virtual

Get a single object as a specialized Resource::IDictionary.

See GetObject().

Parameters
idThe ID of the object to retrieve.
Returns
A pointer to the specialized object, or null if not found.

◆ GetGrid()

virtual const IGrid* Murl::Resource::ICollection::GetGrid ( const String id) const
pure virtual

Get a single object as a specialized Resource::IGrid.

See GetObject().

Parameters
idThe ID of the object to retrieve.
Returns
A pointer to the specialized object, or null if not found.

◆ GetText()

virtual const IText* Murl::Resource::ICollection::GetText ( const String id) const
pure virtual

Get a single text resource.

See GetObject().

Parameters
idThe ID of the text to retrieve.
Returns
A pointer to the text object, or null if not found.

◆ SetParentPackage()

virtual Bool Murl::Resource::ICollection::SetParentPackage ( const IPackage parentPackage)
pure virtual

Set the optional parent package this collection belongs to.

Parameters
parentPackageThe containing package, or null for removing.
Returns
true if successful.

◆ GetParentPackage()

virtual const IPackage* Murl::Resource::ICollection::GetParentPackage ( ) const
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()

virtual Bool Murl::Resource::ICollection::SetParentCollection ( const ICollection parentCollection)
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
parentCollectionThe parent collection, or null for removing.
Returns
true if successful.

◆ GetParentCollection()

virtual const ICollection* Murl::Resource::ICollection::GetParentCollection ( ) const
pure virtual

Get the optional parent collection.

Returns
The parent collection, or null if not defined.

◆ GetNumberOfAllocatedResourceBytes()

virtual UInt32 Murl::Resource::ICollection::GetNumberOfAllocatedResourceBytes ( ) const
pure virtual

Query the total number of allocated resource bytes in this collection.

Returns
The number of allocated bytes.

◆ CollectStatisticsObjects()

virtual Bool Murl::Resource::ICollection::CollectStatisticsObjects ( Index< const IStatisticsObject * > &  objects) const
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
objectsAn 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


Copyright © 2011-2024 Spraylight GmbH.