1QAsciiDictIterator(3qt) QAsciiDictIterator(3qt)
2
3
4
6 QAsciiDictIterator - Iterator for QAsciiDict collections
7
9 #include <qasciidict.h>
10
11 Public Members
12 QAsciiDictIterator ( const QAsciiDict<type> & dict )
13 ~QAsciiDictIterator ()
14 uint count () const
15 bool isEmpty () const
16 type * toFirst ()
17 operator type * () const
18 type * current () const
19 const char * currentKey () const
20 type * operator() ()
21 type * operator++ ()
22 type * operator+= ( uint jump )
23
25 The QAsciiDictIterator class provides an iterator for QAsciiDict
26 collections.
27
28 QAsciiDictIterator is implemented as a template class. Define a
29 template instance QAsciiDictIterator<X> to create a dictionary iterator
30 that operates on QAsciiDict<X> (dictionary of X*).
31
32 Example:
33
34 QAsciiDict<QLineEdit> fields;
35 fields.insert( "forename", new QLineEdit( this ) );
36 fields.insert( "surname", new QLineEdit( this ) );
37 fields.insert( "age", new QLineEdit( this ) );
38 fields["forename"]->setText( "Homer" );
39 fields["surname"]->setText( "Simpson" );
40 fields["age"]->setText( "45" );
41 QAsciiDictIterator<QLineEdit> it( fields );
42 for( ; it.current(); ++it )
43 cout << it.currentKey() << ": " << it.current()->text() << endl;
44 cout << endl;
45 // Output (random order):
46 // age: 45
47 // surname: Simpson
48 // forename: Homer
49 In the example we insert some line edits into a dictionary, then
50 iterate over the dictionary printing the strings associated with those
51 line edits.
52
53 Note that the traversal order is arbitrary; you are not guaranteed any
54 particular order.
55
56 Multiple iterators may independently traverse the same dictionary. A
57 QAsciiDict knows about all the iterators that are operating on the
58 dictionary. When an item is removed from the dictionary, QAsciiDict
59 updates all the iterators that are referring to the removed item to
60 point to the next item in the (arbitrary) traversal order.
61
62 See also QAsciiDict, Collection Classes, and Non-GUI Classes.
63
66 Constructs an iterator for dict. The current iterator item is set to
67 point on the first item in the dict.
68
70 Destroys the iterator.
71
73 Returns the number of items in the dictionary this iterator operates
74 over.
75
76 See also isEmpty().
77
79 Returns a pointer to the current iterator item.
80
82 Returns a pointer to the key for the current iterator item.
83
85 Returns TRUE if the dictionary is empty, i.e. count() == 0, otherwise
86 returns FALSE.
87
88 See also count().
89
91 Cast operator. Returns a pointer to the current iterator item. Same as
92 current().
93
95 Makes the succeeding item current and returns the original current
96 item.
97
98 If the current iterator item was the last item in the dictionary or if
99 it was 0, 0 is returned.
100
102 Prefix ++ makes the succeeding item current and returns the new current
103 item.
104
105 If the current iterator item was the last item in the dictionary or if
106 it was 0, 0 is returned.
107
109 Sets the current item to the item jump positions after the current
110 item, and returns a pointer to that item.
111
112 If that item is beyond the last item or if the dictionary is empty, it
113 sets the current item to 0 and returns 0.
114
116 Sets the current iterator item to point to the first item in the
117 dictionary and returns a pointer to the item. If the dictionary is
118 empty it sets the current item to 0 and returns 0.
119
120
122 http://doc.trolltech.com/qasciidictiterator.html
123 http://www.trolltech.com/faq/tech.html
124
126 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
127 license file included in the distribution for a complete license
128 statement.
129
131 Generated automatically from the source code.
132
134 If you find a bug in Qt, please report it as described in
135 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
136 help you. Thank you.
137
138 The definitive Qt documentation is provided in HTML format; it is
139 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
140 web browser. This man page is provided as a convenience for those users
141 who prefer man pages, although this format is not officially supported
142 by Trolltech.
143
144 If you find errors in this manual page, please report them to qt-
145 bugs@trolltech.com. Please include the name of the manual page
146 (qasciidictiterator.3qt) and the Qt version (3.3.8).
147
148
149
150Trolltech AS 2 February 2007 QAsciiDictIterator(3qt)