[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/doc/qptrqueue.doc:37 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QPtrQueue Class</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QPtrQueue Class Reference</h1>
|
---|
| 33 |
|
---|
| 34 | <p>The QPtrQueue class is a template class that provides a queue.
|
---|
| 35 | <a href="#details">More...</a>
|
---|
| 36 | <p><tt>#include <<a href="qptrqueue-h.html">qptrqueue.h</a>></tt>
|
---|
| 37 | <p><a href="qptrqueue-members.html">List of all member functions.</a>
|
---|
| 38 | <h2>Public Members</h2>
|
---|
| 39 | <ul>
|
---|
| 40 | <li class=fn><a href="#QPtrQueue"><b>QPtrQueue</b></a> ()</li>
|
---|
| 41 | <li class=fn><a href="#QPtrQueue-2"><b>QPtrQueue</b></a> ( const QPtrQueue<type> & queue )</li>
|
---|
| 42 | <li class=fn><a href="#~QPtrQueue"><b>~QPtrQueue</b></a> ()</li>
|
---|
| 43 | <li class=fn>QPtrQueue<type> & <a href="#operator-eq"><b>operator=</b></a> ( const QPtrQueue<type> & queue )</li>
|
---|
| 44 | <li class=fn>bool <a href="#autoDelete"><b>autoDelete</b></a> () const</li>
|
---|
| 45 | <li class=fn>void <a href="#setAutoDelete"><b>setAutoDelete</b></a> ( bool enable )</li>
|
---|
| 46 | <li class=fn>uint <a href="#count"><b>count</b></a> () const</li>
|
---|
| 47 | <li class=fn>bool <a href="#isEmpty"><b>isEmpty</b></a> () const</li>
|
---|
| 48 | <li class=fn>void <a href="#enqueue"><b>enqueue</b></a> ( const type * d )</li>
|
---|
| 49 | <li class=fn>type * <a href="#dequeue"><b>dequeue</b></a> ()</li>
|
---|
| 50 | <li class=fn>bool <a href="#remove"><b>remove</b></a> ()</li>
|
---|
| 51 | <li class=fn>void <a href="#clear"><b>clear</b></a> ()</li>
|
---|
| 52 | <li class=fn>type * <a href="#head"><b>head</b></a> () const</li>
|
---|
| 53 | <li class=fn><a href="#operator-type-*"><b>operator type *</b></a> () const</li>
|
---|
| 54 | <li class=fn>type * <a href="#current"><b>current</b></a> () const</li>
|
---|
| 55 | </ul>
|
---|
| 56 | <h2>Protected Members</h2>
|
---|
| 57 | <ul>
|
---|
| 58 | <li class=fn>virtual QDataStream & <a href="#read"><b>read</b></a> ( QDataStream & s, QPtrCollection::Item & item )</li>
|
---|
| 59 | <li class=fn>virtual QDataStream & <a href="#write"><b>write</b></a> ( QDataStream & s, QPtrCollection::Item item ) const</li>
|
---|
| 60 | </ul>
|
---|
| 61 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 62 |
|
---|
| 63 |
|
---|
| 64 | The QPtrQueue class is a template class that provides a queue.
|
---|
| 65 | <p>
|
---|
| 66 |
|
---|
| 67 | <p> <a href="qvaluevector.html">QValueVector</a> can be used as an STL-compatible alternative to this
|
---|
| 68 | class.
|
---|
| 69 | <p> A template instance QPtrQueue<X> is a queue that operates on
|
---|
| 70 | pointers to X (X*).
|
---|
| 71 | <p> A queue is a first in, first out structure. Items are added to the
|
---|
| 72 | tail of the queue with <a href="#enqueue">enqueue</a>() and retrieved from the head with
|
---|
| 73 | <a href="#dequeue">dequeue</a>(). You can peek at the head item without dequeing it using
|
---|
| 74 | <a href="#head">head</a>().
|
---|
| 75 | <p> You can control the queue's deletion policy with <a href="#setAutoDelete">setAutoDelete</a>().
|
---|
| 76 | <p> For compatibility with the <a href="qptrcollection.html">QPtrCollection</a> classes, <a href="#current">current</a>() and
|
---|
| 77 | <a href="#remove">remove</a>() are provided; both operate on the head().
|
---|
| 78 | <p> <p>See also <a href="qptrlist.html">QPtrList</a>, <a href="qptrstack.html">QPtrStack</a>, <a href="collection.html">Collection Classes</a>, and <a href="tools.html">Non-GUI Classes</a>.
|
---|
| 79 |
|
---|
| 80 | <hr><h2>Member Function Documentation</h2>
|
---|
| 81 | <h3 class=fn><a name="QPtrQueue"></a>QPtrQueue::QPtrQueue ()
|
---|
| 82 | </h3>
|
---|
| 83 |
|
---|
| 84 | <p> Creates an empty queue with <a href="#autoDelete">autoDelete</a>() set to FALSE.
|
---|
| 85 |
|
---|
| 86 | <h3 class=fn><a name="QPtrQueue-2"></a>QPtrQueue::QPtrQueue ( const <a href="qptrqueue.html">QPtrQueue</a><type> & queue )
|
---|
| 87 | </h3>
|
---|
| 88 |
|
---|
| 89 | <p> Creates a queue from <em>queue</em>.
|
---|
| 90 | <p> Only the pointers are copied; the items are not. The <a href="#autoDelete">autoDelete</a>()
|
---|
| 91 | flag is set to FALSE.
|
---|
| 92 |
|
---|
| 93 | <h3 class=fn><a name="~QPtrQueue"></a>QPtrQueue::~QPtrQueue ()
|
---|
| 94 | </h3>
|
---|
| 95 |
|
---|
| 96 | <p> Destroys the queue. Items in the queue are deleted if <a href="#autoDelete">autoDelete</a>()
|
---|
| 97 | is TRUE.
|
---|
| 98 |
|
---|
| 99 | <h3 class=fn>bool <a name="autoDelete"></a>QPtrQueue::autoDelete () const
|
---|
| 100 | </h3>
|
---|
| 101 |
|
---|
| 102 | <p> Returns the setting of the auto-delete option. The default is
|
---|
| 103 | FALSE.
|
---|
| 104 | <p> <p>See also <a href="#setAutoDelete">setAutoDelete</a>().
|
---|
| 105 |
|
---|
| 106 | <h3 class=fn>void <a name="clear"></a>QPtrQueue::clear ()
|
---|
| 107 | </h3>
|
---|
| 108 |
|
---|
| 109 | <p> Removes all items from the queue, and deletes them if <a href="#autoDelete">autoDelete</a>()
|
---|
| 110 | is TRUE.
|
---|
| 111 | <p> <p>See also <a href="#remove">remove</a>().
|
---|
| 112 |
|
---|
| 113 | <h3 class=fn>uint <a name="count"></a>QPtrQueue::count () const
|
---|
| 114 | </h3>
|
---|
| 115 |
|
---|
| 116 | <p> Returns the number of items in the queue.
|
---|
| 117 | <p> <p>See also <a href="#isEmpty">isEmpty</a>().
|
---|
| 118 |
|
---|
| 119 | <h3 class=fn>type * <a name="current"></a>QPtrQueue::current () const
|
---|
| 120 | </h3>
|
---|
| 121 |
|
---|
| 122 | <p> Returns a pointer to the head item in the queue. The queue is not
|
---|
| 123 | changed. Returns 0 if the queue is empty.
|
---|
| 124 | <p> <p>See also <a href="#dequeue">dequeue</a>() and <a href="#isEmpty">isEmpty</a>().
|
---|
| 125 |
|
---|
| 126 | <h3 class=fn>type * <a name="dequeue"></a>QPtrQueue::dequeue ()
|
---|
| 127 | </h3>
|
---|
| 128 |
|
---|
| 129 | <p> Takes the head item from the queue and returns a pointer to it.
|
---|
| 130 | Returns 0 if the queue is empty.
|
---|
| 131 | <p> <p>See also <a href="#enqueue">enqueue</a>() and <a href="#count">count</a>().
|
---|
| 132 |
|
---|
| 133 | <h3 class=fn>void <a name="enqueue"></a>QPtrQueue::enqueue ( const type * d )
|
---|
| 134 | </h3>
|
---|
| 135 |
|
---|
| 136 | <p> Adds item <em>d</em> to the tail of the queue.
|
---|
| 137 | <p> <p>See also <a href="#count">count</a>() and <a href="#dequeue">dequeue</a>().
|
---|
| 138 |
|
---|
| 139 | <h3 class=fn>type * <a name="head"></a>QPtrQueue::head () const
|
---|
| 140 | </h3>
|
---|
| 141 |
|
---|
| 142 | <p> Returns a pointer to the head item in the queue. The queue is not
|
---|
| 143 | changed. Returns 0 if the queue is empty.
|
---|
| 144 | <p> <p>See also <a href="#dequeue">dequeue</a>() and <a href="#isEmpty">isEmpty</a>().
|
---|
| 145 |
|
---|
| 146 | <h3 class=fn>bool <a name="isEmpty"></a>QPtrQueue::isEmpty () const
|
---|
| 147 | </h3>
|
---|
| 148 |
|
---|
| 149 | <p> Returns TRUE if the queue is empty; otherwise returns FALSE.
|
---|
| 150 | <p> <p>See also <a href="#count">count</a>(), <a href="#dequeue">dequeue</a>(), and <a href="#head">head</a>().
|
---|
| 151 |
|
---|
| 152 | <h3 class=fn><a name="operator-type-*"></a>QPtrQueue::operator type * () const
|
---|
| 153 | </h3>
|
---|
| 154 |
|
---|
| 155 | <p> Returns a pointer to the head item in the queue. The queue is not
|
---|
| 156 | changed. Returns 0 if the queue is empty.
|
---|
| 157 | <p> <p>See also <a href="#dequeue">dequeue</a>() and <a href="#isEmpty">isEmpty</a>().
|
---|
| 158 |
|
---|
| 159 | <h3 class=fn><a href="qptrqueue.html">QPtrQueue</a><type> & <a name="operator-eq"></a>QPtrQueue::operator= ( const <a href="qptrqueue.html">QPtrQueue</a><type> & queue )
|
---|
| 160 | </h3>
|
---|
| 161 |
|
---|
| 162 | <p> Assigns <em>queue</em> to this queue and returns a reference to this
|
---|
| 163 | queue.
|
---|
| 164 | <p> This queue is first cleared and then each item in <em>queue</em> is
|
---|
| 165 | enqueued to this queue. Only the pointers are copied.
|
---|
| 166 | <p> <b>Warning:</b> The <a href="#autoDelete">autoDelete</a>() flag is not modified. If it it TRUE for
|
---|
| 167 | both <em>queue</em> and this queue, deleting the two lists will cause <em>double-deletion</em> of the items.
|
---|
| 168 |
|
---|
| 169 | <h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="read"></a>QPtrQueue::read ( <a href="qdatastream.html">QDataStream</a> & s, <a href="qptrcollection.html#Item">QPtrCollection::Item</a> & item )<tt> [virtual protected]</tt>
|
---|
| 170 | </h3>
|
---|
| 171 |
|
---|
| 172 | <p> Reads a queue item, <em>item</em>, from the stream <em>s</em> and returns a
|
---|
| 173 | reference to the stream.
|
---|
| 174 | <p> The default implementation sets <em>item</em> to 0.
|
---|
| 175 | <p> <p>See also <a href="#write">write</a>().
|
---|
| 176 |
|
---|
| 177 | <h3 class=fn>bool <a name="remove"></a>QPtrQueue::remove ()
|
---|
| 178 | </h3>
|
---|
| 179 |
|
---|
| 180 | <p> Removes the head item from the queue, and returns TRUE if there
|
---|
| 181 | was an item, i.e. the queue wasn't empty; otherwise returns FALSE.
|
---|
| 182 | <p> The item is deleted if <a href="#autoDelete">autoDelete</a>() is TRUE.
|
---|
| 183 | <p> <p>See also <a href="#head">head</a>(), <a href="#isEmpty">isEmpty</a>(), and <a href="#dequeue">dequeue</a>().
|
---|
| 184 |
|
---|
| 185 | <h3 class=fn>void <a name="setAutoDelete"></a>QPtrQueue::setAutoDelete ( bool enable )
|
---|
| 186 | </h3>
|
---|
| 187 |
|
---|
| 188 | <p> Sets the queue to auto-delete its contents if <em>enable</em> is TRUE
|
---|
| 189 | and not to delete them if <em>enable</em> is FALSE.
|
---|
| 190 | <p> If auto-deleting is turned on, all the items in a queue are
|
---|
| 191 | deleted when the queue itself is deleted. This can be quite
|
---|
| 192 | convenient if the queue has the only pointer to the items.
|
---|
| 193 | <p> The default setting is FALSE, for safety. If you turn it on, be
|
---|
| 194 | careful about copying the queue: you might find yourself with two
|
---|
| 195 | queues deleting the same items.
|
---|
| 196 | <p> <p>See also <a href="#autoDelete">autoDelete</a>().
|
---|
| 197 |
|
---|
| 198 | <h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="write"></a>QPtrQueue::write ( <a href="qdatastream.html">QDataStream</a> & s, <a href="qptrcollection.html#Item">QPtrCollection::Item</a> item ) const<tt> [virtual protected]</tt>
|
---|
| 199 | </h3>
|
---|
| 200 |
|
---|
| 201 | <p> Writes a queue item, <em>item</em>, to the stream <em>s</em> and returns a
|
---|
| 202 | reference to the stream.
|
---|
| 203 | <p> The default implementation does nothing.
|
---|
| 204 | <p> <p>See also <a href="#read">read</a>().
|
---|
| 205 |
|
---|
| 206 | <!-- eof -->
|
---|
| 207 | <hr><p>
|
---|
| 208 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 209 | Copyright © 1995-2007
|
---|
| 210 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 211 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 212 | <td>Copyright © 2007
|
---|
| 213 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 214 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 215 | </table></div></address></body>
|
---|
| 216 | </html>
|
---|