![]() |
Audacity 3.2.0
|
Iterator over only members of a TrackList of the specified subtype, optionally filtered by a predicate; past-end value dereferenceable, to nullptr. More...
#include <Track.h>
Public Types | |
using | FunctionType = std::function< bool(std::add_pointer_t< std::add_const_t< std::remove_pointer_t< TrackType > > >) > |
Type of predicate taking pointer to const TrackType. More... | |
![]() | |
using | iterator_category = std::bidirectional_iterator_tag |
using | value_type = TrackType * |
using | difference_type = ptrdiff_t |
using | pointer = void |
using | reference = const TrackType * |
Public Member Functions | |
TrackIter (TrackNodePointer begin, TrackNodePointer iter, TrackNodePointer end, FunctionType pred={}) | |
Constructor, usually not called directly except by methods of TrackList. More... | |
template<typename Predicate2 > | |
TrackIter | Filter (const Predicate2 &pred2) const |
Return an iterator that replaces the predicate. More... | |
template<typename TrackType2 > | |
auto | Filter () const -> std::enable_if_t< std::is_base_of_v< TrackType, TrackType2 > &&(!std::is_const_v< TrackType >||std::is_const_v< TrackType2 >), TrackIter< TrackType2 > > |
Return an iterator for a subclass of TrackType (and not removing const) with same predicate. More... | |
const FunctionType & | GetPredicate () const |
TrackIter & | operator++ () |
Safe to call even when at the end. More... | |
TrackIter | operator++ (int) |
Safe to call even when at the end. More... | |
TrackIter & | operator-- () |
Safe to call even when at the beginning. More... | |
TrackIter | operator-- (int) |
Safe to call even when at the beginning. More... | |
TrackType * | operator* () const |
Safe to call even when at the end. More... | |
TrackIter | advance (long amount) const |
This might be called operator + , but it's not constant-time as with a random access iterator. More... | |
Private Member Functions | |
bool | valid () const |
Test satisfaction of the invariant, while initializing, incrementing, or decrementing. More... | |
Private Attributes | |
friend | TrackIterRange< TrackType > |
This friendship is needed in TrackIterRange::StartingWith and TrackIterRange::EndingAfter() More... | |
TrackNodePointer | mBegin |
Allows end of reverse iteration to be detected without comparison to other TrackIter. More... | |
TrackNodePointer | mIter |
Current position. More... | |
TrackNodePointer | mEnd |
Allows end of iteration to be detected without comparison to other TrackIter. More... | |
FunctionType | mPred |
Optional filter More... | |
Friends | |
bool | operator== (TrackIter a, TrackIter b) |
Compares only current positions, assuming same beginnings and ends. More... | |
bool | operator!= (TrackIter a, TrackIter b) |
Compares only current positions, assuming same beginnings and ends. More... | |
Iterator over only members of a TrackList of the specified subtype, optionally filtered by a predicate; past-end value dereferenceable, to nullptr.
Does not suffer invalidation when an underlying std::list iterator is deleted, provided that is not equal to its current position or to the beginning or end iterator.
The filtering predicate is tested only when the iterator is constructed or advanced.
TrackType | Track or a subclass, maybe const-qualified |
using TrackIter< TrackType >::FunctionType = std::function< bool( std::add_pointer_t< std::add_const_t< std::remove_pointer_t<TrackType> > > ) > |
|
inline |
Constructor, usually not called directly except by methods of TrackList.
begin | Remember lower bound |
iter | The actual pointer |
end | Remember upper bound |
pred | Optional filter |
Definition at line 654 of file Track.h.
This might be called operator + , but it's not constant-time as with a random access iterator.
amount | may be negative |
Definition at line 751 of file Track.h.
References staffpad::vo::copy().
|
inline |
Return an iterator for a subclass of TrackType (and not removing const) with same predicate.
Advance to the first position at or after the old position that satisfies the type constraint, or to the end
Definition at line 681 of file Track.h.
References TrackIter< TrackType >::mBegin, TrackIter< TrackType >::mEnd, TrackIter< TrackType >::mIter, and TrackIter< TrackType >::mPred.
|
inline |
Return an iterator that replaces the predicate.
Advance to the first position at or after the old position that satisfies the new predicate, or to the end
Definition at line 672 of file Track.h.
References TrackIter< TrackType >::mBegin, TrackIter< TrackType >::mEnd, and TrackIter< TrackType >::mIter.
Referenced by TrackList::Channels_().
|
inline |
|
inline |
Safe to call even when at the end.
In that case you get nullptr.
Definition at line 739 of file Track.h.
References TrackIter< TrackType >::mEnd, and TrackIter< TrackType >::mIter.
Safe to call even when at the end.
In that case *this remains unchanged.
Definition at line 697 of file Track.h.
References TrackIter< TrackType >::mEnd, TrackIter< TrackType >::mIter, and TrackIter< TrackType >::valid().
Referenced by TrackIter< TrackType >::operator++().
Safe to call even when at the end.
In that case *this remains unchanged.
Definition at line 707 of file Track.h.
References TrackIter< TrackType >::operator++().
Safe to call even when at the beginning.
In that case *this wraps to the end.
Definition at line 716 of file Track.h.
References TrackIter< TrackType >::mBegin, TrackIter< TrackType >::mEnd, TrackIter< TrackType >::mIter, and TrackIter< TrackType >::valid().
Referenced by TrackIter< TrackType >::operator--().
Safe to call even when at the beginning.
In that case *this wraps to the end.
Definition at line 730 of file Track.h.
References TrackIter< TrackType >::operator--().
|
inlineprivate |
Test satisfaction of the invariant, while initializing, incrementing, or decrementing.
Definition at line 783 of file Track.h.
References TrackIter< TrackType >::mIter, and TrackIter< TrackType >::mPred.
Referenced by TrackIter< TrackType >::operator++(), and TrackIter< TrackType >::operator--().
|
friend |
Compares only current positions, assuming same beginnings and ends.
|
private |
Allows end of reverse iteration to be detected without comparison to other TrackIter.
Definition at line 796 of file Track.h.
Referenced by TrackIter< TrackType >::Filter(), and TrackIter< TrackType >::operator--().
|
private |
Allows end of iteration to be detected without comparison to other TrackIter.
Definition at line 798 of file Track.h.
Referenced by TrackIter< TrackType >::Filter(), TrackIter< TrackType >::operator*(), TrackIter< TrackType >::operator++(), and TrackIter< TrackType >::operator--().
|
private |
Current position.
Definition at line 797 of file Track.h.
Referenced by TrackIter< TrackType >::Filter(), TrackIter< TrackType >::operator*(), TrackIter< TrackType >::operator++(), TrackIter< TrackType >::operator--(), and TrackIter< TrackType >::valid().
|
private |
Optional filter
Definition at line 799 of file Track.h.
Referenced by TrackIter< TrackType >::Filter(), TrackIter< TrackType >::GetPredicate(), and TrackIter< TrackType >::valid().
|
private |
This friendship is needed in TrackIterRange::StartingWith and TrackIterRange::EndingAfter()