The Battle for Wesnoth  1.19.7+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 32 of file label.hpp.

Member Typedef Documentation

◆ label_map

Definition at line 35 of file label.hpp.

◆ team_label_map

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

Definition at line 36 of file label.hpp.

Constructor & Destructor Documentation

◆ map_labels() [1/2]

map_labels::map_labels ( const map_labels other)

Definition at line 55 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 47 of file label.cpp.

◆ ~map_labels()

map_labels::~map_labels ( )

Definition at line 65 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 203 of file label.cpp.

References categories_dirty, labels_, and t.

Referenced by 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 
)

Definition at line 211 of file label.cpp.

References categories_dirty, clear_map(), i, labels_, and team_name().

Referenced by do_replay_handle().

◆ clear_all()

void map_labels::clear_all ( )

◆ clear_map()

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

Definition at line 226 of file label.cpp.

References categories_dirty, and i.

Referenced by clear().

◆ enable()

void map_labels::enable ( bool  is_enabled)

Definition at line 254 of file label.cpp.

References enabled_, and recalculate_labels().

Referenced by editor::context_manager::refresh_on_context_change().

◆ enabled()

bool map_labels::enabled ( ) const
inline

Definition at line 67 of file label.hpp.

References enabled_.

Referenced by terrain_label::viewable().

◆ get_label() [1/2]

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

Definition at line 116 of file label.cpp.

References get_label(), loc, and team_name().

◆ get_label() [2/2]

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

◆ get_label_private()

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

Definition at line 103 of file label.cpp.

References labels_, loc, and team_name().

Referenced by get_label(), and set_label().

◆ operator=()

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

Definition at line 70 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 ( )

◆ 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 139 of file label.cpp.

References categories_dirty, and team_.

Referenced by display::set_viewing_team_index().

◆ 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 267 of file label.cpp.

References labels_, loc, team_, and team_name().

Referenced by terrain_label::viewable().

◆ write()

void map_labels::write ( config res) const

Definition at line 80 of file label.cpp.

References config::add_child(), label, 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 102 of file label.hpp.

Referenced by all_categories().

◆ categories_dirty

bool map_labels::categories_dirty
mutableprivate

Definition at line 103 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 100 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 97 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: