QSubpathBackwardIterator Class Reference

Collaboration diagram for QSubpathBackwardIterator:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 45 of file qstroker.cpp.

Public Member Functions

 QSubpathBackwardIterator (const QDataBuffer< QStrokerOps::Element > *path)
int position () const
bool hasNext () const
QStrokerOps::Element next ()

Private Attributes

const QDataBuffer< QStrokerOps::Element > * m_path
int m_pos


Constructor & Destructor Documentation

QSubpathBackwardIterator::QSubpathBackwardIterator ( const QDataBuffer< QStrokerOps::Element > *  path  )  [inline]

Definition at line 48 of file qstroker.cpp.

00049         : m_path(path), m_pos(path->size() - 1) { }


Member Function Documentation

int QSubpathBackwardIterator::position (  )  const [inline]

Definition at line 51 of file qstroker.cpp.

References m_pos.

00051 { return m_pos; }

bool QSubpathBackwardIterator::hasNext (  )  const [inline]

Definition at line 53 of file qstroker.cpp.

References m_pos.

Referenced by next().

00053 { return m_pos >= 0; }

QStrokerOps::Element QSubpathBackwardIterator::next (  )  [inline]

Definition at line 55 of file qstroker.cpp.

References QDataBuffer< Type >::at(), QPainterPath::CurveToDataElement, QPainterPath::CurveToElement, hasNext(), QPainterPath::LineToElement, m_path, m_pos, QPainterPath::MoveToElement, qWarning(), QDataBuffer< Type >::size(), and QStrokerOps::Element::type.

00056     {
00057         Q_ASSERT(hasNext());
00058 
00059         QStrokerOps::Element ce = m_path->at(m_pos);   // current element
00060 
00061         if (m_pos == m_path->size() - 1) {
00062             --m_pos;
00063             ce.type = QPainterPath::MoveToElement;
00064             return ce;
00065         }
00066 
00067         const QStrokerOps::Element &pe = m_path->at(m_pos + 1); // previous element
00068 
00069         switch (pe.type) {
00070         case QPainterPath::LineToElement:
00071             ce.type = QPainterPath::LineToElement;
00072             break;
00073         case QPainterPath::CurveToDataElement:
00074             // First control point?
00075             if (ce.type == QPainterPath::CurveToElement) {
00076                 ce.type = QPainterPath::CurveToDataElement;
00077             } else { // Second control point then
00078                 ce.type = QPainterPath::CurveToElement;
00079             }
00080             break;
00081         case QPainterPath::CurveToElement:
00082             ce.type = QPainterPath::CurveToDataElement;
00083             break;
00084         default:
00085             qWarning("QSubpathReverseIterator::next: Case %d unhandled", ce.type);
00086             break;
00087         }
00088         --m_pos;
00089 
00090         return ce;
00091     }

Here is the call graph for this function:


Member Data Documentation

const QDataBuffer<QStrokerOps::Element>* QSubpathBackwardIterator::m_path [private]

Definition at line 94 of file qstroker.cpp.

Referenced by next().

int QSubpathBackwardIterator::m_pos [private]

Definition at line 95 of file qstroker.cpp.

Referenced by hasNext(), next(), and position().


The documentation for this class was generated from the following file:
Generated on Thu Mar 15 19:12:14 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1