1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
'\" t
.TH QPtrQueue 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
QPtrQueue \- Template class that provides a queue
.SH SYNOPSIS
\fC#include <qptrqueue.h>\fR
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQPtrQueue\fR ()"
.br
.ti -1c
.BI "\fBQPtrQueue\fR ( const QPtrQueue<type> & queue )"
.br
.ti -1c
.BI "\fB~QPtrQueue\fR ()"
.br
.ti -1c
.BI "QPtrQueue<type> & \fBoperator=\fR ( const QPtrQueue<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, QPtrCollection::Item & item )"
.br
.ti -1c
.BI "virtual QDataStream & \fBwrite\fR ( QDataStream & s, QPtrCollection::Item item ) const"
.br
.in -1c
.SH DESCRIPTION
The QPtrQueue class is a template class that provides a queue.
.PP
QValueVector can be used as an STL-compatible alternative to this class.
.PP
A template instance QPtrQueue<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 QPtrCollection classes, current() and remove() are provided; both operate on the head().
.PP
See also QPtrList, QPtrStack, Collection Classes, and Non-GUI Classes.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QPtrQueue::QPtrQueue ()"
Creates an empty queue with autoDelete() set to FALSE.
.SH "QPtrQueue::QPtrQueue ( const QPtrQueue<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 "QPtrQueue::~QPtrQueue ()"
Destroys the queue. Items in the queue are deleted if autoDelete() is TRUE.
.SH "bool QPtrQueue::autoDelete () const"
Returns the setting of the auto-delete option. The default is FALSE.
.PP
See also setAutoDelete().
.SH "void QPtrQueue::clear ()"
Removes all items from the queue, and deletes them if autoDelete() is TRUE.
.PP
See also remove().
.SH "uint QPtrQueue::count () const"
Returns the number of items in the queue.
.PP
See also isEmpty().
.SH "type * QPtrQueue::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 * QPtrQueue::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 QPtrQueue::enqueue ( const type * d )"
Adds item \fId\fR to the tail of the queue.
.PP
See also count() and dequeue().
.SH "type * QPtrQueue::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 QPtrQueue::isEmpty () const"
Returns TRUE if the queue is empty; otherwise returns FALSE.
.PP
See also count(), dequeue(), and head().
.SH "QPtrQueue::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 "QPtrQueue<type> & QPtrQueue::operator= ( const QPtrQueue<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 & QPtrQueue::read ( QDataStream & s, QPtrCollection::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 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.
.PP
The item is deleted if autoDelete() is TRUE.
.PP
See also head(), isEmpty(), and dequeue().
.SH "void QPtrQueue::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 tquite 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 & QPtrQueue::write ( QDataStream & s, QPtrCollection::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/qptrqueue.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 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.
.P
If you find errors in this manual page, please report them to
.BR [email protected] .
Please include the name of the manual page (qptrqueue.3qt) and the Qt
version (3.3.8).
|