| Classes - Annotated - Tree - Functions - Home - Structure

# QGVector Class Reference

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

`#include <qgvector.h>`

Inherits QCollection.

Inherited by QVector.

List of all member functions.

## Public Members

- QDataStream& read ( QDataStream & ) (internal)
- QDataStream& write ( QDataStream & ) const (internal)
- virtual int compareItems ( Item, Item )

## Protected Members

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

## Detailed Description

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

QGVector is a strictly internal class that acts as a base class for the QVector 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.

## Member Function Documentation

### Item QGVector::at ( uint index ) const `[protected]`

For internal use only.

### int QGVector::compareItems ( Item d1, Item d2 ) `[virtual]`

This virtual function compares two list items.

Returns:

- 0 if item1 == item2
- non-zero if item1 != item2

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

- 0 if item1 == item2
- > 0 (positive integer) if item1 > item2
- < 0 (negative integer) if item1 < item2

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

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

### uint QGVector::count () const `[virtual protected]`

For internal use only.

Reimplemented from QCollection.

### Item * QGVector::data () const `[protected]`

For internal use only.

### QDataStream & QGVector::read ( QDataStream & s, Item & d ) `[virtual protected]`

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

The default implementation sets item to 0.

See also write().

### uint QGVector::size () const `[protected]`

For internal use only.

### QDataStream & QGVector::write ( QDataStream & s, Item ) const `[virtual protected]`

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

The default implementation does nothing.

See also read().

### QGVector::QGVector () `[protected]`

For internal use only.

### QGVector::QGVector ( const QGVector & a ) `[protected]`

For internal use only.

### QGVector::QGVector ( uint size ) `[protected]`

For internal use only.

### QGVector::~QGVector () `[protected]`

For internal use only.

### int QGVector::bsearch ( Item d ) const `[protected]`

For internal use only.

### void QGVector::clear () `[virtual protected]`

For internal use only.

Reimplemented from QCollection.

### uint QGVector::contains ( Item d ) const `[protected]`

For internal use only.

### uint QGVector::containsRef ( Item d ) const `[protected]`

For internal use only.

### bool QGVector::fill ( Item d, int flen ) `[protected]`

For internal use only.

### int QGVector::find ( Item d, uint index ) const `[protected]`

For internal use only.

### int QGVector::findRef ( Item d, uint index ) const `[protected]`

For internal use only.

### bool QGVector::insert ( uint index, Item d ) `[protected]`

For internal use only.

### bool QGVector::insertExpand ( uint index, Item d ) `[protected]`

For internal use only.

### QGVector& QGVector::operator= ( const QGVector & v ) `[protected]`

For internal use only.

### QDataStream & QGVector::read ( QDataStream & s )

For internal use only.

### bool QGVector::remove ( uint index ) `[protected]`

For internal use only.

### bool QGVector::resize ( uint newsize ) `[protected]`

For internal use only.

### void QGVector::sort () `[protected]`

For internal use only.

### void QGVector::toList ( QGList * list ) const `[protected]`

For internal use only.

### QDataStream & QGVector::write ( QDataStream & s ) const

For internal use only.

Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):

This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.