QDataBuffer< Type > Class Template Reference

#include <qdatabuffer_p.h>

Inheritance diagram for QDataBuffer< Type >:

Inheritance graph
[legend]
Collaboration diagram for QDataBuffer< Type >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<typename Type>
class QDataBuffer< Type >

Definition at line 40 of file qdatabuffer_p.h.

Public Member Functions

 QDataBuffer (int res=64)
 ~QDataBuffer ()
void reset ()
bool isEmpty () const
int size () const
Typedata () const
const Typeat (int i) const
const Typelast () const
const Typefirst () const
void add (const Type &t)
QDataBufferoperator<< (const Type &t)

Private Attributes

int capacity
int siz
Typebuffer


Constructor & Destructor Documentation

template<typename Type>
QDataBuffer< Type >::QDataBuffer ( int  res = 64  )  [inline]

Definition at line 43 of file qdatabuffer_p.h.

00044     {
00045         capacity = res;
00046         buffer = (Type*) qMalloc(capacity * sizeof(Type));
00047         siz = 0;
00048     }

template<typename Type>
QDataBuffer< Type >::~QDataBuffer (  )  [inline]

Definition at line 50 of file qdatabuffer_p.h.

00051     {
00052         qFree(buffer);
00053     }


Member Function Documentation

template<typename Type>
void QDataBuffer< Type >::reset (  )  [inline]

Definition at line 55 of file qdatabuffer_p.h.

Referenced by QFTOutlineMapper::beginOutline(), QOpenGLPaintEnginePrivate::beginPath(), QPolygonClipper< QRasterFloatPoint, QRasterFloatPoint, qreal >::clipPolygon(), and qt_painterpath_split().

00055 { siz = 0; }

template<typename Type>
bool QDataBuffer< Type >::isEmpty (  )  const [inline]

Definition at line 57 of file qdatabuffer_p.h.

Referenced by QDataBuffer< QStrokerOps::Element >::first(), and QDataBuffer< QStrokerOps::Element >::last().

00057 { return siz==0; }

template<typename Type>
int QDataBuffer< Type >::size (  )  const [inline]

Definition at line 59 of file qdatabuffer_p.h.

Referenced by QPolygonClipper< QRasterFloatPoint, QRasterFloatPoint, qreal >::clipPolygon(), QFTOutlineMapper::closeSubpath(), QFTOutlineMapper::convertElements(), QOpenGLPaintEnginePrivate::curveTo(), QFTOutlineMapper::endOutline(), QSubpathForwardIterator::hasNext(), QSubpathFlatIterator::hasNext(), QOpenGLPaintEnginePrivate::lineTo(), QFTOutlineMapper::moveTo(), QSubpathBackwardIterator::next(), and qt_painterpath_split().

00059 { return siz; }

template<typename Type>
Type* QDataBuffer< Type >::data (  )  const [inline]

Definition at line 60 of file qdatabuffer_p.h.

Referenced by QPolygonClipper< QRasterFloatPoint, QRasterFloatPoint, qreal >::clipPolygon(), QFTOutlineMapper::convertElements(), QFTOutlineMapper::endOutline(), QOpenGLPaintEnginePrivate::lineTo(), and qt_painterpath_split().

00060 { return buffer; }

template<typename Type>
const Type& QDataBuffer< Type >::at ( int  i  )  const [inline]

Definition at line 62 of file qdatabuffer_p.h.

Referenced by QPolygonClipper< QRasterFloatPoint, QRasterFloatPoint, qreal >::clipPolygon(), QFTOutlineMapper::closeSubpath(), QOpenGLPaintEnginePrivate::curveTo(), QFTOutlineMapper::endOutline(), QSubpathBackwardIterator::next(), QSubpathForwardIterator::next(), QSubpathFlatIterator::next(), and qt_painterpath_split().

00062 { Q_ASSERT(i >= 0 && i < siz); return buffer[i]; }

template<typename Type>
const Type& QDataBuffer< Type >::last (  )  const [inline]

Definition at line 63 of file qdatabuffer_p.h.

00063 { Q_ASSERT(!isEmpty()); return buffer[siz-1]; }

template<typename Type>
const Type& QDataBuffer< Type >::first (  )  const [inline]

Definition at line 64 of file qdatabuffer_p.h.

00064 { Q_ASSERT(!isEmpty()); return buffer[0]; }

template<typename Type>
void QDataBuffer< Type >::add ( const Type t  )  [inline]

Definition at line 66 of file qdatabuffer_p.h.

Referenced by QPolygonClipper< QRasterFloatPoint, QRasterFloatPoint, qreal >::clipPolygon(), QFTOutlineMapper::lineTo(), QOpenGLPaintEnginePrivate::lineTo(), QDataBuffer< QStrokerOps::Element >::operator<<(), and qt_painterpath_split().

00066                                    {
00067         if (siz >= capacity) {
00068             capacity *= 2;
00069             buffer = (Type*) qRealloc(buffer, capacity * sizeof(Type));
00070         }
00071         buffer[siz] = t;
00072         ++siz;
00073     }

template<typename Type>
QDataBuffer& QDataBuffer< Type >::operator<< ( const Type t  )  [inline]

Definition at line 75 of file qdatabuffer_p.h.

00075 { add(t); return *this; }


Member Data Documentation

template<typename Type>
int QDataBuffer< Type >::capacity [private]

Definition at line 78 of file qdatabuffer_p.h.

Referenced by QDataBuffer< QStrokerOps::Element >::add(), and QDataBuffer< QStrokerOps::Element >::QDataBuffer().

template<typename Type>
int QDataBuffer< Type >::siz [private]

Definition at line 79 of file qdatabuffer_p.h.

Referenced by QDataBuffer< QStrokerOps::Element >::add(), QDataBuffer< QStrokerOps::Element >::at(), QDataBuffer< QStrokerOps::Element >::isEmpty(), QDataBuffer< QStrokerOps::Element >::last(), QDataBuffer< QStrokerOps::Element >::QDataBuffer(), QDataBuffer< QStrokerOps::Element >::reset(), and QDataBuffer< QStrokerOps::Element >::size().

template<typename Type>
Type* QDataBuffer< Type >::buffer [private]

Definition at line 80 of file qdatabuffer_p.h.

Referenced by QDataBuffer< QStrokerOps::Element >::add(), QDataBuffer< QStrokerOps::Element >::at(), QDataBuffer< QStrokerOps::Element >::data(), QDataBuffer< QStrokerOps::Element >::first(), QDataBuffer< QStrokerOps::Element >::last(), QDataBuffer< QStrokerOps::Element >::QDataBuffer(), and QDataBuffer< QStrokerOps::Element >::~QDataBuffer().


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