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 553 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 556 of file diagram.cpp.

558 {
559 if (fwd) m_it = container.begin();
560 else m_rit = container.rbegin();
561 }
helper class representing an iterator that can iterate forwards or backwards
Definition diagram.cpp:554
C::reverse_iterator m_rit
Definition diagram.cpp:583
C::iterator m_it
Definition diagram.cpp:582

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 571 of file diagram.cpp.

572 {
573 if (m_forward)
574 return m_it==m_container.end();
575 else
576 return m_rit==m_container.rend();
577 }

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 566 of file diagram.cpp.

567 {
568 return m_forward ? *m_it : *m_rit;
569 }

References m_forward, m_it, and m_rit.

◆ operator++()

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

Definition at line 562 of file diagram.cpp.

563 {
564 if (m_forward) ++m_it++; else ++m_rit;
565 }

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 580 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 581 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 582 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 583 of file diagram.cpp.

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


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