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/qptrstack.doc:41 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QPtrStack 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>QPtrStack Class Reference</h1>
|
---|
33 |
|
---|
34 | <p>The QPtrStack class is a template class that provides a stack.
|
---|
35 | <a href="#details">More...</a>
|
---|
36 | <p><tt>#include <<a href="qptrstack-h.html">qptrstack.h</a>></tt>
|
---|
37 | <p><a href="qptrstack-members.html">List of all member functions.</a>
|
---|
38 | <h2>Public Members</h2>
|
---|
39 | <ul>
|
---|
40 | <li class=fn><a href="#QPtrStack"><b>QPtrStack</b></a> ()</li>
|
---|
41 | <li class=fn><a href="#QPtrStack-2"><b>QPtrStack</b></a> ( const QPtrStack<type> & s )</li>
|
---|
42 | <li class=fn><a href="#~QPtrStack"><b>~QPtrStack</b></a> ()</li>
|
---|
43 | <li class=fn>QPtrStack<type> & <a href="#operator-eq"><b>operator=</b></a> ( const QPtrStack<type> & s )</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="#push"><b>push</b></a> ( const type * d )</li>
|
---|
49 | <li class=fn>type * <a href="#pop"><b>pop</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="#top"><b>top</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 QPtrStack class is a template class that provides a stack.
|
---|
65 | <p>
|
---|
66 | <p> <a href="qvaluestack.html">QValueStack</a> is an STL-compatible alternative to this class.
|
---|
67 | <p> Define a template instance QPtrStack<X> to create a stack that
|
---|
68 | operates on pointers to X, (X*).
|
---|
69 | <p> A stack is a last in, first out (LIFO) structure. Items are added
|
---|
70 | to the top of the stack with <a href="#push">push</a>() and retrieved from the top
|
---|
71 | with <a href="#pop">pop</a>(). Use <a href="#top">top</a>() to get a reference to the top element
|
---|
72 | without changing the stack.
|
---|
73 | <p> You can control the stack's deletion policy with <a href="#setAutoDelete">setAutoDelete</a>().
|
---|
74 | <p> For compatibility with the <a href="qptrcollection.html">QPtrCollection</a> classes <a href="#current">current</a>() and
|
---|
75 | <a href="#remove">remove</a>() are provided; they both operate on the top().
|
---|
76 | <p> <p>See also <a href="qptrlist.html">QPtrList</a>, <a href="qptrqueue.html">QPtrQueue</a>, and <a href="tools.html">Non-GUI Classes</a>.
|
---|
77 |
|
---|
78 | <hr><h2>Member Function Documentation</h2>
|
---|
79 | <h3 class=fn><a name="QPtrStack"></a>QPtrStack::QPtrStack ()
|
---|
80 | </h3>
|
---|
81 |
|
---|
82 | <p> Creates an empty stack.
|
---|
83 |
|
---|
84 | <h3 class=fn><a name="QPtrStack-2"></a>QPtrStack::QPtrStack ( const <a href="qptrstack.html">QPtrStack</a><type> & s )
|
---|
85 | </h3>
|
---|
86 |
|
---|
87 | <p> Creates a stack by making a <a href="shclass.html#shallow-copy">shallow copy</a> of another stack <em>s</em>.
|
---|
88 |
|
---|
89 | <h3 class=fn><a name="~QPtrStack"></a>QPtrStack::~QPtrStack ()
|
---|
90 | </h3>
|
---|
91 |
|
---|
92 | <p> Destroys the stack. All items will be deleted if <a href="#autoDelete">autoDelete</a>() is
|
---|
93 | TRUE.
|
---|
94 |
|
---|
95 | <h3 class=fn>bool <a name="autoDelete"></a>QPtrStack::autoDelete () const
|
---|
96 | </h3>
|
---|
97 |
|
---|
98 | <p> The same as <a href="qptrcollection.html#autoDelete">QPtrCollection::autoDelete</a>().
|
---|
99 | <p> <p>See also <a href="#setAutoDelete">setAutoDelete</a>().
|
---|
100 |
|
---|
101 | <h3 class=fn>void <a name="clear"></a>QPtrStack::clear ()
|
---|
102 | </h3>
|
---|
103 |
|
---|
104 | <p> Removes all items from the stack, deleting them if <a href="#autoDelete">autoDelete</a>() is
|
---|
105 | TRUE.
|
---|
106 | <p> <p>See also <a href="#remove">remove</a>().
|
---|
107 |
|
---|
108 | <h3 class=fn>uint <a name="count"></a>QPtrStack::count () const
|
---|
109 | </h3>
|
---|
110 |
|
---|
111 | <p> Returns the number of items in the stack.
|
---|
112 | <p> <p>See also <a href="#isEmpty">isEmpty</a>().
|
---|
113 |
|
---|
114 | <h3 class=fn>type * <a name="current"></a>QPtrStack::current () const
|
---|
115 | </h3>
|
---|
116 |
|
---|
117 | <p> Returns a pointer to the top item on the stack (most recently
|
---|
118 | pushed). The stack is not changed. Returns 0 if the stack is
|
---|
119 | empty.
|
---|
120 |
|
---|
121 | <h3 class=fn>bool <a name="isEmpty"></a>QPtrStack::isEmpty () const
|
---|
122 | </h3>
|
---|
123 |
|
---|
124 | <p> Returns TRUE if the stack contains no elements; otherwise returns
|
---|
125 | FALSE.
|
---|
126 |
|
---|
127 | <h3 class=fn><a name="operator-type-*"></a>QPtrStack::operator type * () const
|
---|
128 | </h3>
|
---|
129 |
|
---|
130 | <p> Returns a pointer to the top item on the stack (most recently
|
---|
131 | pushed). The stack is not changed. Returns 0 if the stack is
|
---|
132 | empty.
|
---|
133 |
|
---|
134 | <h3 class=fn><a href="qptrstack.html">QPtrStack</a><type> & <a name="operator-eq"></a>QPtrStack::operator= ( const <a href="qptrstack.html">QPtrStack</a><type> & s )
|
---|
135 | </h3>
|
---|
136 |
|
---|
137 | <p> Sets the contents of this stack by making a <a href="shclass.html#shallow-copy">shallow copy</a> of
|
---|
138 | another stack <em>s</em>. Elements currently in this stack will be
|
---|
139 | deleted if <a href="#autoDelete">autoDelete</a>() is TRUE.
|
---|
140 |
|
---|
141 | <h3 class=fn>type * <a name="pop"></a>QPtrStack::pop ()
|
---|
142 | </h3>
|
---|
143 |
|
---|
144 | <p> Removes the top item from the stack and returns it. The stack must
|
---|
145 | not be empty.
|
---|
146 |
|
---|
147 | <h3 class=fn>void <a name="push"></a>QPtrStack::push ( const type * d )
|
---|
148 | </h3>
|
---|
149 |
|
---|
150 | <p> Adds an element <em>d</em> to the top of the stack. Last in, first out.
|
---|
151 |
|
---|
152 | <h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="read"></a>QPtrStack::read ( <a href="qdatastream.html">QDataStream</a> & s, <a href="qptrcollection.html#Item">QPtrCollection::Item</a> & item )<tt> [virtual protected]</tt>
|
---|
153 | </h3>
|
---|
154 |
|
---|
155 | <p> Reads a stack item, <em>item</em>, from the stream <em>s</em> and returns a
|
---|
156 | reference to the stream.
|
---|
157 | <p> The default implementation sets <em>item</em> to 0.
|
---|
158 | <p> <p>See also <a href="#write">write</a>().
|
---|
159 |
|
---|
160 | <h3 class=fn>bool <a name="remove"></a>QPtrStack::remove ()
|
---|
161 | </h3>
|
---|
162 |
|
---|
163 | <p> Removes the top item from the stack and deletes it if <a href="#autoDelete">autoDelete</a>()
|
---|
164 | is TRUE. Returns TRUE if there was an item to pop; otherwise
|
---|
165 | returns FALSE.
|
---|
166 | <p> <p>See also <a href="#clear">clear</a>().
|
---|
167 |
|
---|
168 | <h3 class=fn>void <a name="setAutoDelete"></a>QPtrStack::setAutoDelete ( bool enable )
|
---|
169 | </h3>
|
---|
170 |
|
---|
171 | <p> Defines whether this stack auto-deletes its contents. The same as
|
---|
172 | <a href="qptrcollection.html#setAutoDelete">QPtrCollection::setAutoDelete</a>().
|
---|
173 | <p> If <em>enable</em> is TRUE the stack auto-deletes its contents; if <em>enable</em> is FALSE the stack does not delete its contents.
|
---|
174 | <p> <p>See also <a href="#autoDelete">autoDelete</a>().
|
---|
175 |
|
---|
176 | <h3 class=fn>type * <a name="top"></a>QPtrStack::top () const
|
---|
177 | </h3>
|
---|
178 |
|
---|
179 | <p> Returns a pointer to the top item on the stack (most recently
|
---|
180 | pushed). The stack is not changed. Returns 0 if the stack is
|
---|
181 | empty.
|
---|
182 |
|
---|
183 | <h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="write"></a>QPtrStack::write ( <a href="qdatastream.html">QDataStream</a> & s, <a href="qptrcollection.html#Item">QPtrCollection::Item</a> item ) const<tt> [virtual protected]</tt>
|
---|
184 | </h3>
|
---|
185 |
|
---|
186 | <p> Writes a stack item, <em>item</em>, to the stream <em>s</em> and returns a
|
---|
187 | reference to the stream.
|
---|
188 | <p> The default implementation does nothing.
|
---|
189 | <p> <p>See also <a href="#read">read</a>().
|
---|
190 |
|
---|
191 | <!-- eof -->
|
---|
192 | <hr><p>
|
---|
193 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
194 | Copyright © 1995-2007
|
---|
195 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
196 | <table width=100% cellspacing=0 border=0><tr>
|
---|
197 | <td>Copyright © 2007
|
---|
198 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
199 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
200 | </table></div></address></body>
|
---|
201 | </html>
|
---|