The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
image::locator Class Reference

#include <image.hpp>

Classes

struct  value
 

Public Types

enum  type { NONE, FILE, SUB_FILE }
 
typedef boost::unordered_map
< value, int
locator_finder_t
 

Public Member Functions

 locator ()
 
 locator (const locator &a, const std::string &mods="")
 
 locator (const char *filename)
 
 locator (const std::string &filename)
 
 locator (const std::string &filename, const std::string &modifications)
 
 locator (const std::string &filename, const map_location &loc, int center_x, int center_y, const std::string &modifications="")
 
locatoroperator= (const locator &a)
 
bool operator== (const locator &a) const
 
bool operator!= (const locator &a) const
 
bool operator< (const locator &a) const
 
const std::stringget_filename () const
 
const map_locationget_loc () const
 
int get_center_x () const
 
int get_center_y () const
 
const std::stringget_modifications () const
 
type get_type () const
 
bool is_void () const
 
bool file_exists () const
 Tests whether the file the locater points at exists. More...
 
template<typename T >
bool in_cache (cache_type< T > &cache) const
 
template<typename T >
T & access_in_cache (cache_type< T > &cache) const
 
template<typename T >
const T & locate_in_cache (cache_type< T > &cache) const
 
template<typename T >
void add_to_cache (cache_type< T > &cache, const T &data) const
 

Private Member Functions

void init_index ()
 
void parse_arguments ()
 

Private Attributes

int index_
 
value val_
 

Friends

size_t hash_value (const value &)
 

Detailed Description

Definition at line 35 of file image.hpp.

Member Typedef Documentation

typedef boost::unordered_map<value, int> image::locator::locator_finder_t

Definition at line 67 of file image.hpp.

Member Enumeration Documentation

enum image::locator::type
Enumerator
NONE 
FILE 
SUB_FILE 

Definition at line 38 of file image.hpp.

Constructor & Destructor Documentation

image::locator::locator ( )

Definition at line 247 of file image.cpp.

image::locator::locator ( const locator a,
const std::string mods = "" 
)
image::locator::locator ( const char *  filename)

Definition at line 265 of file image.cpp.

References init_index(), and parse_arguments().

image::locator::locator ( const std::string filename)

Definition at line 273 of file image.cpp.

References init_index(), and parse_arguments().

image::locator::locator ( const std::string filename,
const std::string modifications 
)

Definition at line 281 of file image.cpp.

References init_index().

image::locator::locator ( const std::string filename,
const map_location loc,
int  center_x,
int  center_y,
const std::string modifications = "" 
)

Definition at line 288 of file image.cpp.

References init_index().

Member Function Documentation

template<typename T >
T & image::locator::access_in_cache ( cache_type< T > &  cache) const

Definition at line 110 of file image.cpp.

References image::cache_type< T >::get_element(), and index_.

Referenced by image::get_lighted_image().

template<typename T >
void image::locator::add_to_cache ( cache_type< T > &  cache,
const T &  data 
) const
bool image::locator::file_exists ( ) const

Tests whether the file the locater points at exists.

is_void doesn't seem to work before the image is loaded and also in debug mode a placeholder is returned. So it's not possible to test for the existence of a file. So this function does that. (Note it tests for existence not whether or not it's a valid image.)

Returns
Whether or not the file exists.

Definition at line 628 of file image.cpp.

References image::locator::value::filename_, filesystem::get_binary_file_location(), and val_.

Referenced by adjust_profile(), intf_get_image_size(), and arrow::update_symbols().

int image::locator::get_center_x ( ) const
inline
int image::locator::get_center_y ( ) const
inline
const std::string& image::locator::get_filename ( ) const
inline
const map_location& image::locator::get_loc ( ) const
inline
const std::string& image::locator::get_modifications ( ) const
inline

Definition at line 90 of file image.hpp.

References image::locator::value::modifications_, and val_.

Referenced by unit_animation::add_anims(), and image::load_image_sub_file().

type image::locator::get_type ( ) const
inline

Definition at line 91 of file image.hpp.

References image::locator::value::type_, and val_.

Referenced by image::exists(), and image::load_from_disk().

template<typename T >
bool image::locator::in_cache ( cache_type< T > &  cache) const
void image::locator::init_index ( )
private

Definition at line 220 of file image.cpp.

References i, index_, and val_.

Referenced by locator().

bool image::locator::is_void ( ) const
inline
template<typename T >
const T & image::locator::locate_in_cache ( cache_type< T > &  cache) const
bool image::locator::operator!= ( const locator a) const
inline

Definition at line 83 of file image.hpp.

References index_.

bool image::locator::operator< ( const locator a) const
inline

Definition at line 84 of file image.hpp.

References index_.

locator & image::locator::operator= ( const locator a)

Definition at line 296 of file image.cpp.

References index_, and val_.

bool image::locator::operator== ( const locator a) const
inline

Definition at line 82 of file image.hpp.

References index_.

void image::locator::parse_arguments ( )
private

Friends And Related Function Documentation

size_t hash_value ( const value )
friend

Definition at line 374 of file image.cpp.

Referenced by image::hash_value().

Member Data Documentation

int image::locator::index_
private
value image::locator::val_
private

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