
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQ3PtrQueue class is a template class that provides a queue.More...
| Header: | #include <Q3PtrQueue> |
| Inherits: | Q3PtrCollection |
| Q3PtrQueue() | |
| Q3PtrQueue(const Q3PtrQueue<type> & queue) | |
| ~Q3PtrQueue() | |
| bool | autoDelete() const |
| type * | current() const |
| type * | dequeue() |
| void | enqueue(const type * d) |
| type * | head() const |
| bool | isEmpty() const |
| bool | remove() |
| void | setAutoDelete(bool enable) |
| operator type *() const | |
| Q3PtrQueue<type> & | operator=(const Q3PtrQueue<type> & queue) |
| virtual QDataStream & | read(QDataStream & s, Q3PtrCollection::Item & item) |
| virtual QDataStream & | write(QDataStream & s, Q3PtrCollection::Item item) const |
TheQ3PtrQueue class is a template class that provides a queue.
Q3ValueVector can be used as an STL-compatible alternative to this class.
A template instanceQ3PtrQueue<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 withenqueue() and retrieved from the head withdequeue(). You can peek at the head item without dequeing it usinghead().
You can control the queue's deletion policy withsetAutoDelete().
For compatibility with theQ3PtrCollection classes,current() andremove() are provided; both operate on thehead().
See alsoQ3PtrList andQ3PtrStack.
Creates an empty queue withautoDelete() set to FALSE.
Creates a queue fromqueue.
Only the pointers are copied; the items are not. TheautoDelete() flag is set to FALSE.
Destroys the queue. Items in the queue are deleted ifautoDelete() is TRUE.
Returns the setting of the auto-delete option. The default is FALSE.
See alsosetAutoDelete().
[virtual]void Q3PtrQueue::clear()Reimplemented fromQ3PtrCollection::clear().
Removes all items from the queue, and deletes them ifautoDelete() is TRUE.
See alsoremove().
[virtual]uint Q3PtrQueue::count() constReimplemented fromQ3PtrCollection::count().
Returns the number of items in the queue.
See alsoisEmpty().
Returns a pointer to the head item in the queue. The queue is not changed. Returns 0 if the queue is empty.
See alsodequeue() andisEmpty().
Takes the head item from the queue and returns a pointer to it. Returns 0 if the queue is empty.
Adds itemd to the tail of the queue.
Returns a pointer to the head item in the queue. The queue is not changed. Returns 0 if the queue is empty.
See alsodequeue() andisEmpty().
Returns TRUE if the queue is empty; otherwise returns FALSE.
See alsocount(),dequeue(), andhead().
[virtual protected]QDataStream & Q3PtrQueue::read(QDataStream & s,Q3PtrCollection::Item & item)Reads a queue item,item, from the streams and returns a reference to the stream.
The default implementation setsitem to 0.
See alsowrite().
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 ifautoDelete() is TRUE.
See alsohead(),isEmpty(), anddequeue().
Sets the queue to auto-delete its contents ifenable is TRUE and not to delete them ifenable 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 alsoautoDelete().
[virtual protected]QDataStream & Q3PtrQueue::write(QDataStream & s,Q3PtrCollection::Item item) constWrites a queue item,item, to the streams and returns a reference to the stream.
The default implementation does nothing.
See alsoread().
Returns a pointer to the head item in the queue. The queue is not changed. Returns 0 if the queue is empty.
See alsodequeue() andisEmpty().
Assignsqueue to this queue and returns a reference to this queue.
This queue is first cleared and then each item inqueue is enqueued to this queue. Only the pointers are copied.
Warning: TheautoDelete() flag is not modified. If it is TRUE for bothqueue and this queue, deleting the two lists will causedouble-deletion of the items.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.