sftools  2.0 dev
Bunch of tools for SFML application development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | List of all members
sftools::loader::LoadFromFile< R > Struct Template Reference

Specialisation of ResourceLoader for loadFromFile()-resources. More...

#include <Loaders.hpp>

+ Collaboration diagram for sftools::loader::LoadFromFile< R >:

Public Member Functions

bool load (R &res, std::string src)
 Load the content of a resource with the given file.
 
R * operator() (std::string const &id)
 Load operator.
 

Detailed Description

template<typename R>
struct sftools::loader::LoadFromFile< R >

Specialisation of ResourceLoader for loadFromFile()-resources.

Template Parameters
RResource type

Definition at line 123 of file Loaders.hpp.

Member Function Documentation

template<typename R >
bool sftools::loader::LoadFromFile< R >::load ( R &  res,
std::string  src 
)
inlinevirtual

Load the content of a resource with the given file.

Note
subclasses must implement this function in order to customize ResourceLoader.
Parameters
resResource to be feed with a new content
srcFile containing the new content to be loaded
Returns
true if loading the resource succeed; false otherwise

Implements sftools::loader::ResourceLoader< R >.

Definition at line 125 of file Loaders.hpp.

template<typename R >
R* sftools::loader::ResourceLoader< R >::operator() ( std::string const &  id)
inlineinherited

Load operator.

It create a resource and use load() to initialize its content.

Parameters
idResource id to load
Returns
a pointer to a valid R object if load() succeed or 0 if it failed

Definition at line 80 of file Loaders.hpp.

References sftools::Locations::begin(), sftools::Locations::end(), sftools::Singleton< T, F >::getInstance(), and sftools::loader::ResourceLoader< R >::load().


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