1QDictIterator(3qt)                                          QDictIterator(3qt)
2
3
4

NAME

6       QDictIterator - Iterator for QDict collections
7

SYNOPSIS

9       #include <qdict.h>
10
11   Public Members
12       QDictIterator ( const QDict<type> & dict )
13       ~QDictIterator ()
14       uint count () const
15       bool isEmpty () const
16       type * toFirst ()
17       operator type * () const
18       type * current () const
19       QString currentKey () const
20       type * operator() ()
21       type * operator++ ()
22

DESCRIPTION

24       The QDictIterator class provides an iterator for QDict collections.
25
26       QDictIterator is implemented as a template class. Define a template
27       instance QDictIterator<X> to create a dictionary iterator that operates
28       on QDict<X> (dictionary of X*).
29
30       The traversal order is arbitrary; when we speak of the "first"," last"
31       and "next" item we are talking in terms of this arbitrary order.
32
33       Multiple iterators may independently traverse the same dictionary. A
34       QDict knows about all the iterators that are operating on the
35       dictionary. When an item is removed from the dictionary, QDict updates
36       all iterators that are referring to the removed item to point to the
37       next item in the (arbitrary) traversal order.
38
39       Example:
40
41           QDict<QLineEdit> fields;
42           fields.insert( "forename", new QLineEdit( this ) );
43           fields.insert( "surname", new QLineEdit( this ) );
44           fields.insert( "age", new QLineEdit( this ) );
45           fields["forename"]->setText( "Homer" );
46           fields["surname"]->setText( "Simpson" );
47           fields["age"]->setText( "45" );
48           QDictIterator<QLineEdit> it( fields );
49           for( ; it.current(); ++it )
50               cout << it.currentKey() << ": " << it.current()->text() << endl;
51           cout << endl;
52           // Output (random order):
53           //  age: 45
54           //  surname: Simpson
55           //  forename: Homer
56       In the example we insert some pointers to line edits into a dictionary,
57       then iterate over the dictionary printing the strings associated with
58       the line edits.
59
60       See also QDict, Collection Classes, and Non-GUI Classes.
61

MEMBER FUNCTION DOCUMENTATION

QDictIterator::QDictIterator ( const QDict<type> & dict )

64       Constructs an iterator for dict. The current iterator item is set to
65       point to the first item in the dictionary, dict. First in this context
66       means first in the arbitrary traversal order.
67

QDictIterator::~QDictIterator ()

69       Destroys the iterator.
70

uint QDictIterator::count () const

72       Returns the number of items in the dictionary over which the iterator
73       is operating.
74
75       See also isEmpty().
76

type * QDictIterator::current () const

78       Returns a pointer to the current iterator item's value.
79

QString QDictIterator::currentKey () const

81       Returns the current iterator item's key.
82

bool QDictIterator::isEmpty () const

84       Returns TRUE if the dictionary is empty, i.e. count() == 0; otherwise
85       returns FALSE.
86
87       See also count().
88

QDictIterator::operator type * () const

90       Cast operator. Returns a pointer to the current iterator item. Same as
91       current().
92

type * QDictIterator::operator() ()

94       Makes the next item current and returns the original current item.
95
96       If the current iterator item was the last item in the dictionary or if
97       it was 0, 0 is returned.
98

type * QDictIterator::operator++ ()

100       Prefix ++ makes the next item current and returns the new current item.
101
102       If the current iterator item was the last item in the dictionary or if
103       it was 0, 0 is returned.
104

type * QDictIterator::toFirst ()

106       Resets the iterator, making the first item the first current item.
107       First in this context means first in the arbitrary traversal order.
108       Returns a pointer to this item.
109
110       If the dictionary is empty it sets the current item to 0 and returns 0.
111
112

SEE ALSO

114       http://doc.trolltech.com/qdictiterator.html
115       http://www.trolltech.com/faq/tech.html
116
118       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
119       license file included in the distribution for a complete license
120       statement.
121

AUTHOR

123       Generated automatically from the source code.
124

BUGS

126       If you find a bug in Qt, please report it as described in
127       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
128       help you. Thank you.
129
130       The definitive Qt documentation is provided in HTML format; it is
131       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
132       web browser. This man page is provided as a convenience for those users
133       who prefer man pages, although this format is not officially supported
134       by Trolltech.
135
136       If you find errors in this manual page, please report them to qt-
137       bugs@trolltech.com.  Please include the name of the manual page
138       (qdictiterator.3qt) and the Qt version (3.3.8).
139
140
141
142Trolltech AS                    2 February 2007             QDictIterator(3qt)
Impressum