You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/doc/man/man3/tqptrqueue.3qt

187 lines
6.5 KiB

'\" t
.TH TQPtrQueue 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
TQPtrQueue \- Template class that provides a queue
.SH SYNOPSIS
\fC#include <tqptrqueue.h>\fR
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBTQPtrQueue\fR ()"
.br
.ti -1c
.BI "\fBTQPtrQueue\fR ( const TQPtrQueue<type> & queue )"
.br
.ti -1c
.BI "\fB~TQPtrQueue\fR ()"
.br
.ti -1c
.BI "TQPtrQueue<type> & \fBoperator=\fR ( const TQPtrQueue<type> & queue )"
.br
.ti -1c
.BI "bool \fBautoDelete\fR () const"
.br
.ti -1c
.BI "void \fBsetAutoDelete\fR ( bool enable )"
.br
.ti -1c
.BI "uint \fBcount\fR () const"
.br
.ti -1c
.BI "bool \fBisEmpty\fR () const"
.br
.ti -1c
.BI "void \fBenqueue\fR ( const type * d )"
.br
.ti -1c
.BI "type * \fBdequeue\fR ()"
.br
.ti -1c
.BI "bool \fBremove\fR ()"
.br
.ti -1c
.BI "void \fBclear\fR ()"
.br
.ti -1c
.BI "type * \fBhead\fR () const"
.br
.ti -1c
.BI "\fBoperator type *\fR () const"
.br
.ti -1c
.BI "type * \fBcurrent\fR () const"
.br
.in -1c
.SS "Protected Members"
.in +1c
.ti -1c
.BI "virtual QDataStream & \fBread\fR ( QDataStream & s, TQPtrCollection::Item & item )"
.br
.ti -1c
.BI "virtual QDataStream & \fBwrite\fR ( QDataStream & s, TQPtrCollection::Item item ) const"
.br
.in -1c
.SH DESCRIPTION
The TQPtrQueue class is a template class that provides a queue.
.PP
TQValueVector can be used as an STL-compatible alternative to this class.
.PP
A template instance TQPtrQueue<X> is a queue that operates on pointers to X (X*).
.PP
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().
.PP
You can control the queue's deletion policy with setAutoDelete().
.PP
For compatibility with the TQPtrCollection classes, current() and remove() are provided; both operate on the head().
.PP
See also TQPtrList, TQPtrStack, Collection Classes, and Non-GUI Classes.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "TQPtrQueue::TQPtrQueue ()"
Creates an empty queue with autoDelete() set to FALSE.
.SH "TQPtrQueue::TQPtrQueue ( const TQPtrQueue<type> & queue )"
Creates a queue from \fIqueue\fR.
.PP
Only the pointers are copied; the items are not. The autoDelete() flag is set to FALSE.
.SH "TQPtrQueue::~TQPtrQueue ()"
Destroys the queue. Items in the queue are deleted if autoDelete() is TRUE.
.SH "bool TQPtrQueue::autoDelete () const"
Returns the setting of the auto-delete option. The default is FALSE.
.PP
See also setAutoDelete().
.SH "void TQPtrQueue::clear ()"
Removes all items from the queue, and deletes them if autoDelete() is TRUE.
.PP
See also remove().
.SH "uint TQPtrQueue::count () const"
Returns the number of items in the queue.
.PP
See also isEmpty().
.SH "type * TQPtrQueue::current () const"
Returns a pointer to the head item in the queue. The queue is not changed. Returns 0 if the queue is empty.
.PP
See also dequeue() and isEmpty().
.SH "type * TQPtrQueue::dequeue ()"
Takes the head item from the queue and returns a pointer to it. Returns 0 if the queue is empty.
.PP
See also enqueue() and count().
.SH "void TQPtrQueue::enqueue ( const type * d )"
Adds item \fId\fR to the tail of the queue.
.PP
See also count() and dequeue().
.SH "type * TQPtrQueue::head () const"
Returns a pointer to the head item in the queue. The queue is not changed. Returns 0 if the queue is empty.
.PP
See also dequeue() and isEmpty().
.SH "bool TQPtrQueue::isEmpty () const"
Returns TRUE if the queue is empty; otherwise returns FALSE.
.PP
See also count(), dequeue(), and head().
.SH "TQPtrQueue::operator type * () const"
Returns a pointer to the head item in the queue. The queue is not changed. Returns 0 if the queue is empty.
.PP
See also dequeue() and isEmpty().
.SH "TQPtrQueue<type> & TQPtrQueue::operator= ( const TQPtrQueue<type> & queue )"
Assigns \fIqueue\fR to this queue and returns a reference to this queue.
.PP
This queue is first cleared and then each item in \fIqueue\fR is enqueued to this queue. Only the pointers are copied.
.PP
\fBWarning:\fR The autoDelete() flag is not modified. If it it TRUE for both \fIqueue\fR and this queue, deleting the two lists will cause \fIdouble-deletion\fR of the items.
.SH "QDataStream & TQPtrQueue::read ( QDataStream & s, TQPtrCollection::Item & item )\fC [virtual protected]\fR"
Reads a queue item, \fIitem\fR, from the stream \fIs\fR and returns a reference to the stream.
.PP
The default implementation sets \fIitem\fR to 0.
.PP
See also write().
.SH "bool TQPtrQueue::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.
.PP
The item is deleted if autoDelete() is TRUE.
.PP
See also head(), isEmpty(), and dequeue().
.SH "void TQPtrQueue::setAutoDelete ( bool enable )"
Sets the queue to auto-delete its contents if \fIenable\fR is TRUE and not to delete them if \fIenable\fR is FALSE.
.PP
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.
.PP
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.
.PP
See also autoDelete().
.SH "QDataStream & TQPtrQueue::write ( QDataStream & s, TQPtrCollection::Item item ) const\fC [virtual protected]\fR"
Writes a queue item, \fIitem\fR, to the stream \fIs\fR and returns a reference to the stream.
.PP
The default implementation does nothing.
.PP
See also read().
.SH "SEE ALSO"
.BR http://doc.trolltech.com/tqptrqueue.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive TQt documentation is provided in HTML format; it is
located at $TQTDIR/doc/html and can be read using TQt 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.
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (tqptrqueue.3qt) and the Qt
version (3.3.8).