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

#include <qqueue.h>

Inheritance diagram for QQueue< type >:
QGList

Public Member Functions

 QQueue ()
 
 QQueue (const QQueue< type > &q)
 
 ~QQueue ()
 
QQueue< type > & operator= (const QQueue< type > &q)
 
bool autoDelete () const
 
void setAutoDelete (bool del)
 
uint count () const
 
bool isEmpty () const
 
void enqueue (const type *d)
 
typedequeue ()
 
bool remove ()
 
void clear ()
 
typehead () const
 
 operator type * () const
 
typecurrent () const
 

Private Member Functions

void deleteItem (Item d)
 
- Private Member Functions inherited from QGList
QDataStreamread (QDataStream &)
 
QDataStreamwrite (QDataStream &) const
 
 QGList ()
 
 QGList (const QGList &)
 
virtual ~QGList ()
 
QGListoperator= (const QGList &)
 
bool operator== (const QGList &) const
 
void inSort (QCollection::Item)
 
void append (QCollection::Item)
 
bool insertAt (uint index, QCollection::Item)
 
void relinkNode (QLNode *)
 
bool removeNode (QLNode *)
 
bool remove (QCollection::Item=0)
 
bool removeRef (QCollection::Item=0)
 
bool removeFirst ()
 
bool removeLast ()
 
bool removeAt (uint index)
 
QCollection::Item takeNode (QLNode *)
 
QCollection::Item take ()
 
QCollection::Item takeAt (uint index)
 
QCollection::Item takeFirst ()
 
QCollection::Item takeLast ()
 
void sort ()
 
int findRef (QCollection::Item, bool=TRUE)
 
int find (QCollection::Item, bool=TRUE)
 
uint containsRef (QCollection::Item) const
 
uint contains (QCollection::Item) const
 
QCollection::Item at (uint index)
 
int at () const
 
QLNodecurrentNode () const
 
QCollection::Item get () const
 
QCollection::Item cfirst () const
 
QCollection::Item clast () const
 
QCollection::Item first ()
 
QCollection::Item last ()
 
QCollection::Item next ()
 
QCollection::Item prev ()
 
void toVector (QGVector *) const
 
virtual int compareItems (QCollection::Item, QCollection::Item)
 
virtual QDataStreamread (QDataStream &, QCollection::Item &)
 
virtual QDataStreamwrite (QDataStream &, QCollection::Item) const
 
- Private Member Functions inherited from QCollection
bool autoDelete () const
 
void setAutoDelete (bool enable)
 
 QCollection ()
 
 QCollection (const QCollection &)
 
virtual ~QCollection ()
 
virtual Item newItem (Item)
 

Additional Inherited Members

- Private Types inherited from QCollection
typedef void * Item
 
- Private Attributes inherited from QCollection
bool del_item
 

Detailed Description

template<class type>
class QQueue< type >

Definition at line 46 of file qqueue.h.

Constructor & Destructor Documentation

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

Definition at line 49 of file qqueue.h.

49 {}
template<class type>
QQueue< type >::QQueue ( const QQueue< type > &  q)
inline

Definition at line 50 of file qqueue.h.

50 : QGList(q) {}
QGList()
Definition: qglist.cpp:170
template<class type>
QQueue< type >::~QQueue ( )
inline

Definition at line 51 of file qqueue.h.

51 { clear(); }
void clear()
Definition: qqueue.h:61

Member Function Documentation

template<class type>
bool QQueue< type >::autoDelete ( ) const
inline

Definition at line 54 of file qqueue.h.

54 { return QCollection::autoDelete(); }
bool autoDelete() const
Definition: qcollection.h:54
template<class type>
void QQueue< type >::clear ( )
inlinevirtual

Removes all objects from the collection. The objects will be deleted if auto-delete has been enabled.

See also
setAutoDelete()

Reimplemented from QGList.

Definition at line 61 of file qqueue.h.

61 { QGList::clear(); }
void clear()
Definition: qglist.cpp:652
template<class type>
uint QQueue< type >::count ( ) const
inlinevirtual

Returns the number of objects in the collection.

Reimplemented from QGList.

Definition at line 56 of file qqueue.h.

56 { return QGList::count(); }
uint count() const
Definition: qglist.h:150
template<class type>
type* QQueue< type >::current ( ) const
inline

Definition at line 64 of file qqueue.h.

64 { return (type *)QGList::cfirst(); }
QCollection::Item cfirst() const
Definition: qglist.h:188
template<class type>
void QQueue< type >::deleteItem ( Item  d)
inlineprivatevirtual

Virtual function that deletes an item that is about to be removed from the collection.

The default implementation deletes d pointer if and only if auto-delete has been enabled.

This function is always reimplemented in the collection template classes.

Warning
If you reimplement this function you must also reimplement the destructor and call the virtual function clear() from your destructor. This is due to the way virtual functions and destructors work in C++: virtual functions in derived classes cannot be called from a destructor. If you do not do this your deleteItem() function will not be called when the container is destructed.
See also
newItem(), setAutoDelete()

Reimplemented from QCollection.

Definition at line 66 of file qqueue.h.

66 { if ( del_item ) delete (type *)d; }
bool del_item
Definition: qcollection.h:67
template<class type>
type* QQueue< type >::dequeue ( )
inline

Definition at line 59 of file qqueue.h.

59 { return (type *)QGList::takeFirst();}
QCollection::Item takeFirst()
Definition: qglist.cpp:623
template<class type>
void QQueue< type >::enqueue ( const type d)
inline

Definition at line 58 of file qqueue.h.

58 { QGList::append(Item(d)); }
void append(QCollection::Item)
Definition: qglist.cpp:364
void * Item
Definition: qcollection.h:60
template<class type>
type* QQueue< type >::head ( ) const
inline

Definition at line 62 of file qqueue.h.

62 { return (type *)QGList::cfirst(); }
QCollection::Item cfirst() const
Definition: qglist.h:188
template<class type>
bool QQueue< type >::isEmpty ( ) const
inline

Definition at line 57 of file qqueue.h.

57 { return QGList::count() == 0; }
uint count() const
Definition: qglist.h:150
template<class type>
QQueue< type >::operator type * ( ) const
inline

Definition at line 63 of file qqueue.h.

63 { return (type *)QGList::cfirst(); }
QCollection::Item cfirst() const
Definition: qglist.h:188
template<class type>
QQueue<type>& QQueue< type >::operator= ( const QQueue< type > &  q)
inline

Definition at line 52 of file qqueue.h.

53  { return (QQueue<type>&)QGList::operator=(q); }
Definition: qqueue.h:46
QGList & operator=(const QGList &)
Definition: qglist.cpp:222
template<class type>
bool QQueue< type >::remove ( )
inline

Definition at line 60 of file qqueue.h.

60 { return QGList::removeFirst(); }
bool removeFirst()
Definition: qglist.h:155
template<class type>
void QQueue< type >::setAutoDelete ( bool  del)
inline

Definition at line 55 of file qqueue.h.

void setAutoDelete(bool enable)
Definition: qcollection.h:55

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