---
name: "qgvector"
section: "3qt"
platform: "linux"
package: "qt-doc"
version: "3:2.3.1-22"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/qgvector"
---

# qgvector(3qt)

Internal class for implementing Qt collection classes #include \<qgvector.h\> Inherits QCollection. Inherited by QVector.

## NAME

QGVector - Internal class for implementing Qt collection classes\

`#include <qgvector.h>`

Inherits QCollection.

Inherited by QVector.

### 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**\

## 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.

## SEE ALSO

**http://doc.trolltech.com/qgvector.html** **http://www.trolltech.com/faq/tech.html**

## COPYRIGHT

Copyright 1992-2001 Trolltech AS, http://www.trolltech.com.  See the license file included in the distribution for a complete license statement.

## AUTHOR

Generated automatically from the source code.

## BUGS

If you find a bug in Qt, please report it as described in **http://doc.trolltech.com/bughowto.html**. Good bug reports make our job much simpler. Thank you.

In case of content or formattting problems with this manual page, please report them to **qt-bugs@trolltech.com**. Please include the name of the manual page (qgvector.3qt) and the Qt version (2.3.1).
