Audacity 3.2.0
Public Member Functions | Private Types | Private Attributes | Friends | List of all members
Channel::IntervalIterator< IntervalType > Class Template Reference

#include <Channel.h>

Inheritance diagram for Channel::IntervalIterator< IntervalType >:
[legend]
Collaboration diagram for Channel::IntervalIterator< IntervalType >:
[legend]

Public Member Functions

 IntervalIterator ()=default
 
 IntervalIterator (ChannelType *pChannel, size_t index)
 
std::shared_ptr< IntervalType > operator* () const
 
IntervalIteratoroperator++ ()
 
IntervalIterator operator++ (int)
 
IntervalIteratoroperator-- ()
 
IntervalIterator operator-- (int)
 

Private Types

using ChannelType = std::conditional_t< std::is_const_v< IntervalType >, const Channel, Channel >
 

Private Attributes

ChannelTypempChannel {}
 
size_t mIndex {}
 

Friends

bool operator== (IntervalIterator a, IntervalIterator b)
 
bool operator!= (IntervalIterator a, IntervalIterator b)
 

Additional Inherited Members

- Public Types inherited from ValueIterator< std::shared_ptr< IntervalType >, std::bidirectional_iterator_tag >
using iterator_category = std::bidirectional_iterator_tag
 
using value_type = std::shared_ptr< IntervalType >
 
using difference_type = ptrdiff_t
 
using pointer = void
 
using reference = const std::shared_ptr< IntervalType >
 

Detailed Description

template<typename IntervalType>
class Channel::IntervalIterator< IntervalType >

Iterator for intervals; destroying the related ChannelGroup or WideChannelGroupInterval invalidates it

Some intervals may have zero duration, and no ordering of the intervals is assumed.

Definition at line 229 of file Channel.h.

Member Typedef Documentation

◆ ChannelType

template<typename IntervalType >
using Channel::IntervalIterator< IntervalType >::ChannelType = std::conditional_t<std::is_const_v<IntervalType>, const Channel, Channel>
private

Definition at line 234 of file Channel.h.

Constructor & Destructor Documentation

◆ IntervalIterator() [1/2]

template<typename IntervalType >
Channel::IntervalIterator< IntervalType >::IntervalIterator ( )
default

◆ IntervalIterator() [2/2]

template<typename IntervalType >
Channel::IntervalIterator< IntervalType >::IntervalIterator ( ChannelType pChannel,
size_t  index 
)
inline

Definition at line 238 of file Channel.h.

239 : mpChannel{ pChannel }, mIndex{ index }
240 {}
ChannelType * mpChannel
Definition: Channel.h:263

Member Function Documentation

◆ operator*()

template<typename IntervalType >
std::shared_ptr< IntervalType > Channel::IntervalIterator< IntervalType >::operator* ( ) const
inline

Definition at line 242 of file Channel.h.

243 {
244 if (!mpChannel || mIndex >= mpChannel->NIntervals())
245 return {};
246 return mpChannel->template GetInterval<IntervalType>(mIndex);
247 }

◆ operator++() [1/2]

template<typename IntervalType >
IntervalIterator & Channel::IntervalIterator< IntervalType >::operator++ ( )
inline

Definition at line 249 of file Channel.h.

249{ ++mIndex; return *this; }

◆ operator++() [2/2]

template<typename IntervalType >
IntervalIterator Channel::IntervalIterator< IntervalType >::operator++ ( int  )
inline

Definition at line 250 of file Channel.h.

251 { auto copy{ *this }; operator ++(); return copy; }
IntervalIterator & operator++()
Definition: Channel.h:249
void copy(const T *src, T *dst, int32_t n)
Definition: VectorOps.h:40

References staffpad::vo::copy().

Here is the call graph for this function:

◆ operator--() [1/2]

template<typename IntervalType >
IntervalIterator & Channel::IntervalIterator< IntervalType >::operator-- ( )
inline

Definition at line 253 of file Channel.h.

253{ --mIndex; return *this; }

◆ operator--() [2/2]

template<typename IntervalType >
IntervalIterator Channel::IntervalIterator< IntervalType >::operator-- ( int  )
inline

Definition at line 254 of file Channel.h.

255 { auto copy{ *this }; operator --(); return copy; }
IntervalIterator & operator--()
Definition: Channel.h:253

References staffpad::vo::copy().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator!=

template<typename IntervalType >
bool operator!= ( IntervalIterator< IntervalType >  a,
IntervalIterator< IntervalType >  b 
)
friend

Definition at line 259 of file Channel.h.

260 { return !(a == b); }

◆ operator==

template<typename IntervalType >
bool operator== ( IntervalIterator< IntervalType >  a,
IntervalIterator< IntervalType >  b 
)
friend

Definition at line 257 of file Channel.h.

258 { return a.mpChannel == b.mpChannel && a.mIndex == b.mIndex; }

Member Data Documentation

◆ mIndex

template<typename IntervalType >
size_t Channel::IntervalIterator< IntervalType >::mIndex {}
private

Definition at line 264 of file Channel.h.

◆ mpChannel

template<typename IntervalType >
ChannelType* Channel::IntervalIterator< IntervalType >::mpChannel {}
private

Definition at line 263 of file Channel.h.


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