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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QStack Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QStack Class Reference</h1><br clear="all">
<p>
The QStack class is a template class that provides a stack.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qstack-h.html">qstack.h</a>></code>
<p><a href="qstack-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#292615"><b>QStack</b></a>()</div>
<li><div class="fn"><a href="#120f76"><b>QStack</b></a>(constQStack<type>&s)</div>
<li><div class="fn"><a href="#56248d"><b>~QStack</b></a>()</div>
<li><div class="fn">QStack<type>&<a href="#91ea77"><b>operator=</b></a>(constQStack<type>&s)</div>
<li><div class="fn">bool<a href="#c1d0cb"><b>autoDelete</b></a>()const</div>
<li><div class="fn">void<a href="#1341e3"><b>setAutoDelete</b></a>(boolenable)</div>
<li><div class="fn">virtualuint<a href="#2fe5cd"><b>count</b></a>()const</div>
<li><div class="fn">bool<a href="#2cc628"><b>isEmpty</b></a>()const</div>
<li><div class="fn">void<a href="#06a079"><b>push</b></a>(consttype*d)</div>
<li><div class="fn">type*<a href="#76ef3d"><b>pop</b></a>()</div>
<li><div class="fn">bool<a href="#a4837d"><b>remove</b></a>()</div>
<li><div class="fn">virtualvoid<a href="#d82d50"><b>clear</b></a>()</div>
<li><div class="fn">type*<a href="#33d8cf"><b>top</b></a>()const</div>
<li><div class="fn">operator<a href=qstack.html#2910ec><b>type*</b></a>()const</div>
<li><div class="fn">type*<a href="#5bd013"><b>current</b></a>()const</div>
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QStack class is a template class that provides a stack.
<p>
QStack is implemented as a template class. Define a template
instance QStack<X> to create a stack that operates on pointers to
X, or X*.
<p>A stack is a Last In, First Out (LIFO) structure. Items are added to
the top of the stack with <a href="#06a079">push</a>() and retrieved from the top
with <a href="#76ef3d">pop</a>().
<p>See also <a href="collection.html">Collection Classes</a>
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="292615"></a>QStack::QStack()</h3>
<p>Creates and empty stack.
<h3 class="fn"><a name="120f76"></a>QStack::QStack(constQStack<type>&s)</h3>
<p>Creates a stack by making a shallow copy of another stack.
<h3 class="fn"><a name="56248d"></a>QStack::~QStack()</h3>
<p>Destroys the stack. All items will be deleted if <a href="#c1d0cb">autoDelete</a>() is TRUE.
<h3 class="fn"><a name="2910ec"></a>QStack::operatortype*()const</h3>
<p>Returns a reference to the top item on the stack (most recently pushed).
The stack is not changed.
<h3 class="fn">bool<a name="c1d0cb"></a>QStack::autoDelete()const</h3>
<p>The same as <a href="qcollection.html#891b20">QCollection::autoDelete</a>().
<p>See also <a href="#1341e3">setAutoDelete</a>().
<h3 class="fn">void<a name="d82d50"></a>QStack::clear() <code>[virtual]</code></h3>
<p>Removes all items from the stack, deleting them if
<a href="#c1d0cb">autoDelete</a>() is TRUE.
<p>See also <a href="#a4837d">remove</a>().
<p>Reimplemented from <a href="qcollection.html#e9c603">QCollection.</a>
<h3 class="fn">uint<a name="2fe5cd"></a>QStack::count()const <code>[virtual]</code></h3>
<p>Returns the number of items in the stack.
<p>See also <a href="#2cc628">isEmpty</a>().
<p>Reimplemented from <a href="qcollection.html#2213fa">QCollection.</a>
<h3 class="fn">type*<a name="5bd013"></a>QStack::current()const</h3>
<p>Returns a reference to the top item on the stack (most recently pushed).
The stack is not changed.
<h3 class="fn">bool<a name="2cc628"></a>QStack::isEmpty()const</h3>
<p>Returns TRUE is the stack contains no elements to be <a href="#76ef3d">popped</a>
<h3 class="fn">QStack<type>&<a name="91ea77"></a>QStack::operator=(constQStack<type>&s)</h3>
<p>Sets the contents of this stack by making a shallow copy of another stack.
Elements currently in this stack will be deleted if <a href="#c1d0cb">autoDelete</a>() is TRUE.
<h3 class="fn">type*<a name="76ef3d"></a>QStack::pop()</h3>
<p>Removes the top item from the stack and returns it.
<h3 class="fn">void<a name="06a079"></a>QStack::push(consttype*d)</h3>
<p>Adds an element to the top of the stack. Last in, first out.
<h3 class="fn">bool<a name="a4837d"></a>QStack::remove()</h3>
<p>Removes the top item from the stack and deletes it if
<a href="#c1d0cb">autoDelete</a>() is TRUE. Returns TRUE if there was an item to pop.
<p>See also <a href="#d82d50">clear</a>().
<h3 class="fn">void<a name="1341e3"></a>QStack::setAutoDelete(boolenable)</h3>
<p>The same as <a href="qcollection.html#a8ef9f">QCollection::setAutoDelete</a>().
<p>See also <a href="#c1d0cb">autoDelete</a>().
<h3 class="fn">type*<a name="33d8cf"></a>QStack::top()const</h3>
<p>Returns a reference to the top item on the stack (most recently pushed).
The stack is not changed.
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-2001
<a href="http://www.trolltech.com">Trolltech</a>, all rights reserved.<p><address><hr><div align="center">
<table width="100%" cellspacing="0" border="0"><tr>
<td>Copyright 2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>
|