This class is similar to an input iterator through event handlers, except each instance knows its own end (determined when constructed). More...
#include <manager.hpp>
Public Member Functions | |
iteration (const std::string &event_name, manager &) | |
Event-specific constructor. More... | |
iteration & | operator++ () |
Increment Incrementing guarantees that the next dereference will differ from the previous derference (unless the iteration is exhausted). More... | |
handler_ptr | operator* () |
Dereference Will return a null pointer when the end of the iteration is reached. More... | |
Private Member Functions | |
handler_vec::size_type | ptr_index (const handler_ptr &ptr) const |
Gets the index from a pointer, capped at end_. More... | |
Private Attributes | |
const handler_list & | main_list_ |
The fixed-name event handlers for this iteration. More... | |
const handler_list & | var_list_ |
The varying-name event handlers for this iteration. More... | |
const std::string | event_name_ |
The event name for this iteration. More... | |
const handler_vec::size_type | end_ |
The end of this iteration. More... | |
bool | current_is_known_ |
Set to true upon dereferencing. More... | |
bool | main_is_current_ |
true if the most recent dereference was taken from main_list_. More... | |
handler_list::iterator | main_it_ |
The current (or next) element from main_list_. More... | |
handler_list::iterator | var_it_ |
The current (or next) element from var_list_. More... | |
game_data * | gamedata_ |
This class is similar to an input iterator through event handlers, except each instance knows its own end (determined when constructed).
Subsequent dereferences are not guaranteed to return the same element, so it is important to assign a dereference to a variable if you want to use it more than once. On the other hand, a dereference will not return a null pointer until the end of the iteration is reached (and this is how to detect the end of the iteration).
For simplicity, this class is neither assignable nor equality comparable nor default constructable, and there is no postincrement. Typedefs are also skipped.
Definition at line 60 of file manager.hpp.
|
explicit |
Event-specific constructor.
This iteration will go through all event handlers matching the given name (including those defined via menu items). An empty event_name will automatically match nothing.
Definition at line 96 of file manager.cpp.
handler_ptr game_events::manager::iteration::operator* | ( | ) |
Dereference Will return a null pointer when the end of the iteration is reached.
Definition at line 140 of file manager.cpp.
manager::iteration & game_events::manager::iteration::operator++ | ( | ) |
Increment Incrementing guarantees that the next dereference will differ from the previous derference (unless the iteration is exhausted).
However, multiple increments between dereferences are allowed to have the same effect as a single increment.
Definition at line 116 of file manager.cpp.
|
inlineprivate |
Gets the index from a pointer, capped at end_.
Definition at line 73 of file manager.hpp.
References end_.
|
private |
Set to true upon dereferencing.
Definition at line 88 of file manager.hpp.
|
private |
The end of this iteration.
We intentionally exclude handlers added after *this is constructed.
Definition at line 85 of file manager.hpp.
Referenced by ptr_index().
|
private |
The event name for this iteration.
Definition at line 82 of file manager.hpp.
|
private |
Definition at line 96 of file manager.hpp.
|
private |
true if the most recent dereference was taken from main_list_.
Definition at line 90 of file manager.hpp.
|
private |
The current (or next) element from main_list_.
Definition at line 92 of file manager.hpp.
|
private |
The fixed-name event handlers for this iteration.
Definition at line 78 of file manager.hpp.
|
private |
The current (or next) element from var_list_.
Definition at line 94 of file manager.hpp.
|
private |
The varying-name event handlers for this iteration.
Definition at line 80 of file manager.hpp.