![]() |
| ||
Classes - Annotated - Tree - Functions - Home - Structure |
The QPtrQueue class is a template class that provides a queue. More...
#include <qptrqueue.h>
QPtrQueue is implemented as a template class. A template instance QPtrQueue<X> is a queue that operates on pointers to 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().
QPtrQueue also has some functions for compatibility with the other collection classes, such as isEmpty(), count(), clear(), current(), and remove(). current() and remove() both operate on the head().
See also collection and classes.
Only the pointers are copied - the items are not. The autoDelete() flag is set to FALSE.
Destroys the queue. Items in the queue are deleted if autoDelete() is TRUE.
Returns the setting of the auto-delete option. The default is FALSE.
See also setAutoDelete().
Removes all items from the queue, and deletes them if autoDelete() is TRUE.
See also remove().
Returns the number of items in the queue.
See also isEmpty().
Returns a reference to the head item in the queue. The queue is not changed.
See also dequeue() and isEmpty().
Takes the head item from the queue and returns a pointer to it.
See also enqueue() and count().
Adds d to the tail of the queue.
See also count() and dequeue().
Returns a reference to the head item in the queue. The queue is not changed.
See also dequeue() and isEmpty().
Returns TRUE if the queue is empty and FALSE if there is at least one item enqueued.
See also count(), dequeue() and head().
Returns a reference to the head item in the queue. The queue is not changed.
See also dequeue() and isEmpty().
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.
Note that the autoDelete() flag is not modified. If it it TRUE for both queue and this queue, deleting the two lists cause double-deletion of the items.
Removes the head item from the queue, and returns TRUE if there was an item or FALSE if the queue was empty.
The item is deleted if autoDelete() is TRUE.
See also head(), isEmpty() and dequeue().
Sets the queue to auto-delete its contents if enable is TRUE and to never 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().
Search the documentation, FAQ, qt-interest archive and more (uses
www.trolltech.com):
This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.
Copyright © 2000 Trolltech | Trademarks | Qt version main-beta1
|