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

556 {
557 if (fwd) m_it = container.begin();
558 else m_rit = container.rbegin();
559 }
helper class representing an iterator that can iterate forwards or backwards
Definition diagram.cpp:552
C::reverse_iterator m_rit
Definition diagram.cpp:581
C::iterator m_it
Definition diagram.cpp:580

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

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

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

565 {
566 return m_forward ? *m_it : *m_rit;
567 }

References m_forward, m_it, and m_rit.

◆ operator++()

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

Definition at line 560 of file diagram.cpp.

561 {
562 if (m_forward) ++m_it++; else ++m_rit;
563 }

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 578 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 579 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 580 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 581 of file diagram.cpp.

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


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