sftools  2.0 dev
Bunch of tools for SFML application development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Public Types | Public Member Functions | List of all members
sftools::Locations Class Reference

Minimalist locations manager. More...

#include <Locations.hpp>

+ Collaboration diagram for sftools::Locations:

Public Types

typedef Storage::const_iterator ConstIterator
 Constant iterator type.
 

Public Member Functions

void add (std::string const &path)
 Add a path to the locations.
 
void remove (std::string const &path)
 Remove a location.
 
void clear ()
 Remove all locations.
 
ConstIterator begin () const
 Return an iterator on the first location.
 
ConstIterator end () const
 Return an iterator to the element following the last location.
 

Detailed Description

Minimalist locations manager.

Basically it's a collection of paths. ResourceLocations makes something useful from it.

Note
When use add() to, well, add a location be careful and check if the path ends with / or not. Here is the difference :
  • If $path ends with a slash then ResourceLoader will look into the folder named $path;
  • Otherwise it will look for files with a prefix of "$path" (e.g. if $path is "high_definition_" implies that load("foo") will load "hight_definition_foo" files).
Todo:
It could be interesting to have a Path class and be able to do something like Locations loc; loc.add({"res"}.add({"img"}, {"snd"}), {"extra"}).
See Also
ResourceLocations
ResourceLoader

Definition at line 68 of file Locations.hpp.

Member Typedef Documentation

typedef Storage::const_iterator sftools::Locations::ConstIterator

Constant iterator type.

Definition at line 75 of file Locations.hpp.

Member Function Documentation

void sftools::Locations::add ( std::string const &  path)
inline

Add a path to the locations.

Parameters
pathlocation to be added

Definition at line 82 of file Locations.hpp.

ConstIterator sftools::Locations::begin ( ) const
inline

Return an iterator on the first location.

If no location was added yet this method return the same iterator as end.

Returns
constant iterator on the first location

Definition at line 122 of file Locations.hpp.

Referenced by sftools::loader::ResourceLoader< R >::operator()().

void sftools::Locations::clear ( )
inline

Remove all locations.

Note
This method invalids any iterator.

Definition at line 110 of file Locations.hpp.

ConstIterator sftools::Locations::end ( ) const
inline

Return an iterator to the element following the last location.

Returns
constant iterator to the element following the last location

Definition at line 132 of file Locations.hpp.

Referenced by sftools::loader::ResourceLoader< R >::operator()().

void sftools::Locations::remove ( std::string const &  path)
inline

Remove a location.

If path was not previously added nothing is done.

Note
This method invalids any iterator.
Parameters
pathlocation to be removed

Definition at line 96 of file Locations.hpp.


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