~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/q3valuestack.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/doc/src/q3valuestack.qdoc -->
 
6
<head>
 
7
    <title>Qt 4.0: Q3ValueStack Class Reference</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
19
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">Q3ValueStack Class Reference</h1>
 
21
<p>The Q3ValueStack class is a value-based template class that provides a stack. <a href="#details">More...</a></p>
 
22
<pre>#include &lt;Q3ValueStack&gt;</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 the <a href="porting4.html">Porting Guide</a> for more information.</p>
 
23
<p>Part of the <a href="qt3support.html">Qt3Support</a> module.</p>
 
24
<p>Inherits <a href="q3valuelist.html">Q3ValueList&lt;T&gt;</a>.</p>
 
25
<ul>
 
26
<li><a href="q3valuestack-members.html">List of all members, including inherited members</a></li>
 
27
</ul>
 
28
<a name="public-functions"></a>
 
29
<h3>Public Functions</h3>
 
30
<ul>
 
31
<li><div class="fn"/><b><a href="q3valuestack.html#Q3ValueStack">Q3ValueStack</a></b> ()</li>
 
32
<li><div class="fn"/><b><a href="q3valuestack.html#dtor.Q3ValueStack">~Q3ValueStack</a></b> ()</li>
 
33
<li><div class="fn"/>T <b><a href="q3valuestack.html#pop">pop</a></b> ()</li>
 
34
<li><div class="fn"/>void <b><a href="q3valuestack.html#push">push</a></b> ( const T &amp; <i>d</i> )</li>
 
35
<li><div class="fn"/>T &amp; <b><a href="q3valuestack.html#top">top</a></b> ()</li>
 
36
<li><div class="fn"/>const T &amp; <b><a href="q3valuestack.html#top-2">top</a></b> () const</li>
 
37
</ul>
 
38
<ul>
 
39
<li><div class="fn"/>24 public functions inherited from <a href="q3valuelist.html#public-functions">Q3ValueList</a></li>
 
40
<li><div class="fn"/>43 public functions inherited from <a href="qlinkedlist.html#public-functions">QLinkedList</a></li>
 
41
</ul>
 
42
<a name="details"></a>
 
43
<hr />
 
44
<h2>Detailed Description</h2>
 
45
<p>The Q3ValueStack class is a value-based template class that provides a stack.</p>
 
46
<p>Define a template instance Q3ValueStack&lt;X&gt; to create a stack of values that all have the class X.</p>
 
47
<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 &quot;value based&quot;; <a href="q3ptrstack.html">Q3PtrStack</a>, <a href="q3ptrlist.html">Q3PtrList</a>, <a href="q3dict.html">Q3Dict</a>, etc., are &quot;pointer based&quot;.</p>
 
48
<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>
 
49
<p>Example:</p>
 
50
<pre>&nbsp;   Q3ValueStack&lt;int&gt; stack;
 
51
    stack.push( 1 );
 
52
    stack.push( 2 );
 
53
    stack.push( 3 );
 
54
    while ( ! stack.isEmpty() )
 
55
        cout &lt;&lt; &quot;Item: &quot; &lt;&lt; stack.pop() &lt;&lt; endl;
 
56
 
 
57
    // Output:
 
58
    //      Item: 3
 
59
    //      Item: 2
 
60
    //      Item: 1</pre>
 
61
<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&lt;T&gt;::Iterator. See <a href="q3valuelistiterator.html">Q3ValueListIterator</a> for further details.</p>
 
62
<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>
 
63
<ul>
 
64
<li>a copy constructor;</li>
 
65
<li>an assignment operator;</li>
 
66
<li>a default constructor, i.e. a constructor that does not take any arguments.</li>
 
67
</ul>
 
68
<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>
 
69
<hr />
 
70
<h2>Member Function Documentation</h2>
 
71
<h3 class="fn"><a name="Q3ValueStack"></a>Q3ValueStack::Q3ValueStack ()</h3>
 
72
<p>Constructs an empty stack.</p>
 
73
<h3 class="fn"><a name="dtor.Q3ValueStack"></a>Q3ValueStack::~Q3ValueStack ()</h3>
 
74
<p>Destroys the stack. References to the values in the stack and all iterators of this stack become invalidated. Because <a href="q3valuestack.html">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>
 
75
<h3 class="fn"><a name="pop"></a>T Q3ValueStack::pop ()</h3>
 
76
<p>Removes the top item from the stack and returns it.</p>
 
77
<p>See also <a href="q3valuestack.html#top">top</a>() and <a href="q3valuestack.html#push">push</a>().</p>
 
78
<h3 class="fn"><a name="push"></a>void Q3ValueStack::push ( const T &amp; <i>d</i> )</h3>
 
79
<p>Adds element, <i>d</i>, to the top of the stack. Last in, first out.</p>
 
80
<p>This function is equivalent to <a href="q3valuelist.html#append">append</a>().</p>
 
81
<p>See also <a href="q3valuestack.html#pop">pop</a>() and <a href="q3valuestack.html#top">top</a>().</p>
 
82
<h3 class="fn"><a name="top"></a>T &amp; Q3ValueStack::top ()</h3>
 
83
<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>
 
84
<p>This function is equivalent to <a href="qlinkedlist.html#last">last</a>().</p>
 
85
<p>See also <a href="q3valuestack.html#pop">pop</a>(), <a href="q3valuestack.html#push">push</a>(), and <a href="q3valuelist.html#fromLast">Q3ValueList::fromLast</a>().</p>
 
86
<h3 class="fn"><a name="top-2"></a>const T &amp; Q3ValueStack::top () const</h3>
 
87
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
88
<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>
 
89
<p>This function is equivalent to <a href="qlinkedlist.html#last">last</a>().</p>
 
90
<p>See also <a href="q3valuestack.html#pop">pop</a>(), <a href="q3valuestack.html#push">push</a>(), and <a href="q3valuelist.html#fromLast">Q3ValueList::fromLast</a>().</p>
 
91
<p /><address><hr /><div align="center">
 
92
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
93
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
94
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
95
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
96
</tr></table></div></address></body>
 
97
</html>