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
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- q3valuestack.qdoc -->
<title>Qt 4.8: Q3ValueStack Class Reference</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="content">
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
</div>
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li>Qt3SupportLight</li>
<li>Q3ValueStack</li>
</ul>
</div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">Q3ValueStack Class Reference</h1>
<!-- $$$Q3ValueStack-brief -->
<p>The Q3ValueStack class is a value-based template class that provides a stack. <a href="#details">More...</a></p>
<!-- @@@Q3ValueStack -->
<pre class="cpp"> <span class="preprocessor">#include <Q3ValueStack></span></pre><p><b>This class is part of the Qt 3 support library.</b> It is provided to keep old source code working. We strongly advise against using it in new code. See <a href="porting4.html">Porting to Qt 4</a> for more information.</p>
<p><b>Inherits: </b><a href="q3valuelist.html">Q3ValueList<T></a>.</p>
<ul>
<li><a href="q3valuestack-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3valuestack.html#Q3ValueStack">Q3ValueStack</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3valuestack.html#dtor.Q3ValueStack">~Q3ValueStack</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> T </td><td class="memItemRight bottomAlign"><b><a href="q3valuestack.html#pop">pop</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3valuestack.html#push">push</a></b> ( const T & <i>d</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> T & </td><td class="memItemRight bottomAlign"><b><a href="q3valuestack.html#top">top</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const T & </td><td class="memItemRight bottomAlign"><b><a href="q3valuestack.html#top-2">top</a></b> () const</td></tr>
</table>
<ul>
<li class="fn">24 public functions inherited from <a href="q3valuelist.html#public-functions">Q3ValueList</a></li>
<li class="fn">48 public functions inherited from <a href="qlinkedlist.html#public-functions">QLinkedList</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 static public member inherited from <a href="qlinkedlist.html#static-public-members">QLinkedList</a></li>
</ul>
<a name="details"></a>
<!-- $$$Q3ValueStack-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The Q3ValueStack class is a value-based template class that provides a stack.</p>
<p>Define a template instance Q3ValueStack<X> to create a stack of values that all have the class X.</p>
<p>Note that Q3ValueStack does not store pointers to the members of the stack; it holds a copy of every member. That is why these kinds of classes are called "value based"; <a href="q3ptrstack.html">Q3PtrStack</a>, <a href="q3ptrlist.html">Q3PtrList</a>, <a href="q3dict.html">Q3Dict</a>, etc., are "pointer based".</p>
<p>A stack is a last in, first out (LIFO) structure. Items are added to the top of the stack with <a href="q3valuestack.html#push">push</a>() and retrieved from the top with <a href="q3valuestack.html#pop">pop</a>(). The <a href="q3valuestack.html#top">top</a>() function provides access to the topmost item without removing it.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type">Q3ValueStack</span><span class="operator"><</span><span class="type">int</span><span class="operator">></span> stack;
stack<span class="operator">.</span><a href="q3valuestack.html#push">push</a>( <span class="number">1</span> );
stack<span class="operator">.</span><a href="q3valuestack.html#push">push</a>( <span class="number">2</span> );
stack<span class="operator">.</span><a href="q3valuestack.html#push">push</a>( <span class="number">3</span> );
<span class="keyword">while</span> ( <span class="operator">!</span> stack<span class="operator">.</span>isEmpty() )
cout <span class="operator"><</span><span class="operator"><</span> <span class="string">"Item: "</span> <span class="operator"><</span><span class="operator"><</span> stack<span class="operator">.</span><a href="q3valuestack.html#pop">pop</a>() <span class="operator"><</span><span class="operator"><</span> endl;
<span class="comment">// Output:</span>
<span class="comment">// Item: 3</span>
<span class="comment">// Item: 2</span>
<span class="comment">// Item: 1</span></pre>
<p>Q3ValueStack is a specialized <a href="q3valuelist.html">Q3ValueList</a> provided for convenience. All of <a href="q3valuelist.html">Q3ValueList</a>'s functionality also applies to <a href="q3ptrstack.html">Q3PtrStack</a>, for example the facility to iterate over all elements using Q3ValueStack<T>::Iterator. See <a href="q3valuelistiterator.html">Q3ValueListIterator</a> for further details.</p>
<p>Some classes cannot be used within a Q3ValueStack, for example everything derived from <a href="qobject.html">QObject</a> and thus all classes that implement widgets. Only values can be used in a Q3ValueStack. To qualify as a value, the class must provide</p>
<ul>
<li>a copy constructor;</li>
<li>an assignment operator;</li>
<li>a default constructor, i.e. a constructor that does not take any arguments.</li>
</ul>
<p>Note that C++ defaults to field-by-field assignment operators and copy constructors if no explicit version is supplied. In many cases this is sufficient.</p>
</div>
<!-- @@@Q3ValueStack -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$Q3ValueStack[overload1]$$$Q3ValueStack -->
<h3 class="fn"><a name="Q3ValueStack"></a>Q3ValueStack::<span class="name">Q3ValueStack</span> ()</h3>
<p>Constructs an empty stack.</p>
<!-- @@@Q3ValueStack -->
<!-- $$$~Q3ValueStack[overload1]$$$~Q3ValueStack -->
<h3 class="fn"><a name="dtor.Q3ValueStack"></a>Q3ValueStack::<span class="name">~Q3ValueStack</span> ()</h3>
<p>Destroys the stack. References to the values in the stack and all iterators of this stack become invalidated. Because <a href="q3valuestack.html" class="compat">Q3ValueStack</a> is highly tuned for performance, you won't see warnings if you use invalid iterators because it is impossible for an iterator to check whether or not it is valid.</p>
<!-- @@@~Q3ValueStack -->
<!-- $$$pop[overload1]$$$pop -->
<h3 class="fn"><a name="pop"></a><span class="type">T</span> Q3ValueStack::<span class="name">pop</span> ()</h3>
<p>Removes the top item from the stack and returns it.</p>
<p><b>See also </b><a href="q3valuestack.html#top">top</a>() and <a href="q3valuestack.html#push">push</a>().</p>
<!-- @@@pop -->
<!-- $$$push[overload1]$$$pushconstT& -->
<h3 class="fn"><a name="push"></a><span class="type">void</span> Q3ValueStack::<span class="name">push</span> ( const <span class="type">T</span> & <i>d</i> )</h3>
<p>Adds element, <i>d</i>, to the top of the stack. Last in, first out.</p>
<p>This function is equivalent to <a href="q3valuelist.html#append">append</a>().</p>
<p><b>See also </b><a href="q3valuestack.html#pop">pop</a>() and <a href="q3valuestack.html#top">top</a>().</p>
<!-- @@@push -->
<!-- $$$top[overload1]$$$top -->
<h3 class="fn"><a name="top"></a><span class="type">T</span> & Q3ValueStack::<span class="name">top</span> ()</h3>
<p>Returns a reference to the top item of the stack or the item referenced by <a href="qlinkedlist.html#end">end</a>() if no such item exists. Note that you must not change the value the <a href="qlinkedlist.html#end">end</a>() iterator points to.</p>
<p>This function is equivalent to <a href="qlinkedlist.html#last">last</a>().</p>
<p><b>See also </b><a href="q3valuestack.html#pop">pop</a>(), <a href="q3valuestack.html#push">push</a>(), and <a href="q3valuelist.html#fromLast">Q3ValueList::fromLast</a>().</p>
<!-- @@@top -->
<!-- $$$top$$$top -->
<h3 class="fn"><a name="top-2"></a>const <span class="type">T</span> & Q3ValueStack::<span class="name">top</span> () const</h3>
<p>This is an overloaded function.</p>
<p>Returns a reference to the top item of the stack or the item referenced by <a href="qlinkedlist.html#end">end</a>() if no such item exists.</p>
<p>This function is equivalent to <a href="qlinkedlist.html#last">last</a>().</p>
<p><b>See also </b><a href="q3valuestack.html#pop">pop</a>(), <a href="q3valuestack.html#push">push</a>(), and <a href="q3valuelist.html#fromLast">Q3ValueList::fromLast</a>().</p>
<!-- @@@top -->
</div>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2012 Nokia Corporation and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.</p>
<br />
<p>
The documentation provided herein is licensed under the terms of the
<a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
License version 1.3</a> as published by the Free Software Foundation.</p>
<p>
Documentation sources may be obtained from <a href="http://www.qt-project.org">
www.qt-project.org</a>.</p>
<br />
<p>
Nokia, Qt and their respective logos are trademarks of Nokia Corporation
in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. <a title="Privacy Policy"
href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>
|