Generic locator abstracting the location of an image. More...
#include <picture.hpp>
Public Types | |
enum | type { NONE , FILE , SUB_FILE } |
Public Member Functions | |
locator ()=default | |
locator (locator &&) noexcept=default | |
locator (const locator &)=default | |
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="") | |
locator & | operator= (const locator &a)=default |
locator & | operator= (locator &&)=default |
locator | clone (const std::string &mods) const |
Returns a copy of this locator with the given IPF. More... | |
bool | operator== (const locator &a) const |
bool | operator!= (const locator &a) const |
bool | operator< (const locator &a) const |
const std::string & | get_filename () const |
bool | is_data_uri () const |
const map_location & | get_loc () const |
int | get_center_x () const |
int | get_center_y () const |
const std::string & | get_modifications () const |
type | get_type () const |
bool | is_void () const |
Returns true if the locator does not correspond to an actual image. More... | |
Private Attributes | |
locator::type | type_ = NONE |
bool | is_data_uri_ = false |
std::string | filename_ {} |
std::string | modifications_ {} |
map_location | loc_ {} |
int | center_x_ = 0 |
int | center_y_ = 0 |
Friends | |
struct | std::hash< locator > |
Generic locator abstracting the location of an image.
Constructing locators is somewhat slow, while accessing images through locators is fast. The general idea is that callers should store locators and not strings to construct new ones. (The latter will still work, of course, even if it is slower.)
Definition at line 58 of file picture.hpp.
enum image::locator::type |
Enumerator | |
---|---|
NONE | |
FILE | |
SUB_FILE |
Definition at line 61 of file picture.hpp.
|
default |
|
defaultnoexcept |
|
default |
image::locator::locator | ( | const std::string & | filename | ) |
Definition at line 241 of file picture.cpp.
References ERR_IMG, FILE, filename_, is_data_uri_, modifications_, SUB_FILE, and type_.
image::locator::locator | ( | const std::string & | filename, |
const std::string & | modifications | ||
) |
Definition at line 267 of file picture.cpp.
image::locator::locator | ( | const std::string & | filename, |
const map_location & | loc, | ||
int | center_x, | ||
int | center_y, | ||
const std::string & | modifications = "" |
||
) |
Definition at line 274 of file picture.cpp.
locator image::locator::clone | ( | const std::string & | mods | ) | const |
Returns a copy of this locator with the given IPF.
Definition at line 218 of file picture.cpp.
References modifications_, SUB_FILE, and type_.
Referenced by unit_frame::get_overlaped_hex(), and unit_frame::redraw().
|
inline |
Definition at line 85 of file picture.hpp.
References center_x_.
Referenced by image::load_image_sub_file().
|
inline |
Definition at line 86 of file picture.hpp.
References center_y_.
Referenced by image::load_image_sub_file().
|
inline |
Definition at line 82 of file picture.hpp.
References filename_.
Referenced by unit_animation::add_anims(), image::exists(), image::get_hexed(), unit_frame::get_overlaped_hex(), image::load_image_data_uri(), image::load_image_file(), image::load_image_sub_file(), unit_frame::merge_parameters(), image::operator<<(), and unit_frame::redraw().
|
inline |
Definition at line 84 of file picture.hpp.
References loc_.
Referenced by image::load_image_sub_file(), and image::simplify_type().
|
inline |
Definition at line 87 of file picture.hpp.
References modifications_.
Referenced by unit_animation::add_anims(), image::get_texture(), image::load_image_sub_file(), and image::operator<<().
|
inline |
|
inline |
Definition at line 83 of file picture.hpp.
References is_data_uri_.
Referenced by image::exists(), and image::load_from_disk().
|
inline |
Returns true if the locator does not correspond to an actual image.
Definition at line 93 of file picture.hpp.
Referenced by image::exists(), image::get_lighted_image(), image::get_lighted_texture(), unit_frame::get_overlaped_hex(), image::get_surface(), image::get_texture(), unit_frame::merge_parameters(), and unit_frame::redraw().
|
inline |
Definition at line 78 of file picture.hpp.
References operator==().
bool image::locator::operator< | ( | const locator & | a | ) | const |
Definition at line 303 of file picture.cpp.
References center_x_, center_y_, FILE, filename_, loc_, modifications_, SUB_FILE, and type_.
bool image::locator::operator== | ( | const locator & | a | ) | const |
Definition at line 289 of file picture.cpp.
References center_x_, center_y_, FILE, filename_, loc_, modifications_, SUB_FILE, and type_.
Referenced by operator!=().
|
friend |
Definition at line 102 of file picture.hpp.
|
private |
Definition at line 101 of file picture.hpp.
Referenced by get_center_x(), std::hash< image::locator >::operator()(), operator<(), and operator==().
|
private |
Definition at line 102 of file picture.hpp.
Referenced by get_center_y(), std::hash< image::locator >::operator()(), operator<(), and operator==().
|
private |
Definition at line 98 of file picture.hpp.
Referenced by get_filename(), locator(), std::hash< image::locator >::operator()(), operator<(), and operator==().
|
private |
Definition at line 97 of file picture.hpp.
Referenced by is_data_uri(), and locator().
|
private |
Definition at line 100 of file picture.hpp.
Referenced by get_loc(), std::hash< image::locator >::operator()(), operator<(), and operator==().
|
private |
Definition at line 99 of file picture.hpp.
Referenced by clone(), get_modifications(), locator(), std::hash< image::locator >::operator()(), operator<(), and operator==().
|
private |
Definition at line 96 of file picture.hpp.
Referenced by clone(), get_type(), is_void(), locator(), std::hash< image::locator >::operator()(), operator<(), and operator==().