Ocular Engine
Ocular::Core::ResourceLoaderManager Class Reference

Public Member Functions

void registerResourceLoader (std::shared_ptr< AResourceLoader > loader)
 
bool loadResource (Resource *&resource, File const &file, std::string const &mappingName)
 
bool loadSubResource (Resource *&resource, File const &file, std::string const &mappingName)
 
bool exploreResource (File const &file)
 
unsigned getNumberOfResourceLoaders () const
 
bool isExtensionSupported (std::string const &extension) const
 
ResourceType getResourceType (std::string const &extension) const
 

Member Function Documentation

bool Ocular::Core::ResourceLoaderManager::exploreResource ( File const &  file)

Explores the resource in the specified file.

Parameters
[in]file
Returns
TRUE if the resource was successfully explored.
unsigned Ocular::Core::ResourceLoaderManager::getNumberOfResourceLoaders ( ) const
Returns
The total number of registered ResourceLoaders
ResourceType Ocular::Core::ResourceLoaderManager::getResourceType ( std::string const &  extension) const
Returns
The type of resource stored in the specified extension (if any).
bool Ocular::Core::ResourceLoaderManager::isExtensionSupported ( std::string const &  extension) const
Returns
TRUE if the specified extension has an associated ResourceLoader.
bool Ocular::Core::ResourceLoaderManager::loadResource ( Resource *&  resource,
File const &  file,
std::string const &  mappingName 
)

Loads the contents of the specified resource file into the provided Resource if a ResourceLoader is registered to the manager that supports the file extension.

If the resource is NULL, then a new appropriate resource is allocated.

Parameters
[out]resourceResource object to load the file contents into
[in]fileA valid resource file.
Returns
TRUE if the resource was successfully loaded.
bool Ocular::Core::ResourceLoaderManager::loadSubResource ( Resource *&  resource,
File const &  file,
std::string const &  mappingName 
)

Loads the subresource contained within a MultiResource at the specified file.

Parameters
[out]resourceThe Resource object of the subresource to load
[in]fileA valid resource file
[in]mappingNameThe mapping name of the individual subresource requested
void Ocular::Core::ResourceLoaderManager::registerResourceLoader ( std::shared_ptr< AResourceLoader loader)

Registers a new resource loader with the manager. Note that this method should generally never be directly called, instead a ReasourceLoaderRegistrar should be used instead.

If the manager already has a ResourceLoader registered with the supported extension, then the specified loader will not be used.

Parameters
loaderThe ResourceLoader to register with the manager.

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