Qt Toolkit - QGList Class

# QGList Class Reference

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

`#include <qglist.h>`

Inherits QCollection.

Inherited by QList, QQueue and QStack.

List of all member functions.

## Public Members

- virtual uint count () const
- QDataStream& read ( QDataStream & )
- QDataStream& write ( QDataStream & ) const

## Protected Members

- QGList ()
- QGList ( const QGList & )
- ~QGList ()
- QGList& operator= ( const QGList & )
- void inSort ( GCI )
- void append ( GCI )
- bool insertAt ( uint index, GCI )
- void relinkNode ( QLNode * )
- bool removeNode ( QLNode * )
- bool remove ( GCI = 0 )
- bool removeRef ( GCI = 0 )
- bool removeFirst ()
- bool removeLast ()
- bool removeAt ( uint index )
- GCI takeNode ( QLNode * )
- GCI take ()
- GCI takeAt ( uint index )
- GCI takeFirst ()
- GCI takeLast ()
- virtual void clear ()
- int findRef ( GCI, bool = TRUE )
- int find ( GCI, bool = TRUE )
- uint containsRef ( GCI ) const
- uint contains ( GCI ) const
- GCI at ( uint index )
- int at () const
- QLNode* currentNode () const
- GCI get () const
- GCI cfirst () const
- GCI clast () const
- GCI first ()
- GCI last ()
- GCI next ()
- GCI prev ()
- void toVector ( QGVector * ) const
- virtual int compareItems ( GCI, GCI )
- virtual QDataStream& read ( QDataStream &, GCI & )
- virtual QDataStream& write ( QDataStream &, GCI ) const

## Detailed Description

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

QGList is a strictly internal class that acts as a base class for several collection classes; QList, QQueue and QStack.

QGList has some virtual functions that can be reimplemented to customize the subclasses.

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

Normally, you do not have to reimplement any of these functions. If you still want to reimplement them, see the QStrList class (qstrlist.h), which is a good example.

## Member Function Documentation

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

For internal use only.

### QGList::QGList ( const QGList & list ) `[protected]`

For internal use only.

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

For internal use only.

### void QGList::append ( GCI d ) `[protected]`

For internal use only.

### GCI QGList::at ( uint index ) `[protected]`

For internal use only.

### int QGList::at () const `[protected]`

For internal use only.

### GCI QGList::cfirst () const `[protected]`

For internal use only.

### GCI QGList::clast () const `[protected]`

For internal use only.

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

For internal use only.

Reimplemented from QCollection.

### int QGList::compareItems ( GCI item1, GCI item2 ) `[virtual protected]`

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 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 QList::inSort() function requires that compareItems() is implemented as described here.

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

The default implementation compares the pointers:

### uint QGList::contains ( GCI d ) const `[protected]`

For internal use only.

### uint QGList::containsRef ( GCI d ) const `[protected]`

For internal use only.

### uint QGList::count () const `[virtual]`

For internal use only.

Reimplemented from QCollection.

### QLNode * QGList::currentNode () const `[protected]`

For internal use only.

### int QGList::find ( GCI d, bool fromStart = TRUE ) `[protected]`

For internal use only.

### int QGList::findRef ( GCI d, bool fromStart = TRUE ) `[protected]`

For internal use only.

### GCI QGList::first () `[protected]`

For internal use only.

### GCI QGList::get () const `[protected]`

For internal use only.

### void QGList::inSort ( GCI d ) `[protected]`

For internal use only.

### bool QGList::insertAt ( uint index, GCI d ) `[protected]`

For internal use only.

### GCI QGList::last () `[protected]`

For internal use only.

### GCI QGList::next () `[protected]`

For internal use only.

### QGList& QGList::operator= ( const QGList & list ) `[protected]`

For internal use only.

### GCI QGList::prev () `[protected]`

For internal use only.

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

For internal use only.

### QDataStream & QGList::read ( QDataStream & s, GCI & item ) `[virtual protected]`

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

The default implementation sets item to 0.

See also: write().

### void QGList::relinkNode ( QLNode * n ) `[protected]`

For internal use only.

### bool QGList::remove ( GCI d = 0 ) `[protected]`

For internal use only.

### bool QGList::removeAt ( uint index ) `[protected]`

For internal use only.

### bool QGList::removeFirst () `[protected]`

For internal use only.

### bool QGList::removeLast () `[protected]`

For internal use only.

### bool QGList::removeNode ( QLNode * n ) `[protected]`

For internal use only.

### bool QGList::removeRef ( GCI d = 0 ) `[protected]`

For internal use only.

### GCI QGList::take () `[protected]`

For internal use only.

### GCI QGList::takeAt ( uint index ) `[protected]`

For internal use only.

### GCI QGList::takeFirst () `[protected]`

For internal use only.

### GCI QGList::takeLast () `[protected]`

For internal use only.

### GCI QGList::takeNode ( QLNode * n ) `[protected]`

For internal use only.

### void QGList::toVector ( QGVector * vector ) const `[protected]`

For internal use only.

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

For internal use only.

### QDataStream & QGList::write ( QDataStream & s, GCI ) const `[virtual protected]`

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

The default implementation does nothing.

See also: read().

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

This file is part of the Qt toolkit, copyright © 1995-99 Troll Tech, all rights reserved.

It was generated from the following files:

- qglist.h: 1998/08/25
- qglist.cpp: 1998/07/03