File: qptrdictiterator.html

package info (click to toggle)
qt-embedded 2.3.2-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 68,608 kB
  • ctags: 45,998
  • sloc: cpp: 276,654; ansic: 71,987; makefile: 29,074; sh: 12,305; yacc: 2,465; python: 1,863; perl: 481; lex: 480; xml: 68; lisp: 15
file content (144 lines) | stat: -rw-r--r-- 7,497 bytes parent folder | download
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
<!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 - QPtrDictIterator 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>QPtrDictIterator Class Reference</h1><br clear="all">
<p>
The QPtrDictIterator class provides an iterator for <a href="qptrdict.html">QPtrDict</a> collections.
<a href="#details">More...</a>
<p>
<code>#include &lt;<a href="qptrdict-h.html">qptrdict.h</a>&gt;</code>
<p>
Inherits <a href="qgdictiterator.html">QGDictIterator</a>.
<p><a href="qptrdictiterator-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#342450"><b>QPtrDictIterator</b></a>(constQPtrDict&lt;type&gt;&amp;dict)</div>
<li><div class="fn"><a href="#6741b7"><b>~QPtrDictIterator</b></a>()</div>
<li><div class="fn">uint<a href="#e87b0e"><b>count</b></a>()const</div>
<li><div class="fn">bool<a href="#b16917"><b>isEmpty</b></a>()const</div>
<li><div class="fn">type*<a href="#8f8068"><b>toFirst</b></a>()</div>
<li><div class="fn">operator<a href=qptrdictiterator.html#f51f28><b>type*</b></a>()const</div>
<li><div class="fn">type*<a href="#5ad25c"><b>current</b></a>()const</div>
<li><div class="fn">void*<a href="#27b7a3"><b>currentKey</b></a>()const</div>
<li><div class="fn">type*<a href="#85fe09"><b>operator</b></a>()</div>
<li><div class="fn">type*<a href="#702c41"><b>operator++</b></a>()</div>
<li><div class="fn">type*<a href="#8b9a92"><b>operator+=</b></a>(uintjump)</div>
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QPtrDictIterator class provides an iterator for <a href="qptrdict.html">QPtrDict</a> collections.
<p>
QPtrDictIterator is implemented as a template class.
Define a template instance QPtrDictIterator&lt;X&gt; to create a
dictionary iterator that operates on QPtrDict&lt;X&gt; (dictionary of X*).
<p>Example:
<pre>    #include &lt;qptrdict.h&gt;
    #include &lt;stdio.h&gt;

    void main()
    {
        int *a = new int[12];
        int *b = new int[10];
        int *c = new int[18];
        int *d = new int[13];

        <a href="qptrdict.html">QPtrDict</a>&lt;char&gt; dict;               // maps void* -&gt; char*

        dict.<a href="qptrdict.html#7c76c9">insert</a>( a, "a is int[12]" );  // describe pointers
        dict.<a href="qptrdict.html#7c76c9">insert</a>( b, "b is int[10]" );
        dict.<a href="qptrdict.html#7c76c9">insert</a>( c, "c is int[18]" );

        <a href="qptrdictiterator.html">QPtrDictIterator</a>&lt;char&gt; it( dict ); // iterator for dict

        while ( it.<a href="#5ad25c">current</a>() ) {
            printf( "%x -&gt; %s\n", it.<a href="#27b7a3">currentKey</a>(), it.<a href="#5ad25c">current</a>() );
            ++it;
        }
    }
</pre>
<p>Program output:
<pre>        804a788 -&gt; a is int[12]
        804a7f0 -&gt; c is int[18]
        804a7c0 -&gt; b is int[10]
</pre>
<p>Note that the traversal order is arbitrary, you are not guaranteed the
order above.
<p>Multiple iterators may independently traverse the same dictionary.
A QPtrDict knows about all iterators that are operating on the dictionary.
When an item is removed from the dictionary, QPtrDict update all
iterators that are referring the removed item to point to the next item
in the traversing order.
<p>See also  <a href="qptrdict.html">QPtrDict</a> and <a href="collection.html">Collection Classes</a>

<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="342450"></a>QPtrDictIterator::QPtrDictIterator(const<a href="qptrdict.html">QPtrDict</a>&lt;type&gt;&amp;dict)</h3>
<p>Constructs an iterator for <em>dict.</em>  The current iterator item is
set to point on the first item in the <em>dict.</em>
<h3 class="fn"><a name="6741b7"></a>QPtrDictIterator::~QPtrDictIterator()</h3>
<p>Destroys the iterator.
<h3 class="fn"><a name="f51f28"></a>QPtrDictIterator::operatortype*()const</h3>
<p>Cast operator. Returns a pointer to the current iterator item.
Same as <a href="#5ad25c">current</a>().
<h3 class="fn">uint<a name="e87b0e"></a>QPtrDictIterator::count()const</h3>
<p>Returns the number of items in the dictionary this iterator operates on.
<p>See also  <a href="#b16917">isEmpty</a>().
<h3 class="fn">type*<a name="5ad25c"></a>QPtrDictIterator::current()const</h3>
<p>Returns a pointer to the current iterator item.
<h3 class="fn">void*<a name="27b7a3"></a>QPtrDictIterator::currentKey()const</h3>
<p>Returns the key for the current iterator item.
<h3 class="fn">bool<a name="b16917"></a>QPtrDictIterator::isEmpty()const</h3>
<p>Returns TRUE if the dictionary is empty, i.e. <a href="#e87b0e">count</a>() == 0. Returns FALSE
otherwise.
<p>See also  <a href="#e87b0e">count</a>().
<h3 class="fn">type*<a name="85fe09"></a>QPtrDictIterator::operator()()</h3>
<p>Makes the succeeding item current and returns the original current item.
<p>If the current iterator item was the last item in the dictionary or if it
was null, null is returned.
<h3 class="fn">type*<a name="702c41"></a>QPtrDictIterator::operator++()</h3>
<p>Prefix ++ makes the succeeding item current and returns the new current
item.
<p>If the current iterator item was the last item in the dictionary or if it
was null, null is returned.
<h3 class="fn">type*<a name="8b9a92"></a>QPtrDictIterator::operator+=(uintjump)</h3>
<p>Sets the current item to the item <em>jump</em> positions after the current item,
and returns a pointer to that item.
<p>If that item is beyond the last item or if the dictionary is  empty,
it sets the current item to null and returns null.
<h3 class="fn">type*<a name="8f8068"></a>QPtrDictIterator::toFirst()</h3>
<p>Sets the current iterator item to point to the first item in the
dictionary and returns a pointer to the item.
If the dictionary is  empty it sets the current item to null and 
returns null.
<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 &copy; 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>