Public Member Functions | List of all members
QSortedList< type > Class Template Reference

#include <qsortedlist.h>

Inheritance diagram for QSortedList< type >:
QList< type > QGList

Public Member Functions

 QSortedList ()
 
 QSortedList (const QSortedList< type > &l)
 
 ~QSortedList ()
 
QSortedList< type > & operator= (const QSortedList< type > &l)
 
virtual int compareItems (QCollection::Item s1, QCollection::Item s2)
 
- Public Member Functions inherited from QList< type >
 QList ()
 
 QList (const QList< type > &l)
 
 ~QList ()
 
QList< type > & operator= (const QList< type > &l)
 
bool operator== (const QList< type > &list) const
 
uint count () const
 
bool isEmpty () const
 
bool insert (uint i, const type *d)
 
void inSort (const type *d)
 
void prepend (const type *d)
 
void append (const type *d)
 
bool remove (uint i)
 
bool remove (const type *d)
 
bool removeRef (const type *d)
 
bool removeFirst ()
 
bool removeLast ()
 
typetake (uint i)
 
void clear ()
 
void sort ()
 
int find (const type *d) const
 
int findRef (const type *d) const
 
uint contains (const type *d) const
 
uint containsRef (const type *d) const
 
typeat (uint i) const
 
typegetFirst () const
 
typegetLast () const
 
void setAutoDelete (bool enable)
 

Detailed Description

template<class type>
class QSortedList< type >

Definition at line 46 of file qsortedlist.h.

Constructor & Destructor Documentation

template<class type>
QSortedList< type >::QSortedList ( )
inline

Definition at line 49 of file qsortedlist.h.

49 {}
template<class type>
QSortedList< type >::QSortedList ( const QSortedList< type > &  l)
inline

Definition at line 50 of file qsortedlist.h.

50 : QList<type>(l) {}
static QStrList * l
Definition: config.cpp:1044
Definition: qlist.h:54
template<class type>
QSortedList< type >::~QSortedList ( )
inline

Definition at line 51 of file qsortedlist.h.

51 { clear(); }
void clear()
Definition: qlist.h:82

Member Function Documentation

template<class type>
virtual int QSortedList< type >::compareItems ( QCollection::Item  item1,
QCollection::Item  item2 
)
inlinevirtual

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:

Reimplemented from QList< type >.

Definition at line 55 of file qsortedlist.h.

56  { if ( *((type*)s1) == *((type*)s2) ) return 0; return ( *((type*)s1) < *((type*)s2) ? -1 : 1 ); }
template<class type>
QSortedList<type>& QSortedList< type >::operator= ( const QSortedList< type > &  l)
inline

Definition at line 52 of file qsortedlist.h.

QList< type > & operator=(const QList< type > &l)
Definition: qlist.h:60

The documentation for this class was generated from the following file: