![]() |
Lumiera 0.pre.04
»edit your freedom«
|
#include "lib/iter-adapter.hpp"
Adapter for building an implementation of the »Lumiera Forward Iterator« concept.
The "current position" is represented as an opaque element (usually a nested iterator), with callbacks into the controlling container instance to manage this position. This allows to influence and customise the iteration process to a large extent. Basically such an IterAdapter behaves like the similar concept from STL, but
checkPoint() and iterNext() free functions.| POS | pointer or similar mutable link to the current value. Will be bool() checked to detect iteration end, end else dereferenced. |
| CON | type of the backing container, which needs to implement two extension point functions for iteration control |
checkPoint yields true iff the source has yet more result values to yielditerNext advances the POS to the next elementvalue_type, reference and pointerDefinition at line 207 of file iter-adapter.hpp.
Public Types | |
| using | value_type = _ValTrait::value_type |
| using | reference = _ValTrait::reference |
| using | pointer = _ValTrait::pointer |
Public Member Functions | |
| IterAdapter (CON src, POS const &startpos) | |
| IterAdapter () | |
| operator bool () const | |
| reference | operator* () const |
| pointer | operator-> () const |
| IterAdapter & | operator++ () |
| bool | isValid () const |
| bool | empty () const |
| ENABLE_USE_IN_STD_RANGE_FOR_LOOPS (IterAdapter) | |
Friends | |
| template<class P1 , class P2 , class CX > | |
| bool | operator== (IterAdapter< P1, CX > const &, IterAdapter< P2, CX > const &) |
| comparison is allowed to access impl iterator | |
Protected Types | |
| using | ConRef = meta::RefTraits< CON >::Reference |
Protected Member Functions | |
| bool | check () const |
| ask the controlling container if this position is valid. | |
| void | iterate () |
| ask the controlling container to yield the next position. | |
| ConRef | source () |
| allow derived classes to access backing container | |
| const ConRef | source () const |
| void | resetPos (POS otherPos) |
Private Types | |
| using | _ValTrait = meta::ValueTypeBinding< std::remove_pointer_t< POS > > |
Private Member Functions | |
| void | _maybe_throw () const |
Private Attributes | |
| CON | source_ |
| POS | pos_ |
|
inline |
Definition at line 220 of file iter-adapter.hpp.
References IterAdapter< POS, CON >::check().
Here is the call graph for this function:
|
inline |
Definition at line 227 of file iter-adapter.hpp.
|
private |
Definition at line 212 of file iter-adapter.hpp.
| using value_type = _ValTrait::value_type |
Definition at line 215 of file iter-adapter.hpp.
| using reference = _ValTrait::reference |
Definition at line 216 of file iter-adapter.hpp.
| using pointer = _ValTrait::pointer |
Definition at line 217 of file iter-adapter.hpp.
|
protected |
Definition at line 305 of file iter-adapter.hpp.
|
inlineexplicit |
Definition at line 233 of file iter-adapter.hpp.
References IterAdapter< POS, CON >::isValid().
Here is the call graph for this function:
|
inline |
Definition at line 242 of file iter-adapter.hpp.
References IterAdapter< POS, CON >::_maybe_throw(), and IterAdapter< POS, CON >::pos_.
Here is the call graph for this function:
|
inline |
Definition at line 249 of file iter-adapter.hpp.
References IterAdapter< POS, CON >::_maybe_throw(), and IterAdapter< POS, CON >::pos_.
Here is the call graph for this function:
|
inline |
Definition at line 256 of file iter-adapter.hpp.
References IterAdapter< POS, CON >::_maybe_throw(), and IterAdapter< POS, CON >::iterate().
Here is the call graph for this function:
|
inline |
Definition at line 264 of file iter-adapter.hpp.
References IterAdapter< POS, CON >::check().
Referenced by IterAdapter< POS, CON >::_maybe_throw(), IterAdapter< POS, CON >::empty(), and IterAdapter< POS, CON >::operator bool().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Definition at line 270 of file iter-adapter.hpp.
References IterAdapter< POS, CON >::isValid().
Here is the call graph for this function:
|
inlineprotected |
ask the controlling container if this position is valid.
Definition at line 284 of file iter-adapter.hpp.
References IterAdapter< POS, CON >::pos_, and IterAdapter< POS, CON >::source_.
Referenced by IterAdapter< POS, CON >::IterAdapter(), IterAdapter< POS, CON >::isValid(), IterAdapter< POS, CON >::iterate(), and IterAdapter< POS, CON >::resetPos().
Here is the caller graph for this function:
|
inlineprotected |
ask the controlling container to yield the next position.
The call is dispatched only if the current position is valid; any new position reached will typically be validated prior to any further access, through invocation of check.
Definition at line 295 of file iter-adapter.hpp.
References IterAdapter< POS, CON >::check(), IterAdapter< POS, CON >::pos_, and IterAdapter< POS, CON >::source_.
Referenced by IterAdapter< POS, CON >::operator++().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineprotected |
allow derived classes to access backing container
Definition at line 308 of file iter-adapter.hpp.
References IterAdapter< POS, CON >::source_.
|
inlineprotected |
Definition at line 309 of file iter-adapter.hpp.
|
inlineprotected |
Definition at line 312 of file iter-adapter.hpp.
References IterAdapter< POS, CON >::check(), and IterAdapter< POS, CON >::pos_.
Here is the call graph for this function:
|
inlineprivate |
Definition at line 320 of file iter-adapter.hpp.
References IterAdapter< POS, CON >::isValid().
Referenced by IterAdapter< POS, CON >::operator*(), IterAdapter< POS, CON >::operator++(), and IterAdapter< POS, CON >::operator->().
Here is the call graph for this function:
Here is the caller graph for this function:| ENABLE_USE_IN_STD_RANGE_FOR_LOOPS | ( | IterAdapter< POS, CON > | ) |
|
private |
Definition at line 209 of file iter-adapter.hpp.
Referenced by IterAdapter< POS, CON >::check(), IterAdapter< POS, CON >::iterate(), and IterAdapter< POS, CON >::source().
|
mutableprivate |
Definition at line 210 of file iter-adapter.hpp.
Referenced by IterAdapter< POS, CON >::check(), IterAdapter< POS, CON >::iterate(), IterAdapter< POS, CON >::operator*(), IterAdapter< POS, CON >::operator->(), lib::operator==(), and IterAdapter< POS, CON >::resetPos().
|
friend |
comparison is allowed to access impl iterator
Inheritance diagram for IterAdapter< POS, CON >:
Collaboration diagram for IterAdapter< POS, CON >: