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

This is a wrapper for a list of weak pointers to handlers. More...

#include <handlers.hpp>

Classes

class  iterator
 Handler list iterators are rather limited. More...
 

Public Types

typedef iterator const_iterator
 

Public Member Functions

 handler_list ()
 Default constructor. More...
 
const_iterator begin () const
 
const_iterator end () const
 
void push_front (const handler_ptr &p)
 
void push_back (const handler_ptr &p)
 
void clear ()
 

Private Types

typedef boost::weak_ptr
< event_handler
internal_ptr
 The weak pointers that are used internally. More...
 
typedef utils::smart_list
< internal_ptr
list_t
 The underlying list. More...
 

Private Member Functions

handler_listoperator= (const handler_list &)
 No implementation of operator=() since smart_list does not support it. More...
 

Private Attributes

list_t data_
 The actual list. More...
 

Friends

class iterator
 

Detailed Description

This is a wrapper for a list of weak pointers to handlers.

It allows forward iterations of the list, with each element returned as a shared pointer. (Weak pointers that fail to lock are silently removed from the list.) These iterations can be used recursively, even when the innermost iteration might erase arbitrary elements from the list.

The interface is not the standard list interface because that would be inconvenient. The functionality implemented is that required by Wesnoth.

Definition at line 88 of file handlers.hpp.

Member Typedef Documentation

Definition at line 121 of file handlers.hpp.

typedef boost::weak_ptr<event_handler> game_events::handler_list::internal_ptr
private

The weak pointers that are used internally.

Definition at line 91 of file handlers.hpp.

The underlying list.

Definition at line 93 of file handlers.hpp.

Constructor & Destructor Documentation

game_events::handler_list::handler_list ( )
inline

Default constructor.

Note: This explicit definition is required (by the more pedantic compilers) in order to declare a default-constructed, static, and const variable in t_event_handlers::get(), in handlers.cpp.

Definition at line 128 of file handlers.hpp.

Member Function Documentation

const_iterator game_events::handler_list::begin ( ) const
inline

Definition at line 130 of file handlers.hpp.

References begin(), data_, and iterator.

Referenced by begin().

void game_events::handler_list::clear ( )
inline

Definition at line 139 of file handlers.hpp.

References utils::smart_list< Data >::clear(), and data_.

const_iterator game_events::handler_list::end ( ) const
inline

Definition at line 132 of file handlers.hpp.

References data_, end(), and iterator.

Referenced by end().

handler_list& game_events::handler_list::operator= ( const handler_list )
private

No implementation of operator=() since smart_list does not support it.

void game_events::handler_list::push_back ( const handler_ptr p)
inline
void game_events::handler_list::push_front ( const handler_ptr p)
inline

Definition at line 136 of file handlers.hpp.

References data_, and utils::smart_list< Data >::push_front().

Friends And Related Function Documentation

friend class iterator
friend

Definition at line 120 of file handlers.hpp.

Referenced by begin(), and end().

Member Data Documentation

list_t game_events::handler_list::data_
private

The actual list.

Definition at line 146 of file handlers.hpp.

Referenced by begin(), clear(), end(), push_back(), and push_front().


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