NAMEQPtrQueue - Template class that provides a queue
SYNOPSIS#include <qptrqueue.h> Public Members QPtrQueue () QPtrQueue ( const QPtrQueue<type> & queue ) ~QPtrQueue () QPtrQueue<type> & operator= ( const QPtrQueue<type> & queue ) bool autoDelete () const void setAutoDelete ( bool enable ) uint count () const bool isEmpty () const void enqueue ( const type * d ) type * dequeue () bool remove () void clear () type * head () const operator type * () const type * current () const Protected Members virtual QDataStream & read ( QDataStream & s, QPtrCollection::Item & item ) virtual QDataStream & write ( QDataStream & s, QPtrCollection::Item item ) const
DESCRIPTIONThe QPtrQueue class is a template class that provides a queue. QValueVector can be used as an STL-compatible alternative to this class. A template instance QPtrQueue<X> is a queue that operates on pointers to X (X*). A queue is a first in, first out structure. Items are added to the tail of the queue with enqueue() and retrieved from the head with dequeue(). You can peek at the head item without dequeing it using head(). You can control the queue's deletion policy with setAutoDelete(). For compatibility with the QPtrCollection classes, current() and remove() are provided; both operate on the head(). See also QPtrList, QPtrStack, Collection Classes, and Non-GUI Classes.
MEMBER FUNCTION DOCUMENTATION
QPTRQUEUE::QPTRQUEUE ()Creates an empty queue with autoDelete() set to FALSE.
QPTRQUEUE::QPTRQUEUE ( CONST QPTRQUEUE<TYPE> & QUEUE )Creates a queue from queue. Only the pointers are copied; the items are not. The autoDelete() flag is set to FALSE.
QPTRQUEUE::~QPTRQUEUE ()Destroys the queue. Items in the queue are deleted if autoDelete() is TRUE.
BOOL QPTRQUEUE::AUTODELETE () CONSTReturns the setting of the auto-delete option. The default is FALSE. See also setAutoDelete().
VOID QPTRQUEUE::CLEAR ()Removes all items from the queue, and deletes them if autoDelete() is TRUE. See also remove().
UINT QPTRQUEUE::COUNT () CONSTReturns the number of items in the queue. See also isEmpty().
TYPE * QPTRQUEUE::CURRENT () CONSTReturns a pointer to the head item in the queue. The queue is not changed. Returns 0 if the queue is empty. See also dequeue() and isEmpty().
TYPE * QPTRQUEUE::DEQUEUE ()Takes the head item from the queue and returns a pointer to it. Returns 0 if the queue is empty. See also enqueue() and count().
VOID QPTRQUEUE::ENQUEUE ( CONST TYPE * D )Adds item d to the tail of the queue. See also count() and dequeue().
TYPE * QPTRQUEUE::HEAD () CONSTReturns a pointer to the head item in the queue. The queue is not changed. Returns 0 if the queue is empty. See also dequeue() and isEmpty().
BOOL QPTRQUEUE::ISEMPTY () CONSTReturns TRUE if the queue is empty; otherwise returns FALSE. See also count(), dequeue(), and head().
QPTRQUEUE::OPERATOR TYPE * () CONSTReturns a pointer to the head item in the queue. The queue is not changed. Returns 0 if the queue is empty. See also dequeue() and isEmpty().
QPTRQUEUE<TYPE> & QPTRQUEUE::OPERATOR= ( CONST QPTRQUEUE<TYPE> & QUEUE )Assigns queue to this queue and returns a reference to this queue. This queue is first cleared and then each item in queue is enqueued to this queue. Only the pointers are copied. Warning: The autoDelete() flag is not modified. If it it TRUE for both queue and this queue, deleting the two lists will cause double-deletion of the items.
QDATASTREAM & QPTRQUEUE::READ ( QDATASTREAM & S, QPTRCOLLECTION::ITEM & ITEM )[virtual protected] Reads a queue item, item, from the stream s and returns a reference to the stream. The default implementation sets item to 0. See also write().
BOOL QPTRQUEUE::REMOVE ()Removes the head item from the queue, and returns TRUE if there was an item, i.e. the queue wasn't empty; otherwise returns FALSE. The item is deleted if autoDelete() is TRUE. See also head(), isEmpty(), and dequeue().
VOID QPTRQUEUE::SETAUTODELETE ( BOOL ENABLE )Sets the queue to auto-delete its contents if enable is TRUE and not to delete them if enable is FALSE. If auto-deleting is turned on, all the items in a queue are deleted when the queue itself is deleted. This can be quite convenient if the queue has the only pointer to the items. The default setting is FALSE, for safety. If you turn it on, be careful about copying the queue: you might find yourself with two queues deleting the same items. See also autoDelete().
QDATASTREAM & QPTRQUEUE::WRITE ( QDATASTREAM & S, QPTRCOLLECTION::ITEM ITEM )const [virtual protected] Writes a queue item, item, to the stream s and returns a reference to the stream. The default implementation does nothing. See also read().
SEE ALSO//doc.trolltech.com/qptrqueue.html //www.trolltech.com/faq/tech.html
COPYRIGHTCopyright 1992-2007 Trolltech ASA, //www.trolltech.com. See the license file included in the distribution for a complete license statement.
AUTHORGenerated automatically from the source code.
BUGSIf you find a bug in Qt, please report it as described in //doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you. The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech. If you find errors in this manual page, please report them to qt- firstname.lastname@example.org. Please include the name of the manual page (qptrqueue.3qt) and the Qt version (3.3.8). QPTRQUEUE(3)