Doxygen
Loading...
Searching...
No Matches
DualDirIterator< C, I > Class Template Reference

helper class representing an iterator that can iterate forwards or backwards More...

Public Member Functions

 DualDirIterator (C &container, bool fwd)
 
void operator++ ()
 
I & operator* ()
 
bool atEnd ()
 

Private Attributes

C & m_container
 
bool m_forward
 
C::iterator m_it
 
C::reverse_iterator m_rit
 

Detailed Description

template<class C, class I>
class DualDirIterator< C, I >

helper class representing an iterator that can iterate forwards or backwards

Definition at line 559 of file diagram.cpp.

Constructor & Destructor Documentation

◆ DualDirIterator()

template<class C, class I>
DualDirIterator< C, I >::DualDirIterator ( C & container,
bool fwd )
inline

Definition at line 562 of file diagram.cpp.

564 {
565 if (fwd) m_it = container.begin();
566 else m_rit = container.rbegin();
567 }
helper class representing an iterator that can iterate forwards or backwards
Definition diagram.cpp:560
C::reverse_iterator m_rit
Definition diagram.cpp:589
C::iterator m_it
Definition diagram.cpp:588

References m_container, m_forward, m_it, and m_rit.

Member Function Documentation

◆ atEnd()

template<class C, class I>
bool DualDirIterator< C, I >::atEnd ( )
inline

Definition at line 577 of file diagram.cpp.

578 {
579 if (m_forward)
580 return m_it==m_container.end();
581 else
582 return m_rit==m_container.rend();
583 }

References m_container, m_forward, m_it, and m_rit.

Referenced by TreeDiagram::drawBoxes().

◆ operator*()

template<class C, class I>
I & DualDirIterator< C, I >::operator* ( )
inline

Definition at line 572 of file diagram.cpp.

573 {
574 return m_forward ? *m_it : *m_rit;
575 }

References m_forward, m_it, and m_rit.

◆ operator++()

template<class C, class I>
void DualDirIterator< C, I >::operator++ ( )
inline

Definition at line 568 of file diagram.cpp.

569 {
570 if (m_forward) ++m_it++; else ++m_rit;
571 }

References m_forward, m_it, and m_rit.

Member Data Documentation

◆ m_container

template<class C, class I>
C& DualDirIterator< C, I >::m_container
private

Definition at line 586 of file diagram.cpp.

Referenced by atEnd(), and DualDirIterator().

◆ m_forward

template<class C, class I>
bool DualDirIterator< C, I >::m_forward
private

Definition at line 587 of file diagram.cpp.

Referenced by atEnd(), DualDirIterator(), operator*(), and operator++().

◆ m_it

template<class C, class I>
C::iterator DualDirIterator< C, I >::m_it
private

Definition at line 588 of file diagram.cpp.

Referenced by atEnd(), DualDirIterator(), operator*(), and operator++().

◆ m_rit

template<class C, class I>
C::reverse_iterator DualDirIterator< C, I >::m_rit
private

Definition at line 589 of file diagram.cpp.

Referenced by atEnd(), DualDirIterator(), operator*(), and operator++().


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