OGRE 14.3
Object-Oriented Graphics Rendering Engine
Loading...
Searching...
No Matches
Ogre::ResourceGroupManager Class Reference

This singleton class manages the list of resource groups, and notifying the various resource managers of their obligations to load / unload resources in a group. More...

#include <OgreResourceGroupManager.h>

+ Inheritance diagram for Ogre::ResourceGroupManager:

Classes

struct  ResourceDeclaration
 Nested struct defining a resource declaration. More...
 
struct  ResourceLocation
 Resource location entry. More...
 

Public Types

typedef std::vector< ResourceLocationLocationList
 List of possible file locations.
 
typedef std::list< ResourceDeclarationResourceDeclarationList
 List of resource declarations.
 
typedef MapIterator< ResourceManagerMapResourceManagerIterator
 
typedef std::map< String, ResourceManager * > ResourceManagerMap
 

Public Member Functions

 ResourceGroupManager ()
 
virtual ~ResourceGroupManager ()
 
ScriptLoader_findScriptLoader (const String &pattern) const
 Method used to directly query for registered script loaders.
 
ResourceManager_getResourceManager (const String &resourceType) const
 Internal method for getting a registered ResourceManager.
 
void _notifyAllResourcesRemoved (ResourceManager *manager) const
 Internal method called by ResourceManager when all resources for that manager are removed.
 
void _notifyCustomStageEnded (void) const
 Notify this manager that one custom loading stage has been completed.
 
void _notifyCustomStageStarted (const String &description) const
 Notify this manager that one custom loading stage has been started.
 
void _notifyResourceCreated (ResourcePtr &res) const
 Internal method called by ResourceManager when a resource is created.
 
void _notifyResourceGroupChanged (const String &oldGroup, Resource *res) const
 Internal method to notify the group manager that a resource has changed group (only applicable for autodetect group)
 
void _notifyResourceRemoved (const ResourcePtr &res) const
 Internal method called by ResourceManager when a resource is removed.
 
void _registerResourceManager (const String &resourceType, ResourceManager *rm)
 Internal method for registering a ResourceManager (which should be a singleton).
 
void _registerScriptLoader (ScriptLoader *su)
 Internal method for registering a ScriptLoader.
 
void _unregisterResourceManager (const String &resourceType)
 Internal method for unregistering a ResourceManager.
 
void _unregisterScriptLoader (ScriptLoader *su)
 Internal method for unregistering a ScriptLoader.
 
void addResourceGroupListener (ResourceGroupListener *l)
 Adds a ResourceGroupListener which will be called back during resource loading events.
 
void addResourceLocation (const String &name, const String &locType, const String &resGroup=DEFAULT_RESOURCE_GROUP_NAME, bool recursive=false, bool readOnly=true)
 Adds a location to the list of searchable locations for a Resource type.
 
void clearResourceGroup (const String &name)
 Clears a resource group.
 
DataStreamPtr createResource (const String &filename, const String &groupName=DEFAULT_RESOURCE_GROUP_NAME, bool overwrite=false, const String &locationPattern=BLANKSTRING)
 Create a new resource file in a given group.
 
void createResourceGroup (const String &name, bool inGlobalPool=!OGRE_RESOURCEMANAGER_STRICT)
 Create a resource group.
 
void declareResource (const String &name, const String &resourceType, const String &groupName, ManualResourceLoader *loader, const NameValuePairList &loadParameters=NameValuePairList())
 Declares a resource to be a part of a resource group, allowing you to load and unload it as part of the group.
 
void declareResource (const String &name, const String &resourceType, const String &groupName=DEFAULT_RESOURCE_GROUP_NAME, const NameValuePairList &loadParameters=NameValuePairList())
 Declares a resource to be a part of a resource group, allowing you to load and unload it as part of the group.
 
void deleteMatchingResources (const String &filePattern, const String &groupName=DEFAULT_RESOURCE_GROUP_NAME, const String &locationPattern=BLANKSTRING)
 Delete all matching resource files.
 
void deleteResource (const String &filename, const String &groupName=DEFAULT_RESOURCE_GROUP_NAME, const String &locationPattern=BLANKSTRING)
 Delete a single resource file.
 
void destroyResourceGroup (const String &name)
 Destroys a resource group, clearing it first, destroying the resources which are part of it, and then removing it from the list of resource groups.
 
const StringfindGroupContainingResource (const String &filename) const
 Find the group in which a resource exists.
 
FileInfoListPtr findResourceFileInfo (const String &group, const String &pattern, bool dirs=false) const
 Find all files or directories matching a given pattern in a group and get some detailed information about them.
 
StringVectorPtr findResourceLocation (const String &groupName, const String &pattern) const
 Find all resource location names matching a given pattern in a resource group.
 
StringVectorPtr findResourceNames (const String &groupName, const String &pattern, bool dirs=false) const
 Find all file or directory names matching a given pattern in a resource group.
 
uint32 getCustomStagesForResourceGroup (const String &group)
 
ResourceLoadingListenergetLoadingListener () const
 Returns the current loading listener.
 
ResourceDeclarationList getResourceDeclarationList (const String &groupName) const
 Get the list of resource declarations for the specified group name.
 
StringVector getResourceGroups (void) const
 Get a list of the currently defined resource groups.
 
const LocationListgetResourceLocationList (const String &groupName) const
 Get the list of resource locations for the specified group name.
 
ResourceManagerIterator getResourceManagerIterator ()
 
const ResourceManagerMapgetResourceManagers () const
 Get the registered resource managers.
 
const StringgetWorldResourceGroupName (void) const
 Gets the resource group that 'world' resources will use.
 
void initialiseAllResourceGroups (void)
 Initialise all resource groups which are yet to be initialised.
 
void initialiseResourceGroup (const String &name)
 Initialises a resource group.
 
bool isResourceGroupInGlobalPool (const String &name) const
 Checks the status of a resource group.
 
bool isResourceGroupInitialised (const String &name) const
 Checks the status of a resource group.
 
bool isResourceGroupLoaded (const String &name) const
 Checks the status of a resource group.
 
FileInfoListPtr listResourceFileInfo (const String &groupName, bool dirs=false) const
 List all files in a resource group with accompanying information.
 
StringVectorPtr listResourceLocations (const String &groupName) const
 List all resource locations in a resource group.
 
StringVectorPtr listResourceNames (const String &groupName, bool dirs=false) const
 List all file or directory names in a resource group.
 
void loadResourceGroup (const String &name)
 Loads a resource group.
 
DataStreamPtr openResource (const String &resourceName, const String &groupName, bool searchGroupsIfNotFound, Resource *resourceBeingLoaded=0) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. if the resource is not found in the group specified, other groups will be searched.
 
DataStreamPtr openResource (const String &resourceName, const String &groupName=DEFAULT_RESOURCE_GROUP_NAME, Resource *resourceBeingLoaded=NULL, bool throwOnFailure=true) const
 Open a single resource by name and return a DataStream pointing at the source of the data.
 
DataStreamList openResources (const String &pattern, const String &groupName=DEFAULT_RESOURCE_GROUP_NAME) const
 Open all resources matching a given pattern (which can contain the character '*' as a wildcard), and return a collection of DataStream objects on them.
 
void prepareResourceGroup (const String &name)
 Prepares a resource group.
 
void removeResourceGroupListener (ResourceGroupListener *l)
 Removes a ResourceGroupListener.
 
void removeResourceLocation (const String &name, const String &resGroup=DEFAULT_RESOURCE_GROUP_NAME)
 Removes a resource location from the search path.
 
bool resourceExists (const String &group, const String &filename) const
 Find out if the named file exists in a group.
 
bool resourceExistsInAnyGroup (const String &filename) const
 Find out if the named file exists in any group.
 
bool resourceGroupExists (const String &name) const
 
bool resourceLocationExists (const String &name, const String &resGroup=DEFAULT_RESOURCE_GROUP_NAME) const
 Verify if a resource location exists for the given group.
 
time_t resourceModifiedTime (const String &group, const String &filename) const
 Retrieve the modification time of a given file.
 
void setCustomStagesForResourceGroup (const String &group, uint32 stageCount)
 Declare the number custom loading stages for a resource group.
 
void setLoadingListener (ResourceLoadingListener *listener)
 Sets a new loading listener.
 
void setWorldResourceGroupName (const String &groupName)
 Sets the resource group that 'world' resources will use.
 
void shutdownAll (void)
 Shutdown all ResourceManagers, performed as part of clean-up.
 
void undeclareResource (const String &name, const String &groupName)
 Undeclare a resource.
 
void unloadResourceGroup (const String &name, bool reloadableOnly=true)
 Unloads a resource group.
 
void unloadUnreferencedResourcesInGroup (const String &name, bool reloadableOnly=true)
 Unload all resources which are not referenced by any other object.
 
- Public Member Functions inherited from Ogre::Singleton< ResourceGroupManager >
 Singleton (void)
 
 ~Singleton (void)
 

Static Public Member Functions

static ResourceGroupManagergetSingleton (void)
 Get the singleton instance.
 
static ResourceGroupManagergetSingletonPtr (void)
 Get the singleton instance.
 
- Static Public Member Functions inherited from Ogre::Singleton< ResourceGroupManager >
static ResourceGroupManagergetSingleton (void)
 Get the singleton instance.
 
static ResourceGroupManagergetSingletonPtr (void)
 Get the singleton instance.
 

Static Public Attributes

static const String AUTODETECT_RESOURCE_GROUP_NAME
 same as RGN_AUTODETECT
 
static const String DEFAULT_RESOURCE_GROUP_NAME
 same as RGN_DEFAULT
 
static const String INTERNAL_RESOURCE_GROUP_NAME
 same as RGN_INTERNAL
 
static const long RESOURCE_SYSTEM_NUM_REFERENCE_COUNTS
 The number of reference counts held per resource by the resource system.
 

Detailed Description

This singleton class manages the list of resource groups, and notifying the various resource managers of their obligations to load / unload resources in a group.

It also provides facilities to monitor resource loading per group (to do progress bars etc), provided the resources that are required are pre-registered.

Defining new resource groups, and declaring the resources you intend to use in advance is optional, however it is a very useful feature. In addition, if a ResourceManager supports the definition of resources through scripts, then this is the class which drives the locating of the scripts and telling the ResourceManager to parse them.

See also
Resource Management

Member Typedef Documentation

◆ ResourceDeclarationList

◆ ResourceManagerMap

◆ ResourceManagerIterator

◆ LocationList

List of possible file locations.

Constructor & Destructor Documentation

◆ ResourceGroupManager()

Ogre::ResourceGroupManager::ResourceGroupManager ( )

◆ ~ResourceGroupManager()

virtual Ogre::ResourceGroupManager::~ResourceGroupManager ( )
virtual

Member Function Documentation

◆ createResourceGroup()

void Ogre::ResourceGroupManager::createResourceGroup ( const String name,
bool  inGlobalPool = !OGRE_RESOURCEMANAGER_STRICT 
)

Create a resource group.

Parameters
nameThe name to give the resource group.
inGlobalPoolif true the resource will be loaded even a different group was requested in the load method as a parameter.
See also
Resource Management

◆ initialiseResourceGroup()

void Ogre::ResourceGroupManager::initialiseResourceGroup ( const String name)

Initialises a resource group.

Note
When you call Root::initialise, all resource groups that have already been created are automatically initialised too. Therefore you do not need to call this method for groups you define and set up before you call Root::initialise. However, since one of the most useful features of resource groups is to set them up after the main system initialisation has occurred (e.g. a group per game level), you must remember to call this method for the groups you create after this.
Parameters
nameThe name of the resource group to initialise
See also
Resource Management

◆ initialiseAllResourceGroups()

void Ogre::ResourceGroupManager::initialiseAllResourceGroups ( void  )

Initialise all resource groups which are yet to be initialised.

See also
initialiseResourceGroup

◆ prepareResourceGroup()

void Ogre::ResourceGroupManager::prepareResourceGroup ( const String name)

Prepares a resource group.

Prepares any created resources which are part of the named group. Note that resources must have already been created by calling ResourceManager::createResource, or declared using declareResource() or in a script (such as .material and .overlay). The latter requires that initialiseResourceGroup() has been called.

When this method is called, this class will callback any ResourceGroupListener which have been registered to update them on progress.

Parameters
nameThe name of the resource group to prepare.

◆ loadResourceGroup()

void Ogre::ResourceGroupManager::loadResourceGroup ( const String name)

Loads a resource group.

Loads any created resources which are part of the named group. Note that resources must have already been created by calling ResourceManager::createResource, or declared using declareResource() or in a script (such as .material and .overlay). The latter requires that initialiseResourceGroup() has been called.

When this method is called, this class will callback any ResourceGroupListeners which have been registered to update them on progress.

Parameters
nameThe name of the resource group to load.

◆ unloadResourceGroup()

void Ogre::ResourceGroupManager::unloadResourceGroup ( const String name,
bool  reloadableOnly = true 
)

Unloads a resource group.

This method unloads all the resources that have been declared as being part of the named resource group. Note that these resources will still exist in their respective ResourceManager classes, but will be in an unloaded state. If you want to remove them entirely, you should use clearResourceGroup() or destroyResourceGroup().

Parameters
nameThe name to of the resource group to unload.
reloadableOnlyIf set to true, only unload the resource that is reloadable. Because some resources isn't reloadable, they will be unloaded but can't load them later. Thus, you might not want to them unloaded. Or, you might unload all of them, and then populate them manually later.
See also
Resource::isReloadable for resource is reloadable.

◆ unloadUnreferencedResourcesInGroup()

void Ogre::ResourceGroupManager::unloadUnreferencedResourcesInGroup ( const String name,
bool  reloadableOnly = true 
)

Unload all resources which are not referenced by any other object.

This method behaves like unloadResourceGroup(), except that it only unloads resources in the group which are not in use, ie not referenced by other objects. This allows you to free up some memory selectively whilst still keeping the group around (and the resources present, just not using much memory).

Parameters
nameThe name of the group to check for unreferenced resources
reloadableOnlyIf true (the default), only unloads resources which can be subsequently automatically reloaded

◆ clearResourceGroup()

void Ogre::ResourceGroupManager::clearResourceGroup ( const String name)

Clears a resource group.

This method unloads all resources in the group, but in addition it removes all those resources from their ResourceManagers, and then clears all the members from the list. That means after calling this method, there are no resources declared as part of the named group any more. Resource locations still persist though.

Parameters
nameThe name to of the resource group to clear.

◆ destroyResourceGroup()

void Ogre::ResourceGroupManager::destroyResourceGroup ( const String name)

Destroys a resource group, clearing it first, destroying the resources which are part of it, and then removing it from the list of resource groups.

Parameters
nameThe name of the resource group to destroy.

◆ isResourceGroupInitialised()

bool Ogre::ResourceGroupManager::isResourceGroupInitialised ( const String name) const

Checks the status of a resource group.

Looks at the state of a resource group. If initialiseResourceGroup has been called for the resource group return true, otherwise return false.

Parameters
nameThe name to of the resource group to access.

◆ isResourceGroupLoaded()

bool Ogre::ResourceGroupManager::isResourceGroupLoaded ( const String name) const

Checks the status of a resource group.

Looks at the state of a resource group. If loadResourceGroup has been called for the resource group return true, otherwise return false.

Parameters
nameThe name to of the resource group to access.

◆ resourceGroupExists()

bool Ogre::ResourceGroupManager::resourceGroupExists ( const String name) const

◆ addResourceLocation()

void Ogre::ResourceGroupManager::addResourceLocation ( const String name,
const String locType,
const String resGroup = DEFAULT_RESOURCE_GROUP_NAME,
bool  recursive = false,
bool  readOnly = true 
)

Adds a location to the list of searchable locations for a Resource type.

Parameters
nameThe name of the location, e.g. './data' or '/compressed/gamedata.zip'
locTypeA string identifying the location type, e.g. 'FileSystem' (for folders), 'Zip' etc. Must map to a registered plugin which deals with this type (FileSystem and Zip should always be available)
resGroupthe resource group which this location should apply to; defaults to the General group which applies to all non-specific resources.
recursiveIf the resource location has a concept of recursive directory traversal, enabling this option will mean you can load resources in subdirectories using their qualified name. The default is to ignore subdirectories which results in "flat" resource names.
readOnlywhether the Archive is read only
See also
Resource Management

◆ removeResourceLocation()

void Ogre::ResourceGroupManager::removeResourceLocation ( const String name,
const String resGroup = DEFAULT_RESOURCE_GROUP_NAME 
)

Removes a resource location from the search path.

◆ resourceLocationExists()

bool Ogre::ResourceGroupManager::resourceLocationExists ( const String name,
const String resGroup = DEFAULT_RESOURCE_GROUP_NAME 
) const

Verify if a resource location exists for the given group.

◆ declareResource() [1/2]

void Ogre::ResourceGroupManager::declareResource ( const String name,
const String resourceType,
const String groupName = DEFAULT_RESOURCE_GROUP_NAME,
const NameValuePairList loadParameters = NameValuePairList() 
)

Declares a resource to be a part of a resource group, allowing you to load and unload it as part of the group.

Parameters
nameThe resource name.
resourceTypeThe type of the resource. Ogre comes preconfigured with a number of resource types: .. but more can be added by plugin ResourceManager classes.
groupNameThe name of the group to which it will belong.
loadParametersA list of name / value pairs which supply custom parameters to the resource which will be required before it can be loaded. These are specific to the resource type.
See also
Resource Management

◆ declareResource() [2/2]

void Ogre::ResourceGroupManager::declareResource ( const String name,
const String resourceType,
const String groupName,
ManualResourceLoader loader,
const NameValuePairList loadParameters = NameValuePairList() 
)

Declares a resource to be a part of a resource group, allowing you to load and unload it as part of the group.

Parameters
nameThe resource name.
resourceTypeThe type of the resource. Ogre comes preconfigured with a number of resource types: .. but more can be added by plugin ResourceManager classes.
groupNameThe name of the group to which it will belong.
loadParametersA list of name / value pairs which supply custom parameters to the resource which will be required before it can be loaded. These are specific to the resource type.
See also
Resource Management
Parameters
loaderPointer to a ManualResourceLoader implementation which will be called when the Resource wishes to load. If supplied, the resource is manually loaded, otherwise it'll loading from file automatic.
Note
We don't support declare manually loaded resource without loader here, since it's meaningless.

◆ undeclareResource()

void Ogre::ResourceGroupManager::undeclareResource ( const String name,
const String groupName 
)

Undeclare a resource.

Note that this will not cause it to be unloaded if it is already loaded, nor will it destroy a resource which has already been created if initialiseResourceGroup has been called already. Only unloadResourceGroup / clearResourceGroup / destroyResourceGroup will do that.

Parameters
nameThe name of the resource.
groupNameThe name of the group this resource was declared in.

◆ openResource() [1/2]

DataStreamPtr Ogre::ResourceGroupManager::openResource ( const String resourceName,
const String groupName = DEFAULT_RESOURCE_GROUP_NAME,
Resource resourceBeingLoaded = NULL,
bool  throwOnFailure = true 
) const
inline

Open a single resource by name and return a DataStream pointing at the source of the data.

Parameters
resourceNameThe name of the resource to locate. Even if resource locations are added recursively, you must provide a fully qualified name to this method. You can find out the matching fully qualified names by using the find() method if you need to.
groupNameThe name of the resource group; this determines which locations are searched. If you're loading a Resource using RGN_AUTODETECT, you must also provide the resourceBeingLoaded parameter to enable the group membership to be changed
resourceBeingLoadedOptional pointer to the resource being loaded, which you should supply if you want
throwOnFailurethrow an exception. Returns nullptr otherwise
Returns
Shared pointer to data stream containing the data, will be destroyed automatically when no longer referenced

◆ openResource() [2/2]

DataStreamPtr Ogre::ResourceGroupManager::openResource ( const String resourceName,
const String groupName,
bool  searchGroupsIfNotFound,
Resource resourceBeingLoaded = 0 
) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. if the resource is not found in the group specified, other groups will be searched.

Deprecated:
use AUTODETECT_RESOURCE_GROUP_NAME instead of searchGroupsIfNotFound

◆ openResources()

DataStreamList Ogre::ResourceGroupManager::openResources ( const String pattern,
const String groupName = DEFAULT_RESOURCE_GROUP_NAME 
) const

Open all resources matching a given pattern (which can contain the character '*' as a wildcard), and return a collection of DataStream objects on them.

Parameters
patternThe pattern to look for. If resource locations have been added recursively, subdirectories will be searched too so this does not need to be fully qualified.
groupNameThe resource group; this determines which locations are searched.
Returns
Shared pointer to a data stream list , will be destroyed automatically when no longer referenced

◆ listResourceNames()

StringVectorPtr Ogre::ResourceGroupManager::listResourceNames ( const String groupName,
bool  dirs = false 
) const

List all file or directory names in a resource group.

Note
This method only returns filenames, you can also retrieve other information using listFileInfo.
Parameters
groupNameThe name of the group
dirsIf true, directory names will be returned instead of file names
Returns
A list of filenames matching the criteria, all are fully qualified

◆ listResourceFileInfo()

FileInfoListPtr Ogre::ResourceGroupManager::listResourceFileInfo ( const String groupName,
bool  dirs = false 
) const

List all files in a resource group with accompanying information.

Parameters
groupNameThe name of the group
dirsIf true, directory names will be returned instead of file names
Returns
A list of structures detailing quite a lot of information about all the files in the archive.

◆ findResourceNames()

StringVectorPtr Ogre::ResourceGroupManager::findResourceNames ( const String groupName,
const String pattern,
bool  dirs = false 
) const

Find all file or directory names matching a given pattern in a resource group.

Note
This method only returns filenames, you can also retrieve other information using findFileInfo.
Parameters
groupNameThe name of the group
patternThe pattern to search for; wildcards (*) are allowed
dirsSet to true if you want the directories to be listed instead of files
Returns
A list of filenames matching the criteria, all are fully qualified

◆ resourceExists()

bool Ogre::ResourceGroupManager::resourceExists ( const String group,
const String filename 
) const

Find out if the named file exists in a group.

Parameters
groupThe name of the resource group
filenameFully qualified name of the file to test for

◆ resourceExistsInAnyGroup()

bool Ogre::ResourceGroupManager::resourceExistsInAnyGroup ( const String filename) const

Find out if the named file exists in any group.

Parameters
filenameFully qualified name of the file to test for

◆ findGroupContainingResource()

const String & Ogre::ResourceGroupManager::findGroupContainingResource ( const String filename) const

Find the group in which a resource exists.

Parameters
filenameFully qualified name of the file the resource should be found as
Returns
Name of the resource group the resource was found in. An exception is thrown if the group could not be determined.

◆ findResourceFileInfo()

FileInfoListPtr Ogre::ResourceGroupManager::findResourceFileInfo ( const String group,
const String pattern,
bool  dirs = false 
) const

Find all files or directories matching a given pattern in a group and get some detailed information about them.

Parameters
groupThe name of the resource group
patternThe pattern to search for; wildcards (*) are allowed
dirsSet to true if you want the directories to be listed instead of files
Returns
A list of file information structures for all files matching the criteria.

◆ resourceModifiedTime()

time_t Ogre::ResourceGroupManager::resourceModifiedTime ( const String group,
const String filename 
) const

Retrieve the modification time of a given file.

◆ listResourceLocations()

StringVectorPtr Ogre::ResourceGroupManager::listResourceLocations ( const String groupName) const

List all resource locations in a resource group.

Parameters
groupNameThe name of the group
Returns
A list of resource locations matching the criteria

◆ findResourceLocation()

StringVectorPtr Ogre::ResourceGroupManager::findResourceLocation ( const String groupName,
const String pattern 
) const

Find all resource location names matching a given pattern in a resource group.

Parameters
groupNameThe name of the group
patternThe pattern to search for; wildcards (*) are allowed
Returns
A list of resource locations matching the criteria

◆ createResource()

DataStreamPtr Ogre::ResourceGroupManager::createResource ( const String filename,
const String groupName = DEFAULT_RESOURCE_GROUP_NAME,
bool  overwrite = false,
const String locationPattern = BLANKSTRING 
)

Create a new resource file in a given group.

This method creates a new file in a resource group and passes you back a writeable stream.

Parameters
filenameThe name of the file to create
groupNameThe name of the group in which to create the file
overwriteIf true, an existing file will be overwritten, if false an error will occur if the file already exists
locationPatternIf the resource group contains multiple locations, then usually the file will be created in the first writable location. If you want to be more specific, you can include a location pattern here and only locations which match that pattern (as determined by StringUtil::match) will be considered candidates for creation.

◆ deleteResource()

void Ogre::ResourceGroupManager::deleteResource ( const String filename,
const String groupName = DEFAULT_RESOURCE_GROUP_NAME,
const String locationPattern = BLANKSTRING 
)

Delete a single resource file.

Parameters
filenameThe name of the file to delete.
groupNameThe name of the group in which to search
locationPatternIf the resource group contains multiple locations, then usually first matching file found in any location will be deleted. If you want to be more specific, you can include a location pattern here and only locations which match that pattern (as determined by StringUtil::match) will be considered candidates for deletion.

◆ deleteMatchingResources()

void Ogre::ResourceGroupManager::deleteMatchingResources ( const String filePattern,
const String groupName = DEFAULT_RESOURCE_GROUP_NAME,
const String locationPattern = BLANKSTRING 
)

Delete all matching resource files.

Parameters
filePatternThe pattern (see StringUtil::match) of the files to delete.
groupNameThe name of the group in which to search
locationPatternIf the resource group contains multiple locations, then usually all matching files in any location will be deleted. If you want to be more specific, you can include a location pattern here and only locations which match that pattern (as determined by StringUtil::match) will be considered candidates for deletion.

◆ addResourceGroupListener()

void Ogre::ResourceGroupManager::addResourceGroupListener ( ResourceGroupListener l)

Adds a ResourceGroupListener which will be called back during resource loading events.

◆ removeResourceGroupListener()

void Ogre::ResourceGroupManager::removeResourceGroupListener ( ResourceGroupListener l)

◆ setWorldResourceGroupName()

void Ogre::ResourceGroupManager::setWorldResourceGroupName ( const String groupName)
inline

Sets the resource group that 'world' resources will use.

This is the group which should be used by SceneManagers implementing world geometry when looking for their resources. Defaults to the DEFAULT_RESOURCE_GROUP_NAME but this can be altered.

◆ getWorldResourceGroupName()

const String & Ogre::ResourceGroupManager::getWorldResourceGroupName ( void  ) const
inline

Gets the resource group that 'world' resources will use.

◆ setCustomStagesForResourceGroup()

void Ogre::ResourceGroupManager::setCustomStagesForResourceGroup ( const String group,
uint32  stageCount 
)

Declare the number custom loading stages for a resource group.

This allows you to include them in a loading progress report.

Parameters
groupThe name of the resource group
stageCountThe number of extra stages
See also
addResourceGroupListener
_notifyCustomStageStarted
_notifyCustomStageEnded

◆ getCustomStagesForResourceGroup()

uint32 Ogre::ResourceGroupManager::getCustomStagesForResourceGroup ( const String group)

◆ isResourceGroupInGlobalPool()

bool Ogre::ResourceGroupManager::isResourceGroupInGlobalPool ( const String name) const

Checks the status of a resource group.

Looks at the state of a resource group. If loadResourceGroup has been called for the resource group return true, otherwise return false.

Parameters
nameThe name to of the resource group to access.

◆ shutdownAll()

void Ogre::ResourceGroupManager::shutdownAll ( void  )

Shutdown all ResourceManagers, performed as part of clean-up.

◆ _registerResourceManager()

void Ogre::ResourceGroupManager::_registerResourceManager ( const String resourceType,
ResourceManager rm 
)

Internal method for registering a ResourceManager (which should be a singleton).

Creators of plugins can register new ResourceManagers this way if they wish.

ResourceManagers that wish to parse scripts must also call _registerScriptLoader.

Parameters
resourceTypeString identifying the resource type, must be unique.
rmPointer to the ResourceManager instance.

◆ _unregisterResourceManager()

void Ogre::ResourceGroupManager::_unregisterResourceManager ( const String resourceType)

Internal method for unregistering a ResourceManager.

ResourceManagers that wish to parse scripts must also call _unregisterScriptLoader.

Parameters
resourceTypeString identifying the resource type.

◆ getResourceManagers()

const ResourceManagerMap & Ogre::ResourceGroupManager::getResourceManagers ( ) const
inline

Get the registered resource managers.

◆ getResourceManagerIterator()

ResourceManagerIterator Ogre::ResourceGroupManager::getResourceManagerIterator ( )
inline

◆ _registerScriptLoader()

void Ogre::ResourceGroupManager::_registerScriptLoader ( ScriptLoader su)

Internal method for registering a ScriptLoader.

Remarks
ScriptLoaders parse scripts when resource groups are initialised.
Parameters
suPointer to the ScriptLoader instance.

◆ _unregisterScriptLoader()

void Ogre::ResourceGroupManager::_unregisterScriptLoader ( ScriptLoader su)

Internal method for unregistering a ScriptLoader.

Parameters
suPointer to the ScriptLoader instance.

◆ _findScriptLoader()

ScriptLoader * Ogre::ResourceGroupManager::_findScriptLoader ( const String pattern) const

Method used to directly query for registered script loaders.

Parameters
patternThe specific script pattern (e.g. *.material) the script loader handles

◆ _getResourceManager()

ResourceManager * Ogre::ResourceGroupManager::_getResourceManager ( const String resourceType) const

Internal method for getting a registered ResourceManager.

Parameters
resourceTypeString identifying the resource type.

◆ _notifyResourceCreated()

void Ogre::ResourceGroupManager::_notifyResourceCreated ( ResourcePtr res) const

Internal method called by ResourceManager when a resource is created.

Parameters
resWeak reference to resource

◆ _notifyResourceRemoved()

void Ogre::ResourceGroupManager::_notifyResourceRemoved ( const ResourcePtr res) const

Internal method called by ResourceManager when a resource is removed.

Parameters
resWeak reference to resource

◆ _notifyResourceGroupChanged()

void Ogre::ResourceGroupManager::_notifyResourceGroupChanged ( const String oldGroup,
Resource res 
) const

Internal method to notify the group manager that a resource has changed group (only applicable for autodetect group)

◆ _notifyAllResourcesRemoved()

void Ogre::ResourceGroupManager::_notifyAllResourcesRemoved ( ResourceManager manager) const

Internal method called by ResourceManager when all resources for that manager are removed.

Parameters
managerPointer to the manager for which all resources are being removed

◆ _notifyCustomStageStarted()

void Ogre::ResourceGroupManager::_notifyCustomStageStarted ( const String description) const

Notify this manager that one custom loading stage has been started.

User code should call this method the number of times equal to the value declared in setCustomStagesForResourceGroup.

◆ _notifyCustomStageEnded()

void Ogre::ResourceGroupManager::_notifyCustomStageEnded ( void  ) const

Notify this manager that one custom loading stage has been completed.

User code should call this method the number of times equal to the value declared setCustomStagesForResourceGroup.

◆ getResourceGroups()

StringVector Ogre::ResourceGroupManager::getResourceGroups ( void  ) const

Get a list of the currently defined resource groups.

Note
This method intentionally returns a copy rather than a reference in order to avoid any contention issues in multithreaded applications.
Returns
A copy of list of currently defined groups.

◆ getResourceDeclarationList()

ResourceDeclarationList Ogre::ResourceGroupManager::getResourceDeclarationList ( const String groupName) const

Get the list of resource declarations for the specified group name.

Note
This method intentionally returns a copy rather than a reference in order to avoid any contention issues in multithreaded applications.
Parameters
groupNameThe name of the group
Returns
A copy of list of currently defined resources.

◆ getResourceLocationList()

const LocationList & Ogre::ResourceGroupManager::getResourceLocationList ( const String groupName) const

Get the list of resource locations for the specified group name.

Parameters
groupNameThe name of the group
Returns
The list of resource locations associated with the given group.

◆ setLoadingListener()

void Ogre::ResourceGroupManager::setLoadingListener ( ResourceLoadingListener listener)

Sets a new loading listener.

◆ getLoadingListener()

ResourceLoadingListener * Ogre::ResourceGroupManager::getLoadingListener ( ) const

Returns the current loading listener.

◆ getSingleton()

static ResourceGroupManager & Ogre::ResourceGroupManager::getSingleton ( void  )
static

Get the singleton instance.

◆ getSingletonPtr()

static ResourceGroupManager * Ogre::ResourceGroupManager::getSingletonPtr ( void  )
static

Get the singleton instance.

Member Data Documentation

◆ DEFAULT_RESOURCE_GROUP_NAME

const String Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME
static

same as RGN_DEFAULT

◆ INTERNAL_RESOURCE_GROUP_NAME

const String Ogre::ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME
static

same as RGN_INTERNAL

◆ AUTODETECT_RESOURCE_GROUP_NAME

const String Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME
static

same as RGN_AUTODETECT

◆ RESOURCE_SYSTEM_NUM_REFERENCE_COUNTS

const long Ogre::ResourceGroupManager::RESOURCE_SYSTEM_NUM_REFERENCE_COUNTS
static

The number of reference counts held per resource by the resource system.


The documentation for this class was generated from the following file: