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 208 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 213 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 217 of file Channel.h.

218 : mpChannel{ pChannel }, mIndex{ index }
219 {}
ChannelType * mpChannel
Definition: Channel.h:242

Member Function Documentation

◆ operator*()

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

Definition at line 221 of file Channel.h.

222 {
223 if (!mpChannel || mIndex >= mpChannel->NIntervals())
224 return {};
225 return mpChannel->template GetInterval<IntervalType>(mIndex);
226 }

◆ operator++() [1/2]

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

Definition at line 228 of file Channel.h.

228{ ++mIndex; return *this; }

◆ operator++() [2/2]

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

Definition at line 229 of file Channel.h.

230 { auto copy{ *this }; operator ++(); return copy; }
IntervalIterator & operator++()
Definition: Channel.h:228
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 232 of file Channel.h.

232{ --mIndex; return *this; }

◆ operator--() [2/2]

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

Definition at line 233 of file Channel.h.

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

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 238 of file Channel.h.

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

◆ operator==

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

Definition at line 236 of file Channel.h.

237 { 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 243 of file Channel.h.

◆ mpChannel

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

Definition at line 242 of file Channel.h.


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