The Battle for Wesnoth  1.19.18+dev
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
editor::editor_map::selection_mask Class Reference

Public Member Functions

 selection_mask (const gamemap_base &map)
 
bool select (const map_location &loc)
 Marks loc as selected. More...
 
bool deselect (const map_location &loc)
 Marks loc as unselected. More...
 
bool selected (const map_location &loc) const
 
void select_all ()
 
void deselect_all ()
 
void invert ()
 
selection_mask inverted () const
 
const boost::dynamic_bitset< uint64_t > & mask () const
 Read-only access to the underlying bitset. More...
 

Static Public Member Functions

static std::set< map_locationget_locations (const selection_mask &mask)
 

Private Member Functions

std::size_t get_index (const map_location &loc) const
 Indexes loc to its corresponding bitflag using row-major ordering. More...
 
map_location get_location (std::size_t i) const
 Gets the corresponding map_location for bit index i. More...
 

Private Attributes

boost::dynamic_bitset< uint64_t > bitset_
 
int stride_ {0}
 
int height_ {0}
 

Detailed Description

Definition at line 214 of file editor_map.hpp.

Constructor & Destructor Documentation

◆ selection_mask()

editor::editor_map::selection_mask::selection_mask ( const gamemap_base map)
inlineexplicit

Definition at line 217 of file editor_map.hpp.

References bitset_, and gamemap_base::total_area().

Member Function Documentation

◆ deselect()

bool editor::editor_map::selection_mask::deselect ( const map_location loc)
inline

Marks loc as unselected.

Returns
true if the location was previously selected.

Definition at line 237 of file editor_map.hpp.

References bitset_, get_index(), and loc.

Referenced by editor::editor_map::remove_from_selection().

◆ deselect_all()

void editor::editor_map::selection_mask::deselect_all ( )
inline

Definition at line 252 of file editor_map.hpp.

References bitset_.

Referenced by editor::editor_map::clear_selection().

◆ get_index()

std::size_t editor::editor_map::selection_mask::get_index ( const map_location loc) const
inlineprivate

Indexes loc to its corresponding bitflag using row-major ordering.

Definition at line 290 of file editor_map.hpp.

References loc, stride_, map_location::wml_x(), and map_location::wml_y().

Referenced by deselect(), select(), and selected().

◆ get_location()

map_location editor::editor_map::selection_mask::get_location ( std::size_t  i) const
inlineprivate

Gets the corresponding map_location for bit index i.

Definition at line 296 of file editor_map.hpp.

References i, and stride_.

◆ get_locations()

static std::set<map_location> editor::editor_map::selection_mask::get_locations ( const selection_mask mask)
inlinestatic

Definition at line 269 of file editor_map.hpp.

References i, and mask().

Referenced by editor::editor_map::selection(), and editor::editor_map::selection_inverse().

◆ invert()

void editor::editor_map::selection_mask::invert ( )
inline

Definition at line 257 of file editor_map.hpp.

References bitset_.

Referenced by editor::editor_map::invert_selection(), and inverted().

◆ inverted()

selection_mask editor::editor_map::selection_mask::inverted ( ) const
inline

Definition at line 262 of file editor_map.hpp.

References invert().

Referenced by editor::editor_map::selection_inverse().

◆ mask()

const boost::dynamic_bitset<uint64_t>& editor::editor_map::selection_mask::mask ( ) const
inline

◆ select()

bool editor::editor_map::selection_mask::select ( const map_location loc)
inline

Marks loc as selected.

Returns
true if the location was previously deselected.

Definition at line 228 of file editor_map.hpp.

References bitset_, get_index(), and loc.

Referenced by editor::editor_map::add_to_selection().

◆ select_all()

void editor::editor_map::selection_mask::select_all ( )
inline

Definition at line 247 of file editor_map.hpp.

References bitset_.

Referenced by editor::editor_map::select_all().

◆ selected()

bool editor::editor_map::selection_mask::selected ( const map_location loc) const
inline

Definition at line 242 of file editor_map.hpp.

References bitset_, get_index(), and loc.

Referenced by editor::editor_map::in_selection().

Member Data Documentation

◆ bitset_

boost::dynamic_bitset<uint64_t> editor::editor_map::selection_mask::bitset_
private

◆ height_

int editor::editor_map::selection_mask::height_ {0}
private

Definition at line 305 of file editor_map.hpp.

◆ stride_

int editor::editor_map::selection_mask::stride_ {0}
private

Definition at line 304 of file editor_map.hpp.

Referenced by get_index(), and get_location().


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