QGList Class Reference
The QGList class is an internal class for implementing Qt collection classes.
More...
#include <qglist.h>
Inherits QCollection.
List of all member functions.
Protected Members
- bool operator== ( const QGList & list ) const
- void sort ()
- virtual int compareItems ( QCollection::Item item1, QCollection::Item item2 )
- virtual QDataStream & read ( QDataStream & s, QCollection::Item & item )
- virtual QDataStream & write ( QDataStream & s, QCollection::Item ) 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
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:
bool QGList::operator== ( const QGList & list ) const [protected]
Compares this list with list. Retruns TRUE if the lists
contain the same data, else FALSE.
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::sort () [protected]
Sorts the list by the result of the virtual compareItems() function.
The Heap-Sort algorithm is used for sorting. It sorts n items with
O(n*log n) compares. This is the asymptotic optimal solution of the
sorting problem.
Writes a collection/list item to the stream s and returns a reference
to the stream.
The default implementation does nothing.
See also read().
This file is part of the Qtopia platform,
copyright © 1995-2005
Trolltech, all rights reserved.
| Copyright © 2005 Trolltech
| Trademarks
| Qtopia version 2.2.0
|