Audacity  3.0.3
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
WaveTrack::AllClipsIterator Class Reference

#include <WaveTrack.h>

Inheritance diagram for WaveTrack::AllClipsIterator:
[legend]
Collaboration diagram for WaveTrack::AllClipsIterator:
[legend]

Public Member Functions

 AllClipsIterator ()
 
 AllClipsIterator (WaveTrack &track)
 
WaveClipoperator* () const
 
AllClipsIteratoroperator++ ()
 

Private Types

using Iterator = WaveClipHolders::iterator
 
using Pair = std::pair< Iterator, Iterator >
 
using Stack = std::vector< Pair >
 

Private Member Functions

void push (WaveClipHolders &clips)
 

Private Attributes

Stack mStack
 

Friends

bool operator== (const AllClipsIterator &a, const AllClipsIterator &b)
 
bool operator!= (const AllClipsIterator &a, const AllClipsIterator &b)
 

Additional Inherited Members

- Public Types inherited from ValueIterator< WaveClip * >
using iterator_category = std::forward_iterator_tag
 
using value_type = WaveClip *
 
using difference_type = ptrdiff_t
 
using pointer = void
 
using reference = const WaveClip *
 

Detailed Description

Definition at line 377 of file WaveTrack.h.

Member Typedef Documentation

◆ Iterator

using WaveTrack::AllClipsIterator::Iterator = WaveClipHolders::iterator
private

Definition at line 413 of file WaveTrack.h.

◆ Pair

using WaveTrack::AllClipsIterator::Pair = std::pair< Iterator, Iterator >
private

Definition at line 414 of file WaveTrack.h.

◆ Stack

using WaveTrack::AllClipsIterator::Stack = std::vector< Pair >
private

Definition at line 415 of file WaveTrack.h.

Constructor & Destructor Documentation

◆ AllClipsIterator() [1/2]

WaveTrack::AllClipsIterator::AllClipsIterator ( )
inline

Definition at line 382 of file WaveTrack.h.

382 {}

◆ AllClipsIterator() [2/2]

WaveTrack::AllClipsIterator::AllClipsIterator ( WaveTrack track)
inlineexplicit

Definition at line 385 of file WaveTrack.h.

386  {
387  push( track.mClips );
388  }

References WaveTrack::mClips.

Member Function Documentation

◆ operator*()

WaveClip* WaveTrack::AllClipsIterator::operator* ( ) const
inline

Definition at line 390 of file WaveTrack.h.

391  {
392  if (mStack.empty())
393  return nullptr;
394  else
395  return mStack.back().first->get();
396  }

◆ operator++()

auto WaveTrack::AllClipsIterator::operator++ ( )

Definition at line 2823 of file WaveTrack.cpp.

2824 {
2825  // The unspecified sequence is a post-order, but there is no
2826  // promise whether sister nodes are ordered in time.
2827  if ( !mStack.empty() ) {
2828  auto &pair = mStack.back();
2829  if ( ++pair.first == pair.second ) {
2830  mStack.pop_back();
2831  }
2832  else
2833  push( (*pair.first)->GetCutLines() );
2834  }
2835 
2836  return *this;
2837 }

◆ push()

void WaveTrack::AllClipsIterator::push ( WaveClipHolders clips)
private

Definition at line 2839 of file WaveTrack.cpp.

2840 {
2841  auto pClips = &clips;
2842  while (!pClips->empty()) {
2843  auto first = pClips->begin();
2844  mStack.push_back( Pair( first, pClips->end() ) );
2845  pClips = &(*first)->GetCutLines();
2846  }
2847 }

References mStack.

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const AllClipsIterator a,
const AllClipsIterator b 
)
friend

Definition at line 405 of file WaveTrack.h.

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

◆ operator==

bool operator== ( const AllClipsIterator a,
const AllClipsIterator b 
)
friend

Definition at line 401 of file WaveTrack.h.

403  { return a.mStack.empty() == b.mStack.empty(); }

Member Data Documentation

◆ mStack

Stack WaveTrack::AllClipsIterator::mStack
private

Definition at line 417 of file WaveTrack.h.

Referenced by push().


The documentation for this class was generated from the following files:
WaveTrack::AllClipsIterator::Pair
std::pair< Iterator, Iterator > Pair
Definition: WaveTrack.h:414
WaveTrack::AllClipsIterator::mStack
Stack mStack
Definition: WaveTrack.h:417
WaveTrack::mClips
WaveClipHolders mClips
Definition: WaveTrack.h:586
WaveTrack::AllClipsIterator::push
void push(WaveClipHolders &clips)
Definition: WaveTrack.cpp:2839