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

#include <recall_list_manager.hpp>

Public Types

typedef std::vector< unit_ptr >
::iterator 
iterator
 
typedef std::vector< unit_ptr >
::const_iterator 
const_iterator
 

Public Member Functions

iterator begin ()
 begin iterator More...
 
iterator end ()
 end iterator More...
 
const_iterator begin () const
 begin const iterator More...
 
const_iterator end () const
 end const iterator More...
 
unit_ptr operator[] (size_t index)
 vector style dereference More...
 
unit_const_ptr operator[] (size_t index) const
 vector style dereference More...
 
unit_ptr find_if_matches_id (const std::string &unit_id)
 Find a unit by id. Null pointer if not found. More...
 
unit_ptr extract_if_matches_id (const std::string &unit_id)
 Find a unit by id, and extract from this object if found. Null if not found. More...
 
unit_const_ptr find_if_matches_id (const std::string &unit_id) const
 Const find by id. More...
 
void erase_if_matches_id (const std::string &unit_id)
 Erase any unit with this id. More...
 
unit_ptr find_if_matches_underlying_id (size_t uid)
 Find a unit by underlying id. Null pointer if not found. More...
 
unit_ptr extract_if_matches_underlying_id (size_t uid)
 Find a unit by underlying id, and extract if found. Null if not found. More...
 
unit_const_ptr find_if_matches_underlying_id (size_t uid) const
 Const find by underlying id. More...
 
void erase_by_underlying_id (size_t uid)
 Erase any unit with this underlying id. More...
 
iterator erase_index (size_t index)
 Erase by index. More...
 
iterator erase (iterator it)
 Erase an iterator to this object. More...
 
size_t find_index (const std::string &unit_id) const
 Find the index of a unit by its id. More...
 
size_t size () const
 Get the number of units on the list. More...
 
bool empty () const
 Is it empty? More...
 
void add (const unit_ptr &ptr)
 Add a unit to the list. More...
 

Private Attributes

std::vector< unit_ptrrecall_list_
 The underlying data struture. TODO: Should this be a map based on underlying id instead? More...
 

Friends

class ai::readonly_context_impl
 Friend AI module for ease of implementation there. More...
 

Detailed Description

Definition at line 29 of file recall_list_manager.hpp.

Member Typedef Documentation

Definition at line 32 of file recall_list_manager.hpp.

Definition at line 31 of file recall_list_manager.hpp.

Member Function Documentation

void recall_list_manager::add ( const unit_ptr ptr)
iterator recall_list_manager::begin ( )
inline

begin iterator

Definition at line 34 of file recall_list_manager.hpp.

References recall_list_.

Referenced by BOOST_AUTO_TEST_CASE(), and game_events::WML_HANDLER_FUNCTION().

const_iterator recall_list_manager::begin ( ) const
inline

begin const iterator

Definition at line 37 of file recall_list_manager.hpp.

References recall_list_.

bool recall_list_manager::empty ( ) const
inline

Is it empty?

Definition at line 58 of file recall_list_manager.hpp.

References recall_list_.

Referenced by events::menu_handler::recall().

iterator recall_list_manager::end ( )
inline

end iterator

Definition at line 35 of file recall_list_manager.hpp.

References recall_list_.

Referenced by BOOST_AUTO_TEST_CASE(), ai::formula_ai::get_value(), and game_events::WML_HANDLER_FUNCTION().

const_iterator recall_list_manager::end ( ) const
inline

end const iterator

Definition at line 38 of file recall_list_manager.hpp.

References recall_list_.

std::vector< unit_ptr >::iterator recall_list_manager::erase ( iterator  it)

Erase an iterator to this object.

Definition at line 146 of file recall_list_manager.cpp.

References recall_list_.

Referenced by game_events::WML_HANDLER_FUNCTION().

void recall_list_manager::erase_by_underlying_id ( size_t  uid)

Erase any unit with this underlying id.

Definition at line 121 of file recall_list_manager.cpp.

References find_if_matches_uid_helper(), and recall_list_.

Referenced by game_lua_kernel::intf_put_recall_unit().

void recall_list_manager::erase_if_matches_id ( const std::string unit_id)
std::vector< unit_ptr >::iterator recall_list_manager::erase_index ( size_t  index)

Erase by index.

Definition at line 141 of file recall_list_manager.cpp.

References recall_list_.

unit_ptr recall_list_manager::extract_if_matches_id ( const std::string unit_id)

Find a unit by id, and extract from this object if found. Null if not found.

Definition at line 81 of file recall_list_manager.cpp.

References find_if_matches_helper(), and recall_list_.

Referenced by actions::recall_unit(), and ai::simulated_recall().

unit_ptr recall_list_manager::extract_if_matches_underlying_id ( size_t  uid)

Find a unit by underlying id, and extract if found. Null if not found.

Definition at line 128 of file recall_list_manager.cpp.

References find_if_matches_uid_helper(), and recall_list_.

unit_ptr recall_list_manager::find_if_matches_id ( const std::string unit_id)

Find a unit by id. Null pointer if not found.

Used to find units in vectors by their ID.

Definition at line 33 of file recall_list_manager.cpp.

References find_if_matches_helper(), and recall_list_.

Referenced by unit_creator::add_unit(), BOOST_AUTO_TEST_CASE(), ai::recall_result::get_recall_unit(), actions::undo::recall_action::redo(), and SYNCED_COMMAND_HANDLER_FUNCTION().

unit_const_ptr recall_list_manager::find_if_matches_id ( const std::string unit_id) const

Const find by id.

Used to find units in vectors by their ID.

Definition at line 47 of file recall_list_manager.cpp.

References find_if_matches_helper(), and recall_list_.

unit_ptr recall_list_manager::find_if_matches_underlying_id ( size_t  uid)

Find a unit by underlying id. Null pointer if not found.

Definition at line 99 of file recall_list_manager.cpp.

References find_if_matches_uid_helper(), and recall_list_.

unit_const_ptr recall_list_manager::find_if_matches_underlying_id ( size_t  uid) const

Const find by underlying id.

Definition at line 110 of file recall_list_manager.cpp.

References find_if_matches_uid_helper(), and recall_list_.

size_t recall_list_manager::find_index ( const std::string unit_id) const

Find the index of a unit by its id.

Definition at line 73 of file recall_list_manager.cpp.

References find_if_matches_helper(), and recall_list_.

Referenced by game_lua_kernel::intf_match_unit(), and side_filter::match_internal().

unit_ptr recall_list_manager::operator[] ( size_t  index)
inline

vector style dereference

Definition at line 40 of file recall_list_manager.hpp.

References recall_list_.

unit_const_ptr recall_list_manager::operator[] ( size_t  index) const
inline

vector style dereference

Definition at line 41 of file recall_list_manager.hpp.

References recall_list_.

size_t recall_list_manager::size ( ) const
inline

Get the number of units on the list.

Definition at line 57 of file recall_list_manager.hpp.

References recall_list_.

Referenced by BOOST_AUTO_TEST_CASE(), and SYNCED_COMMAND_HANDLER_FUNCTION().

Friends And Related Function Documentation

friend class ai::readonly_context_impl
friend

Friend AI module for ease of implementation there.

Definition at line 65 of file recall_list_manager.hpp.

Member Data Documentation

std::vector<unit_ptr > recall_list_manager::recall_list_
private

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