Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

QGVector Class Reference

The QGVector class is an internal class for implementing Qt collection classes. More...

#include </home/clem/local/src/opie/qmake/include/qgvector.h>

Inheritance diagram for QGVector:

Inheritance graph
[legend]
Collaboration diagram for QGVector:

Collaboration graph
[legend]
List of all members.

Public Member Functions

QDataStreamread (QDataStream &)
QDataStreamwrite (QDataStream &) const
virtual int compareItems (Item, Item)

Protected Member Functions

 QGVector ()
 QGVector (uint size)
 QGVector (const QGVector &v)
 ~QGVector ()
QGVectoroperator= (const QGVector &v)
bool operator== (const QGVector &v) const
Itemdata () const
uint size () const
uint count () const
bool insert (uint index, Item)
bool remove (uint index)
Item take (uint index)
void clear ()
bool resize (uint newsize)
bool fill (Item, int flen)
void sort ()
int bsearch (Item) const
int findRef (Item, uint index) const
int find (Item, uint index) const
uint containsRef (Item) const
uint contains (Item) const
Item at (uint index) const
bool insertExpand (uint index, Item)
void toList (QGList *) const
virtual QDataStreamread (QDataStream &, Item &)
virtual QDataStreamwrite (QDataStream &, Item) const

Static Private Member Functions

static void warningIndexRange (uint)

Private Attributes

Itemvec
uint len
uint numItems

Friends

class QGList

Detailed Description

The QGVector class is an internal class for implementing Qt collection classes.

For internal use only.

QGVector is an internal class that acts as a base class for the QPtrVector collection class.

QGVector has some virtual functions that may be reimplemented in subclasses to customize behavior.

compareItems() compares two collection/vector items. read() reads a collection/vector item from a QDataStream. write() writes a collection/vector item to a QDataStream.

Definition at line 46 of file qgvector.h.


Constructor & Destructor Documentation

QGVector::QGVector  )  [protected]
 

Definition at line 161 of file qgvector.cpp.

References len, numItems, and vec.

QGVector::QGVector uint  size  )  [protected]
 

Definition at line 167 of file qgvector.cpp.

References len, NEW, numItems, and vec.

QGVector::QGVector const QGVector v  )  [protected]
 

Definition at line 180 of file qgvector.cpp.

References i, len, NEW, QPtrCollection::newItem(), numItems, and vec.

QGVector::~QGVector  )  [protected]
 

Definition at line 201 of file qgvector.cpp.

References clear().


Member Function Documentation

Item QGVector::at uint  index  )  const [inline, protected]
 

Reimplemented in QPtrVector< type >, QPtrVector< Lookahead >, QPtrVector< CharClass >, and QPtrVector< State >.

Definition at line 86 of file qgvector.h.

References len.

Referenced by QPtrVector< State >::at(), operator==(), and QPtrVector< State >::operator[]().

int QGVector::bsearch Item   )  const [protected]
 

Definition at line 411 of file qgvector.cpp.

References d, FALSE, len, qWarning(), and TRUE.

Referenced by QPtrVector< State >::bsearch().

void QGVector::clear  )  [protected, virtual]
 

Removes all objects from the collection. The objects will be deleted if auto-delete has been enabled.

See also:
setAutoDelete()

Implements QPtrCollection.

Reimplemented in QPtrVector< type >, QPtrVector< Lookahead >, QPtrVector< CharClass >, and QPtrVector< State >.

Definition at line 286 of file qgvector.cpp.

References DELETE, QPtrCollection::deleteItem(), i, len, numItems, and vec.

Referenced by QPtrVector< State >::clear(), operator=(), read(), and ~QGVector().

int QGVector::compareItems Item  d1,
Item  d2
[virtual]
 

This virtual function compares two list items.

Returns:

  • 0 if d1 == d2
  • non-zero if d1 != d2

This function returns int rather than bool so that reimplementations can return one of three values and use it to sort by:

  • 0 if d1 == d2
  • > 0 (positive integer) if d1 > d2
  • < 0 (negative integer) if d1 < d2

The QPtrVector::sort() and QPtrVector::bsearch() functions require that compareItems() is implemented as described here.

This function should not modify the vector because some const functions call compareItems().

Definition at line 121 of file qgvector.cpp.

Referenced by cmp_vec(), and operator==().

uint QGVector::contains Item   )  const [protected]
 

Definition at line 491 of file qgvector.cpp.

References d, i, and len.

Referenced by QPtrVector< State >::contains().

uint QGVector::containsRef Item   )  const [protected]
 

Definition at line 481 of file qgvector.cpp.

References d, i, and len.

Referenced by QPtrVector< State >::containsRef().

uint QGVector::count  )  const [inline, protected, virtual]
 

Returns the number of objects in the collection.

Implements QPtrCollection.

Reimplemented in QPtrVector< type >, QPtrVector< Lookahead >, QPtrVector< CharClass >, and QPtrVector< State >.

Definition at line 67 of file qgvector.h.

Referenced by QPtrVector< State >::count(), QPtrVector< State >::isEmpty(), operator==(), sort(), and write().

Item* QGVector::data void   )  const [inline, protected]
 

Reimplemented in QPtrVector< type >, QPtrVector< Lookahead >, QPtrVector< CharClass >, and QPtrVector< State >.

Definition at line 65 of file qgvector.h.

Referenced by QPtrVector< State >::data().

bool QGVector::fill Item  ,
int  flen
[protected]
 

Definition at line 347 of file qgvector.cpp.

References FALSE, i, insert(), len, resize(), and TRUE.

Referenced by QPtrVector< State >::fill().

int QGVector::find Item  ,
uint  index
const [protected]
 

Definition at line 464 of file qgvector.cpp.

References d, i, len, and qWarning().

Referenced by QPtrVector< State >::find().

int QGVector::findRef Item  ,
uint  index
const [protected]
 

Definition at line 449 of file qgvector.cpp.

References d, i, len, and qWarning().

Referenced by QPtrVector< State >::findRef().

bool QGVector::insert uint  index,
Item 
[protected]
 

Definition at line 232 of file qgvector.cpp.

References QPtrCollection::deleteItem(), FALSE, len, QPtrCollection::newItem(), numItems, qWarning(), TRUE, and vec.

Referenced by fill(), QPtrVector< State >::insert(), and insertExpand().

bool QGVector::insertExpand uint  index,
Item 
[protected]
 

Definition at line 503 of file qgvector.cpp.

References FALSE, insert(), len, resize(), and TRUE.

QGVector & QGVector::operator= const QGVector v  )  [protected]
 

Definition at line 206 of file qgvector.cpp.

References clear(), i, len, NEW, QPtrCollection::newItem(), numItems, and vec.

Referenced by QPtrVector< State >::operator=().

bool QGVector::operator== const QGVector v  )  const [protected]
 

Definition at line 578 of file qgvector.cpp.

References at(), compareItems(), count(), FALSE, i, size(), and TRUE.

Referenced by QPtrVector< State >::operator==().

QDataStream & QGVector::read QDataStream s,
Item d
[protected, virtual]
 

Reads a collection/vector item from the stream s and returns a reference to the stream.

The default implementation sets d to 0.

See also:
write()

Definition at line 136 of file qgvector.cpp.

QDataStream & QGVector::read QDataStream  ) 
 

Definition at line 547 of file qgvector.cpp.

References clear(), d, i, resize(), and vec.

Referenced by operator>>().

bool QGVector::remove uint  index  )  [protected]
 

Reimplemented in QPtrVector< type >, QPtrVector< Lookahead >, QPtrVector< CharClass >, and QPtrVector< State >.

Definition at line 255 of file qgvector.cpp.

References QPtrCollection::deleteItem(), FALSE, len, numItems, qWarning(), TRUE, and vec.

Referenced by QPtrVector< State >::remove().

bool QGVector::resize uint  newsize  )  [protected]
 

Reimplemented in QPtrVector< type >, QPtrVector< Lookahead >, QPtrVector< CharClass >, and QPtrVector< State >.

Definition at line 299 of file qgvector.cpp.

References DELETE, QPtrCollection::deleteItem(), FALSE, i, len, NEW, numItems, TRUE, and vec.

Referenced by fill(), insertExpand(), read(), and QPtrVector< State >::resize().

uint QGVector::size  )  const [inline, protected]
 

Reimplemented in QPtrVector< type >, QPtrVector< Lookahead >, QPtrVector< CharClass >, and QPtrVector< State >.

Definition at line 66 of file qgvector.h.

References len.

Referenced by QPtrVector< State >::isNull(), operator==(), QPtrVector< State >::size(), and write().

void QGVector::sort  )  [protected]
 

Reimplemented in QPtrVector< type >, QPtrVector< Lookahead >, QPtrVector< CharClass >, and QPtrVector< State >.

Definition at line 380 of file qgvector.cpp.

References cmp_vec(), count(), end, len, start, and vec.

Referenced by QPtrVector< State >::sort().

QPtrCollection::Item QGVector::take uint  index  )  [protected]
 

Reimplemented in QPtrVector< type >, QPtrVector< Lookahead >, QPtrVector< CharClass >, and QPtrVector< State >.

Definition at line 271 of file qgvector.cpp.

References d, len, numItems, qWarning(), and vec.

Referenced by QPtrVector< State >::take().

void QGVector::toList QGList  )  const [protected]
 

Reimplemented in QPtrVector< type >, QPtrVector< Lookahead >, QPtrVector< CharClass >, and QPtrVector< State >.

Definition at line 513 of file qgvector.cpp.

References i, len, and list.

Referenced by QPtrVector< State >::toList().

void QGVector::warningIndexRange uint   )  [static, private]
 

Definition at line 523 of file qgvector.cpp.

References qWarning().

QDataStream & QGVector::write QDataStream s,
Item 
const [protected, virtual]
 

Writes a collection/vector item to the stream s and returns a reference to the stream.

The default implementation does nothing.

See also:
read()

Definition at line 151 of file qgvector.cpp.

QDataStream & QGVector::write QDataStream  )  const
 

Definition at line 564 of file qgvector.cpp.

References count(), i, size(), and vec.

Referenced by operator<<().


Friends And Related Function Documentation

friend class QGList [friend]
 

Definition at line 48 of file qgvector.h.


Member Data Documentation

uint QGVector::len [private]
 

Definition at line 105 of file qgvector.h.

Referenced by clear(), fill(), insert(), insertExpand(), operator=(), QGVector(), remove(), resize(), sort(), and take().

uint QGVector::numItems [private]
 

Definition at line 106 of file qgvector.h.

Referenced by clear(), insert(), operator=(), QGVector(), remove(), resize(), and take().

Item* QGVector::vec [private]
 

Definition at line 104 of file qgvector.h.

Referenced by clear(), insert(), operator=(), QGVector(), read(), remove(), resize(), sort(), take(), and write().


The documentation for this class was generated from the following files:
Generated on Sat Nov 5 17:47:21 2005 for OPIE by  doxygen 1.4.2