The Battle for Wesnoth  1.15.2+dev
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
map_labels Class Reference

#include <label.hpp>

Public Types

typedef std::map< map_location, terrain_labellabel_map
 
typedef std::map< std::string, label_mapteam_label_map
 

Public Member Functions

 map_labels (const map_labels &)
 
 map_labels (const team *)
 
 ~map_labels ()
 
map_labelsoperator= (const map_labels &)
 
void write (config &res) const
 
void read (const config &cfg)
 
const terrain_labelget_label (const map_location &loc, const std::string &team_name) const
 
const terrain_labelget_label (const map_location &loc) const
 
const terrain_labelset_label (const map_location &loc, const t_string &text, const int creator=-1, const std::string &team="", const color_t color=font::NORMAL_COLOR, const bool visible_in_fog=true, const bool visible_in_shroud=false, const bool immutable=false, const std::string &category="", const t_string &tooltip="")
 
bool enabled () const
 
void enable (bool is_enabled)
 
void clear (const std::string &, bool force)
 
void recalculate_labels ()
 
void recalculate_shroud ()
 
bool visible_global_label (const map_location &) const
 Returns whether or not a global (non-team) label can be shown at a specified location. More...
 
const std::string & team_name () const
 
const std::vector< std::string > & all_categories () const
 
void set_team (const team *)
 
void clear_all ()
 

Private Member Functions

template<typename... T>
terrain_labeladd_label (T &&... args)
 
void clear_map (label_map &, bool)
 
terrain_labelget_label_private (const map_location &loc, const std::string &team_name)
 

Private Attributes

const teamteam_
 
team_label_map labels_
 
bool enabled_
 
std::vector< std::string > categories
 
bool categories_dirty
 

Detailed Description

Definition at line 31 of file label.hpp.

Member Typedef Documentation

◆ label_map

Definition at line 34 of file label.hpp.

◆ team_label_map

typedef std::map<std::string, label_map> map_labels::team_label_map

Definition at line 35 of file label.hpp.

Constructor & Destructor Documentation

◆ map_labels() [1/2]

map_labels::map_labels ( const map_labels other)

Definition at line 54 of file label.cpp.

References read(), and write().

Referenced by operator=().

◆ map_labels() [2/2]

map_labels::map_labels ( const team team)

Definition at line 46 of file label.cpp.

◆ ~map_labels()

map_labels::~map_labels ( )

Definition at line 64 of file label.cpp.

References clear_all().

Referenced by operator=().

Member Function Documentation

◆ add_label()

template<typename... T>
terrain_label * map_labels::add_label ( T &&...  args)
private

Definition at line 202 of file label.cpp.

References categories_dirty, labels_, terrain_label::location(), t, and terrain_label::team_name().

Referenced by enabled(), read(), and set_label().

◆ all_categories()

const std::vector< std::string > & map_labels::all_categories ( ) const

◆ clear()

void map_labels::clear ( const std::string &  team_name,
bool  force 
)

◆ clear_all()

void map_labels::clear_all ( )

◆ clear_map()

void map_labels::clear_map ( label_map m,
bool  force 
)
private

Definition at line 225 of file label.cpp.

References categories_dirty, and i.

Referenced by clear(), and enabled().

◆ enable()

void map_labels::enable ( bool  is_enabled)

◆ enabled()

bool map_labels::enabled ( ) const
inline

◆ get_label() [1/2]

const terrain_label* map_labels::get_label ( const map_location loc,
const std::string &  team_name 
) const
inline

◆ get_label() [2/2]

const terrain_label * map_labels::get_label ( const map_location loc) const

Definition at line 115 of file label.cpp.

References get_label(), and team_name().

◆ get_label_private()

terrain_label * map_labels::get_label_private ( const map_location loc,
const std::string &  team_name 
)
private

Definition at line 102 of file label.cpp.

References labels_.

Referenced by enabled(), get_label(), and set_label().

◆ operator=()

map_labels & map_labels::operator= ( const map_labels other)

Definition at line 69 of file label.cpp.

References map_labels(), and ~map_labels().

◆ read()

void map_labels::read ( const config cfg)

◆ recalculate_labels()

void map_labels::recalculate_labels ( )

◆ recalculate_shroud()

void map_labels::recalculate_shroud ( )

Definition at line 277 of file label.cpp.

References labels_.

Referenced by enabled(), actions::shroud_clearer::invalidate_after_clear(), and display::scroll().

◆ set_label()

const terrain_label * map_labels::set_label ( const map_location loc,
const t_string text,
const int  creator = -1,
const std::string &  team = "",
const color_t  color = font::NORMAL_COLOR,
const bool  visible_in_fog = true,
const bool  visible_in_shroud = false,
const bool  immutable = false,
const std::string &  category = "",
const t_string tooltip = "" 
)

◆ set_team()

void map_labels::set_team ( const team team)

Definition at line 138 of file label.cpp.

References categories_dirty, and team_.

Referenced by enabled(), and display::set_team().

◆ team_name()

const std::string & map_labels::team_name ( ) const

◆ visible_global_label()

bool map_labels::visible_global_label ( const map_location loc) const

Returns whether or not a global (non-team) label can be shown at a specified location.

(Global labels are suppressed in favor of team labels.)

Definition at line 266 of file label.cpp.

References labels_, team_, and team_name().

Referenced by enabled(), and terrain_label::viewable().

◆ write()

void map_labels::write ( config res) const

Definition at line 79 of file label.cpp.

References config::add_child(), and labels_.

Referenced by map_labels(), and editor::map_context::to_config().

Member Data Documentation

◆ categories

std::vector<std::string> map_labels::categories
mutableprivate

Definition at line 101 of file label.hpp.

Referenced by all_categories().

◆ categories_dirty

bool map_labels::categories_dirty
mutableprivate

Definition at line 102 of file label.hpp.

Referenced by add_label(), all_categories(), clear(), clear_map(), set_label(), and set_team().

◆ enabled_

bool map_labels::enabled_
private

Definition at line 99 of file label.hpp.

Referenced by enable(), and enabled().

◆ labels_

team_label_map map_labels::labels_
private

◆ team_

const team* map_labels::team_
private

Definition at line 96 of file label.hpp.

Referenced by set_team(), team_name(), and visible_global_label().


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