1QPtrQueue(3qt) QPtrQueue(3qt)
2
3
4
6 QPtrQueue - Template class that provides a queue
7
9 #include <qptrqueue.h>
10
11 Public Members
12 QPtrQueue ()
13 QPtrQueue ( const QPtrQueue<type> & queue )
14 ~QPtrQueue ()
15 QPtrQueue<type> & operator= ( const QPtrQueue<type> & queue )
16 bool autoDelete () const
17 void setAutoDelete ( bool enable )
18 uint count () const
19 bool isEmpty () const
20 void enqueue ( const type * d )
21 type * dequeue ()
22 bool remove ()
23 void clear ()
24 type * head () const
25 operator type * () const
26 type * current () const
27
28 Protected Members
29 virtual QDataStream & read ( QDataStream & s, QPtrCollection::Item &
30 item )
31 virtual QDataStream & write ( QDataStream & s, QPtrCollection::Item
32 item ) const
33
35 The QPtrQueue class is a template class that provides a queue.
36
37 QValueVector can be used as an STL-compatible alternative to this
38 class.
39
40 A template instance QPtrQueue<X> is a queue that operates on pointers
41 to X (X*).
42
43 A queue is a first in, first out structure. Items are added to the tail
44 of the queue with enqueue() and retrieved from the head with dequeue().
45 You can peek at the head item without dequeing it using head().
46
47 You can control the queue's deletion policy with setAutoDelete().
48
49 For compatibility with the QPtrCollection classes, current() and
50 remove() are provided; both operate on the head().
51
52 See also QPtrList, QPtrStack, Collection Classes, and Non-GUI Classes.
53
56 Creates an empty queue with autoDelete() set to FALSE.
57
59 Creates a queue from queue.
60
61 Only the pointers are copied; the items are not. The autoDelete() flag
62 is set to FALSE.
63
65 Destroys the queue. Items in the queue are deleted if autoDelete() is
66 TRUE.
67
69 Returns the setting of the auto-delete option. The default is FALSE.
70
71 See also setAutoDelete().
72
74 Removes all items from the queue, and deletes them if autoDelete() is
75 TRUE.
76
77 See also remove().
78
80 Returns the number of items in the queue.
81
82 See also isEmpty().
83
85 Returns a pointer to the head item in the queue. The queue is not
86 changed. Returns 0 if the queue is empty.
87
88 See also dequeue() and isEmpty().
89
91 Takes the head item from the queue and returns a pointer to it. Returns
92 0 if the queue is empty.
93
94 See also enqueue() and count().
95
97 Adds item d to the tail of the queue.
98
99 See also count() and dequeue().
100
102 Returns a pointer to the head item in the queue. The queue is not
103 changed. Returns 0 if the queue is empty.
104
105 See also dequeue() and isEmpty().
106
108 Returns TRUE if the queue is empty; otherwise returns FALSE.
109
110 See also count(), dequeue(), and head().
111
113 Returns a pointer to the head item in the queue. The queue is not
114 changed. Returns 0 if the queue is empty.
115
116 See also dequeue() and isEmpty().
117
119 Assigns queue to this queue and returns a reference to this queue.
120
121 This queue is first cleared and then each item in queue is enqueued to
122 this queue. Only the pointers are copied.
123
124 Warning: The autoDelete() flag is not modified. If it it TRUE for both
125 queue and this queue, deleting the two lists will cause double-deletion
126 of the items.
127
129 [virtual protected]
130 Reads a queue item, item, from the stream s and returns a reference to
131 the stream.
132
133 The default implementation sets item to 0.
134
135 See also write().
136
138 Removes the head item from the queue, and returns TRUE if there was an
139 item, i.e. the queue wasn't empty; otherwise returns FALSE.
140
141 The item is deleted if autoDelete() is TRUE.
142
143 See also head(), isEmpty(), and dequeue().
144
146 Sets the queue to auto-delete its contents if enable is TRUE and not to
147 delete them if enable is FALSE.
148
149 If auto-deleting is turned on, all the items in a queue are deleted
150 when the queue itself is deleted. This can be quite convenient if the
151 queue has the only pointer to the items.
152
153 The default setting is FALSE, for safety. If you turn it on, be careful
154 about copying the queue: you might find yourself with two queues
155 deleting the same items.
156
157 See also autoDelete().
158
160 const [virtual protected]
161 Writes a queue item, item, to the stream s and returns a reference to
162 the stream.
163
164 The default implementation does nothing.
165
166 See also read().
167
168
170 http://doc.trolltech.com/qptrqueue.html
171 http://www.trolltech.com/faq/tech.html
172
174 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
175 license file included in the distribution for a complete license
176 statement.
177
179 Generated automatically from the source code.
180
182 If you find a bug in Qt, please report it as described in
183 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
184 help you. Thank you.
185
186 The definitive Qt documentation is provided in HTML format; it is
187 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
188 web browser. This man page is provided as a convenience for those users
189 who prefer man pages, although this format is not officially supported
190 by Trolltech.
191
192 If you find errors in this manual page, please report them to qt-
193 bugs@trolltech.com. Please include the name of the manual page
194 (qptrqueue.3qt) and the Qt version (3.3.8).
195
196
197
198Trolltech AS 2 February 2007 QPtrQueue(3qt)