1QValueListIterator(3qt) QValueListIterator(3qt)
2
3
4
6 QValueListIterator - Iterator for QValueList
7
9 All the functions in this class are reentrant when Qt is built with
10 thread support.</p>
11
12 #include <qvaluelist.h>
13
14 Public Members
15 typedef T value_type
16 typedef T * pointer
17 typedef T & reference
18 QValueListIterator ()
19 QValueListIterator ( const QValueListIterator<T> & it )
20 bool operator== ( const QValueListIterator<T> & it ) const
21 bool operator!= ( const QValueListIterator<T> & it ) const
22 const T & operator* () const
23 T & operator* ()
24 QValueListIterator<T> & operator++ ()
25 QValueListIterator<T> operator++ ( int )
26 QValueListIterator<T> & operator-- ()
27 QValueListIterator<T> operator-- ( int )
28 QValueListIterator<T> & operator+= ( int j )
29 QValueListIterator<T> & operator-= ( int j )
30
32 The QValueListIterator class provides an iterator for QValueList.
33
34 An iterator is a class for accessing the items of a container class: a
35 generalization of the index in an array. A pointer into a "const char
36 *" and an index into an "int[]" are both iterators, and the general
37 idea is to provide that functionality for any data structure.
38
39 The QValueListIterator class is an iterator for QValueList
40 instantiations. You can create the appropriate iterator type by using
41 the iterator typedef provided by QValueList.
42
43 The only way to access the items in a QValueList is to use an iterator.
44
45 Example (see QValueList for the complete code):
46
47 EmployeeList::iterator it;
48 for ( it = list.begin(); it != list.end(); ++it )
49 cout << (*it).surname().latin1() << ", " <<
50 (*it).forename().latin1() << " earns " <<
51 (*it).salary() << endl;
52 // Output:
53 // Doe, John earns 50000
54 // Williams, Jane earns 80000
55 // Hawthorne, Mary earns 90000
56 // Jones, Tom earns 60000
57
58 QValueList is highly optimized for performance and memory usage. This
59 means that you must be careful: QValueList does not know about all its
60 iterators and the iterators don't know to which list they belong. This
61 makes things very fast, but if you're not careful, you can get
62 spectacular bugs. Always make sure iterators are valid before
63 dereferencing them or using them as parameters to generic algorithms in
64 the STL or the QTL.
65
66 Using an invalid iterator is undefined (your application will probably
67 crash). Many Qt functions return const value lists; to iterate over
68 these you should make a copy and iterate over the copy.
69
70 For every Iterator there is a ConstIterator. When accessing a
71 QValueList in a const environment or if the reference or pointer to the
72 list is itself const, then you must use the ConstIterator. Its
73 semantics are the same as the Iterator, but it only returns const
74 references.
75
76 See also QValueList, QValueListConstIterator, Qt Template Library
77 Classes, and Non-GUI Classes.
78
79 Member Type Documentation
81 Pointer to value_type.
82
84 Reference to value_type.
85
87 The type of value, T.
88
91 Creates un uninitialized iterator.
92
94 This is an overloaded member function, provided for convenience. It
95 behaves essentially like the above function.
96
97 Constructs a copy of the iterator it.
98
100
101 Compares this iterator and it and returns TRUE if they point to
102 different items; otherwise returns FALSE.
103
105 Asterisk operator. Returns a reference to the current iterator item.
106
108 This is an overloaded member function, provided for convenience. It
109 behaves essentially like the above function.
110
111 Asterisk operator. Returns a reference to the current iterator item.
112
114 Prefix ++ makes the succeeding item current and returns an iterator
115 pointing to the new current item. The iterator cannot check whether it
116 reached the end of the list. Incrementing the iterator returned by
117 end() causes undefined results.
118
120 This is an overloaded member function, provided for convenience. It
121 behaves essentially like the above function.
122
123 Postfix ++ makes the succeeding item current and returns an iterator
124 pointing to the new current item. The iterator cannot check whether it
125 reached the end of the list. Incrementing the iterator returned by
126 end() causes undefined results.
127
129 Postfix -- jumps j steps forward in the list. The iterator cannot check
130 whether it reached the end of the list. Jumping past the end() causes
131 undefined results.
132
134 Prefix -- makes the previous item current and returns an iterator
135 pointing to the new current item. The iterator cannot check whether it
136 reached the beginning of the list. Decrementing the iterator returned
137 by begin() causes undefined results.
138
140 This is an overloaded member function, provided for convenience. It
141 behaves essentially like the above function.
142
143 Postfix -- makes the previous item current and returns an iterator
144 pointing to the new current item. The iterator cannot check whether it
145 reached the beginning of the list. Decrementing the iterator returned
146 by begin() causes undefined results.
147
149 Postfix -- jumps j steps backward in the list. The iterator cannot
150 check whether it reached the beginning of the list. Jumping past
151 begin() causes undefined results.
152
154
155 Compares this iterator and it and returns TRUE if they point to the
156 same item; otherwise returns FALSE.
157
158
160 http://doc.trolltech.com/qvaluelistiterator.html
161 http://www.trolltech.com/faq/tech.html
162
164 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
165 license file included in the distribution for a complete license
166 statement.
167
169 Generated automatically from the source code.
170
172 If you find a bug in Qt, please report it as described in
173 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
174 help you. Thank you.
175
176 The definitive Qt documentation is provided in HTML format; it is
177 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
178 web browser. This man page is provided as a convenience for those users
179 who prefer man pages, although this format is not officially supported
180 by Trolltech.
181
182 If you find errors in this manual page, please report them to qt-
183 bugs@trolltech.com. Please include the name of the manual page
184 (qvaluelistiterator.3qt) and the Qt version (3.3.8).
185
186
187
188Trolltech AS 2 February 2007 QValueListIterator(3qt)