Audacity  2.2.2
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:

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)
 

Detailed Description

Definition at line 370 of file WaveTrack.h.

Member Typedef Documentation

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

Definition at line 428 of file WaveTrack.h.

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

Definition at line 429 of file WaveTrack.h.

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

Definition at line 430 of file WaveTrack.h.

Constructor & Destructor Documentation

WaveTrack::AllClipsIterator::AllClipsIterator ( )
inline

Definition at line 375 of file WaveTrack.h.

375 {}
WaveTrack::AllClipsIterator::AllClipsIterator ( WaveTrack track)
inlineexplicit

Definition at line 378 of file WaveTrack.h.

References WaveTrack::mClips.

379  {
380  push( track.mClips );
381  }
WaveClipHolders mClips
Definition: WaveTrack.h:611
void push(WaveClipHolders &clips)
Definition: WaveTrack.h:418

Member Function Documentation

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

Definition at line 383 of file WaveTrack.h.

384  {
385  if (mStack.empty())
386  return nullptr;
387  else
388  return mStack.back().first->get();
389  }
AllClipsIterator& WaveTrack::AllClipsIterator::operator++ ( )
inline

Definition at line 391 of file WaveTrack.h.

392  {
393  // The unspecified sequence is a post-order, but there is no
394  // promise whether sister nodes are ordered in time.
395  if ( !mStack.empty() ) {
396  auto &pair = mStack.back();
397  if ( ++pair.first == pair.second ) {
398  mStack.pop_back();
399  }
400  else
401  push( (*pair.first)->GetCutLines() );
402  }
403 
404  return *this;
405  }
void push(WaveClipHolders &clips)
Definition: WaveTrack.h:418
void WaveTrack::AllClipsIterator::push ( WaveClipHolders clips)
inlineprivate

Definition at line 418 of file WaveTrack.h.

419  {
420  auto pClips = &clips;
421  while (!pClips->empty()) {
422  auto first = pClips->begin();
423  mStack.push_back( Pair( first, pClips->end() ) );
424  pClips = &(*first)->GetCutLines();
425  }
426  }
std::pair< Iterator, Iterator > Pair
Definition: WaveTrack.h:429

Friends And Related Function Documentation

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

Definition at line 413 of file WaveTrack.h.

414  { return !( a == b ); }
bool operator== ( const AllClipsIterator a,
const AllClipsIterator b 
)
friend

Definition at line 409 of file WaveTrack.h.

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

Member Data Documentation

Stack WaveTrack::AllClipsIterator::mStack
private

Definition at line 432 of file WaveTrack.h.


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