1QPtrDictIterator(3qt)                                    QPtrDictIterator(3qt)
2
3
4

NAME

6       QPtrDictIterator - Iterator for QPtrDict collections
7

SYNOPSIS

9       #include <qptrdict.h>
10
11   Public Members
12       QPtrDictIterator ( const QPtrDict<type> & dict )
13       ~QPtrDictIterator ()
14       uint count () const
15       bool isEmpty () const
16       type * toFirst ()
17       operator type * () const
18       type * current () const
19       void * currentKey () const
20       type * operator() ()
21       type * operator++ ()
22       type * operator+= ( uint jump )
23

DESCRIPTION

25       The QPtrDictIterator class provides an iterator for QPtrDict
26       collections.
27
28       QPtrDictIterator is implemented as a template class. Define a template
29       instance QPtrDictIterator<X> to create a dictionary iterator that
30       operates on QPtrDict<X> (dictionary of X*).
31
32       Example:
33
34           QPtrDict<char> fields;
35           QLineEdit *le1 = new QLineEdit( this );
36           le1->setText( "Simpson" );
37           QLineEdit *le2 = new QLineEdit( this );
38           le2->setText( "Homer" );
39           QLineEdit *le3 = new QLineEdit( this );
40           le3->setText( "45" );
41           fields.insert( le1, "Surname" );
42           fields.insert( le2, "Forename" );
43           fields.insert( le3, "Age" );
44           QPtrDictIterator<char> it( fields );
45           for( ; it.current(); ++it ) {
46               QLineEdit *le = (QLineEdit)it.currentKey();
47               cout << it.current() << ": " << le->text() << endl;
48           }
49           cout << endl;
50           // Output (random order):
51           //  Forename: Homer
52           //  Age: 45
53           //  Surname: Simpson
54       In the example we insert some line edits into a dictionary, associating
55       a string with each. We then iterate over the dictionary printing the
56       associated strings.
57
58       Multiple iterators may independently traverse the same dictionary. A
59       QPtrDict knows about all the iterators that are operating on the
60       dictionary. When an item is removed from the dictionary, QPtrDict
61       updates all iterators that refer the removed item to point to the next
62       item in the traversing order.
63
64       See also QPtrDict, Collection Classes, and Non-GUI Classes.
65

MEMBER FUNCTION DOCUMENTATION

QPtrDictIterator::QPtrDictIterator ( const QPtrDict<type> & dict )

68       Constructs an iterator for dict. The current iterator item is set to
69       point on the first item in the dict.
70

QPtrDictIterator::~QPtrDictIterator ()

72       Destroys the iterator.
73

uint QPtrDictIterator::count () const

75       Returns the number of items in the dictionary this iterator operates
76       on.
77
78       See also isEmpty().
79

type * QPtrDictIterator::current () const

81       Returns a pointer to the current iterator item's value.
82

void * QPtrDictIterator::currentKey () const

84       Returns the current iterator item's key.
85

bool QPtrDictIterator::isEmpty () const

87       Returns TRUE if the dictionary is empty; otherwise returns FALSE.
88
89       See also count().
90

QPtrDictIterator::operator type * () const

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

type * QPtrDictIterator::operator() ()

96       Makes the succeeding item current and returns the original current
97       item.
98
99       If the current iterator item was the last item in the dictionary or if
100       it was 0, 0 is returned.
101

type * QPtrDictIterator::operator++ ()

103       Prefix ++ makes the succeeding item current and returns the new current
104       item.
105
106       If the current iterator item was the last item in the dictionary or if
107       it was 0, 0 is returned.
108

type * QPtrDictIterator::operator+= ( uint jump )

110       Sets the current item to the item jump positions after the current item
111       and returns a pointer to that item.
112
113       If that item is beyond the last item or if the dictionary is empty, it
114       sets the current item to 0 and returns 0.
115

type * QPtrDictIterator::toFirst ()

117       Sets the current iterator item to point to the first item in the
118       dictionary and returns a pointer to the item. If the dictionary is
119       empty, it sets the current item to 0 and returns 0.
120
121

SEE ALSO

123       http://doc.trolltech.com/qptrdictiterator.html
124       http://www.trolltech.com/faq/tech.html
125
127       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
128       license file included in the distribution for a complete license
129       statement.
130

AUTHOR

132       Generated automatically from the source code.
133

BUGS

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