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

#include <filter.hpp>

Public Member Functions

 unit_filter (const vconfig &cfg, const filter_context *fc, bool use_flat_tod=false)
 Constructs a unit filter from a config and a context. This function should give the most efficient implementation available. More...
 
 unit_filter (const unit_filter &o)
 
void swap (unit_filter &o)
 
unit_filteroperator= (unit_filter o)
 
bool matches (const unit &u, const map_location &loc) const
 Determine if *this matches filter at a specified location. More...
 
bool matches (const unit &u) const
 Determine if *this matches filter at its current location. More...
 
bool matches (const unit &u, const map_location &loc, const unit &u2) const
 
bool matches (const unit &u, const unit &u2) const
 
bool operator() (const unit &u, const map_location &loc) const
 
bool operator() (const unit &u) const
 
bool operator() (const unit &u, const map_location &loc, const unit &u2) const
 
bool operator() (const unit &u, const unit &u2) const
 
std::vector< const unit * > all_matches_on_map () const
 
unit_const_ptr first_match_on_map () const
 
config to_config () const
 
bool empty () const
 

Private Attributes

boost::shared_ptr
< unit_filter_abstract_impl
impl_
 
unsigned max_matches_
 

Detailed Description

Definition at line 50 of file filter.hpp.

Constructor & Destructor Documentation

unit_filter::unit_filter ( const vconfig cfg,
const filter_context fc,
bool  use_flat_tod = false 
)

Constructs a unit filter from a config and a context. This function should give the most efficient implementation available.

Ctor of unit filter unit_filter::unit_filter acts as a factory, selecting the appropriate implementation class.

Definition at line 210 of file filter.cpp.

References construct(), impl_, and max_matches_.

unit_filter::unit_filter ( const unit_filter o)
inline

Definition at line 55 of file filter.hpp.

Member Function Documentation

std::vector<const unit *> unit_filter::all_matches_on_map ( ) const
inline

Definition at line 94 of file filter.hpp.

References impl_, and max_matches_.

bool unit_filter::empty ( ) const
inline

Definition at line 104 of file filter.hpp.

References impl_.

unit_const_ptr unit_filter::first_match_on_map ( ) const
inline

Definition at line 98 of file filter.hpp.

References impl_.

Referenced by unit_display::wml_animation_internal().

bool unit_filter::matches ( const unit u,
const map_location loc 
) const
inline

Determine if *this matches filter at a specified location.

Use this for units on a recall list, or to test for a match if a unit is hypothetically moved.

Definition at line 67 of file filter.hpp.

References impl_.

Referenced by unit::ability_active(), unit::ability_affects_self(), unit::add_modification(), matches(), game_events::entity_location::matches_unit_filter(), operator()(), attack_type::special_active(), and game_events::WML_HANDLER_FUNCTION().

bool unit_filter::matches ( const unit u) const

Determine if *this matches filter at its current location.

Defined out of line to prevent including unit at unit_filter.hpp.

(Only use for units currently on the map; otherwise use the overload that takes a location, possibly with a null location.)

Definition at line 57 of file filter.cpp.

References unit::get_location(), and matches().

bool unit_filter::matches ( const unit u,
const map_location loc,
const unit u2 
) const

Definition at line 61 of file filter.cpp.

References impl_.

bool unit_filter::matches ( const unit u,
const unit u2 
) const

Definition at line 65 of file filter.cpp.

References unit::get_location(), and matches().

bool unit_filter::operator() ( const unit u,
const map_location loc 
) const
inline

Definition at line 78 of file filter.hpp.

References matches().

bool unit_filter::operator() ( const unit u) const
inline

Definition at line 82 of file filter.hpp.

References matches().

bool unit_filter::operator() ( const unit u,
const map_location loc,
const unit u2 
) const
inline

Definition at line 86 of file filter.hpp.

References matches().

bool unit_filter::operator() ( const unit u,
const unit u2 
) const
inline

Definition at line 90 of file filter.hpp.

References matches().

unit_filter& unit_filter::operator= ( unit_filter  o)
inline

Definition at line 59 of file filter.hpp.

References swap().

void unit_filter::swap ( unit_filter o)
inline

Definition at line 56 of file filter.hpp.

References impl_.

Referenced by operator=().

config unit_filter::to_config ( ) const

Definition at line 52 of file filter.cpp.

References impl_.

Member Data Documentation

boost::shared_ptr<unit_filter_abstract_impl> unit_filter::impl_
private
unsigned unit_filter::max_matches_
private

Definition at line 109 of file filter.hpp.

Referenced by all_matches_on_map(), and unit_filter().


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