Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qiterator.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2020 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*! \class QKeyValueIterator
5
\inmodule QtCore
6
\since 5.10
7
8
\brief Iterator over the key/value pairs of an associative container.
9
10
The QKeyValueIterator class provides an STL-style iterator for returning
11
key/value pairs from associative containers like QHash and QMap. It
12
supports the same API as the STL associative containers, i.e. getting a
13
key/value pair when iterating through the container.
14
15
This will allow for better interoperability between QMap, QHash and friends
16
and STL-style algorithms.
17
18
\warning Iterators on implicitly shared containers do not work
19
exactly like STL-iterators. You should avoid copying a container
20
while iterators are active on that container. For more information,
21
read \l{Implicit sharing iterator problem}.
22
*/
23
24
/*! \typedef QKeyValueIterator::iterator_category
25
\internal
26
*/
27
28
/*! \typedef QKeyValueIterator::difference_type
29
\internal
30
*/
31
32
/*! \typedef QKeyValueIterator::value_type
33
\internal
34
*/
35
36
/*! \struct QKeyValueIterator::pointer
37
\internal
38
*/
39
40
/*! \typedef QKeyValueIterator::reference
41
\internal
42
*/
43
44
/*! \fn template<typename Key, typename T, class Iterator> QKeyValueIterator<Key, T, Iterator>::QKeyValueIterator()
45
46
Constructs a default QKeyValueIterator.
47
*/
48
49
/*! \fn template<typename Key, typename T, class Iterator> QKeyValueIterator<Key, T, Iterator>::QKeyValueIterator(Iterator o)
50
51
Constructs a QKeyValueIterator on top of \a o.
52
*/
53
54
/*! \fn template<typename Key, typename T, class Iterator> std::pair<Key, T> QKeyValueIterator<Key, T, Iterator>::operator*() const
55
56
Returns the current entry as a pair.
57
*/
58
59
/*! \fn template<typename Key, typename T, class Iterator> pointer QKeyValueIterator<Key, T, Iterator>::operator->() const
60
61
Returns the current entry as a pointer-like object to the pair.
62
63
\since 5.15
64
65
\sa operator*()
66
*/
67
68
/*! \fn template<typename Key, typename T, class Iterator> bool QKeyValueIterator<Key, T, Iterator>::operator==(QKeyValueIterator<Key, T, Iterator> lhs, QKeyValueIterator<Key, T, Iterator> rhs)
69
70
Returns \c true if \a rhs points to the same item as \a lhs otherwise returns
71
\c false.
72
73
\sa operator!=()
74
*/
75
76
/*! \fn template<typename Key, typename T, class Iterator> bool QKeyValueIterator<Key, T, Iterator>::operator!=(QKeyValueIterator<Key, T, Iterator> lhs, QKeyValueIterator<Key, T, Iterator> rhs)
77
78
Returns \c true if \a rhs points to a different item than \a lhs otherwise
79
returns \c false.
80
81
\sa operator==()
82
*/
83
84
/*!
85
\fn template<typename Key, typename T, class Iterator> QKeyValueIterator &QKeyValueIterator<Key, T, Iterator>::operator++()
86
87
The prefix \c{++} operator (\c{++i}) advances the iterator to the
88
next item in the container and returns the iterator.
89
90
\note Advancing the iterator past its container's end() constitutes
91
undefined behavior.
92
93
\sa operator--()
94
*/
95
96
/*! \fn template<typename Key, typename T, class Iterator> QKeyValueIterator QKeyValueIterator<Key, T, Iterator>::operator++(int)
97
98
\overload
99
100
The postfix \c{++} operator (\c{i++}) advances the iterator to the
101
next item in the container and returns the iterator's prior value.
102
103
\note Advancing the iterator past its container's end() constitutes
104
undefined behavior.
105
*/
106
107
/*! \fn template<typename Key, typename T, class Iterator> QKeyValueIterator &QKeyValueIterator<Key, T, Iterator>::operator--()
108
109
The prefix c{--} operator (\c{--i}) backs the iterator up to the previous item
110
in the container and returns the iterator.
111
112
\note Backing up an iterator to before its container's begin() constitutes
113
undefined behavior.
114
115
\sa operator++()
116
*/
117
118
/*! \fn template<typename Key, typename T, class Iterator> QKeyValueIterator QKeyValueIterator<Key, T, Iterator>::operator--(int)
119
120
\overload
121
122
The postfix c{--} operator (\c{i--}) backs the iterator up to the previous item
123
in the container and returns the iterator's prior value.
124
125
\note Backing up an iterator to before its container's begin() constitutes
126
undefined behavior.
127
*/
128
129
/*! \fn template<typename Key, typename T, class Iterator> Iterator QKeyValueIterator<Key, T, Iterator>::base() const
130
Returns the underlying iterator this QKeyValueIterator is based on.
131
*/
132
133
/*!
134
\class QListIterator
135
\inmodule QtCore
136
137
\brief The QListIterator class provides a Java-style const iterator for QList and QQueue.
138
139
QList has both \l{Java-style iterators} and \l{STL-style
140
iterators}. STL-style iterators are more efficient and should
141
be preferred.
142
143
An alternative to using iterators is to use index positions. Most
144
QList member functions take an index as their first parameter,
145
making it possible to access, modify, and remove items without
146
using iterators.
147
148
QListIterator<T> allows you to iterate over a QList<T>,
149
a QQueue<T> or a QStack<T>. If you want to modify the list
150
as you iterate over it, use QMutableListIterator<T> instead.
151
152
The QListIterator constructor takes a QList as argument. After
153
construction, the iterator is located at the very beginning of
154
the list (before the first item). Here's how to iterate over all
155
the elements sequentially:
156
157
\snippet code/doc_src_qiterator.cpp 0
158
159
The next() function returns the next item in the list and
160
advances the iterator. Unlike STL-style iterators, Java-style
161
iterators point \e between items rather than directly \e at
162
items. The first call to next() advances the iterator to the
163
position between the first and second item, and returns the first
164
item; the second call to next() advances the iterator to the
165
position between the second and third item, and returns the second
166
item; and so on.
167
168
\image javaiterators1.png
169
170
Here's how to iterate over the elements in reverse order:
171
172
\snippet code/doc_src_qiterator.cpp 1
173
174
If you want to find all occurrences of a particular value, use
175
findNext() or findPrevious() in a loop.
176
177
Multiple iterators can be used on the same list. If the list is
178
modified while a QListIterator is active, the QListIterator will
179
continue iterating over the original list, ignoring the modified
180
copy.
181
182
\sa QMutableListIterator, QList::const_iterator
183
*/
184
185
/*!
186
\class QSetIterator
187
\inmodule QtCore
188
\brief The QSetIterator class provides a Java-style const iterator for QSet.
189
190
QSet has both \l{Java-style iterators} and \l{STL-style
191
iterators}. STL-style iterators are more efficient and should
192
be preferred.
193
194
QSetIterator<T> allows you to iterate over a QSet<T>. If you
195
want to modify the set as you iterate over it, use
196
QMutableSetIterator<T> instead.
197
198
The constructor takes a QSet as argument. After construction, the
199
iterator is located at the very beginning of the set (before
200
the first item). Here's how to iterate over all the elements
201
sequentially:
202
203
\snippet code/doc_src_qiterator.cpp 6
204
205
The next() function returns the next item in the set and
206
advances the iterator. Unlike STL-style iterators, Java-style
207
iterators point \e between items rather than directly \e at
208
items. The first call to next() advances the iterator to the
209
position between the first and second item, and returns the first
210
item; the second call to next() advances the iterator to the
211
position between the second and third item, returning the second
212
item; and so on.
213
214
\image javaiterators1.png
215
216
If you want to find all occurrences of a particular value, use
217
findNext() in a loop.
218
219
Multiple iterators can be used on the same set. If the set
220
is modified while a QSetIterator is active, the QSetIterator
221
will continue iterating over the original set, ignoring the
222
modified copy.
223
224
\sa QMutableSetIterator, QSet::const_iterator
225
*/
226
227
/*!
228
\class QMutableListIterator
229
\inmodule QtCore
230
231
\brief The QMutableListIterator class provides a Java-style non-const iterator for QList, QQueue and QStack.
232
233
QList has both \l{Java-style iterators} and \l{STL-style
234
iterators}. STL-style iterators are more efficient and should
235
be preferred.
236
237
An alternative to using iterators is to use index positions. Most
238
QList member functions take an index as their first parameter,
239
making it possible to access, insert, and remove items without
240
using iterators.
241
242
QMutableListIterator<T> allows you to iterate over a QList<T>
243
(or a QQueue<T>) and modify the list. If you don't want to
244
modify the list (or have a const QList), use the slightly faster
245
QListIterator<T> instead.
246
247
The QMutableListIterator constructor takes a QList as argument.
248
After construction, the iterator is located at the very beginning
249
of the list (before the first item). Here's how to iterate over
250
all the elements sequentially:
251
252
\snippet code/doc_src_qiterator.cpp 8
253
254
The next() function returns the next item in the list and
255
advances the iterator. Unlike STL-style iterators, Java-style
256
iterators point \e between items rather than directly \e at
257
items. The first call to next() advances the iterator to the
258
position between the first and second item, and returns the first
259
item; the second call to next() advances the iterator to the
260
position between the second and third item, returning the second
261
item; and so on.
262
263
\image javaiterators1.png
264
265
Here's how to iterate over the elements in reverse order:
266
267
\snippet code/doc_src_qiterator.cpp 9
268
269
If you want to find all occurrences of a particular value, use
270
findNext() or findPrevious() in a loop.
271
272
If you want to remove items as you iterate over the list, use
273
remove(). If you want to modify the value of an item, use
274
setValue(). If you want to insert a new item in the list, use
275
insert().
276
277
Example:
278
\snippet code/doc_src_qiterator.cpp 10
279
280
The example traverses a list, replacing negative numbers with
281
their absolute values, and eliminating zeroes.
282
283
Only one mutable iterator can be active on a given list at any
284
time. Furthermore, no changes should be done directly to the list
285
while the iterator is active (as opposed to through the
286
iterator), since this could invalidate the iterator and lead to
287
undefined behavior.
288
289
\sa QListIterator, QList::iterator
290
*/
291
292
/*!
293
\class QMutableSetIterator
294
\inmodule QtCore
295
\since 4.2
296
297
\brief The QMutableSetIterator class provides a Java-style non-const iterator for QSet.
298
299
QSet has both \l{Java-style iterators} and \l{STL-style
300
iterators}. STL-style iterators are more efficient and should
301
be preferred.
302
303
QMutableSetIterator<T> allows you to iterate over a QSet<T>
304
and remove items from the set as you iterate. If you don't want
305
to modify the set (or have a const QSet), use the slightly faster
306
QSetIterator<T> instead.
307
308
The QMutableSetIterator constructor takes a QSet as argument.
309
After construction, the iterator is located at the very beginning
310
of the set (before the first item). Here's how to iterate over
311
all the elements sequentially:
312
313
\snippet code/doc_src_qiterator.cpp 17
314
315
The next() function returns the next item in the set and
316
advances the iterator. Unlike STL-style iterators, Java-style
317
iterators point \e between items rather than directly \e at
318
items. The first call to next() advances the iterator to the
319
position between the first and second item, and returns the first
320
item; the second call to next() advances the iterator to the
321
position between the second and third item, returning the second
322
item; and so on.
323
324
\image javaiterators1.png
325
326
If you want to remove items as you iterate over the set, use
327
remove().
328
329
Only one mutable iterator can be active on a given set at any
330
time. Furthermore, no changes should be done directly to the set
331
while the iterator is active (as opposed to through the
332
iterator), since this could invalidate the iterator and lead to
333
undefined behavior.
334
335
\sa QSetIterator, QSet::iterator
336
*/
337
338
/*!
339
\fn template <class T> QListIterator<T>::QListIterator(const QList<T> &list)
340
\fn template <class T> QMutableListIterator<T>::QMutableListIterator(QList<T> &list)
341
342
Constructs an iterator for traversing \a list. The iterator is
343
set to be at the front of the list (before the first item).
344
345
\sa operator=()
346
*/
347
348
/*!
349
\fn template <class T> QSetIterator<T>::QSetIterator(const QSet<T> &set)
350
\fn template <class T> QMutableSetIterator<T>::QMutableSetIterator(QSet<T> &set)
351
352
Constructs an iterator for traversing \a set. The iterator is
353
set to be at the front of the set (before the first item).
354
355
\sa operator=()
356
*/
357
358
/*! \fn template <class T> QMutableListIterator &QMutableListIterator<T>::operator=(QList<T> &list)
359
\fn template <class T> QListIterator &QListIterator<T>::operator=(const QList<T> &list)
360
361
Makes the iterator operate on \a list. The iterator is set to be
362
at the front of the list (before the first item).
363
364
\sa toFront(), toBack()
365
*/
366
367
/*! \fn template <class T> QSetIterator &QSetIterator<T>::operator=(const QSet<T> &set)
368
\fn template <class T> QMutableSetIterator &QMutableSetIterator<T>::operator=(QSet<T> &set)
369
370
Makes the iterator operate on \a set. The iterator is set to be
371
at the front of the set (before the first item).
372
373
\sa toFront(), toBack()
374
*/
375
376
/*! \fn template <class T> void QListIterator<T>::toFront()
377
\fn template <class T> void QSetIterator<T>::toFront()
378
\fn template <class T> void QMutableListIterator<T>::toFront()
379
\fn template <class T> void QMutableSetIterator<T>::toFront()
380
381
Moves the iterator to the front of the container (before the
382
first item).
383
384
\sa toBack(), next()
385
*/
386
387
/*! \fn template <class T> void QListIterator<T>::toBack()
388
\fn template <class T> void QMutableListIterator<T>::toBack()
389
390
//! [toBack]
391
Moves the iterator to the back of the container (after the last
392
item).
393
//! [toBack]
394
395
\sa toFront(), previous()
396
*/
397
398
/*! \fn template <class T> void QSetIterator<T>::toBack()
399
\include qiterator.qdoc toBack
400
\sa toFront()
401
*/
402
403
/*! \fn template <class T> void QMutableSetIterator<T>::toBack()
404
405
Moves the iterator to the back of the container (after the last
406
item).
407
408
\sa toFront()
409
*/
410
411
/*! \fn template <class T> bool QListIterator<T>::hasNext() const
412
\fn template <class T> bool QMutableListIterator<T>::hasNext() const
413
414
//! [hasNext]
415
Returns \c true if there is at least one item ahead of the iterator,
416
i.e. the iterator is \e not at the back of the container;
417
otherwise returns \c false.
418
//! [hasNext]
419
420
\sa hasPrevious(), next()
421
*/
422
423
/*! \fn template <class T> bool QSetIterator<T>::hasNext() const
424
\include qiterator.qdoc hasNext
425
\sa next()
426
*/
427
428
/*! \fn template <class T> bool QMutableSetIterator<T>::hasNext() const
429
430
Returns \c true if there is at least one item ahead of the iterator,
431
i.e. the iterator is \e not at the back of the container;
432
otherwise returns \c false.
433
434
\sa next()
435
*/
436
437
/*! \fn template <class T> const T &QListIterator<T>::next()
438
439
//! [next]
440
Returns the next item and advances the iterator by one position.
441
442
Calling this function on an iterator located at the back of the
443
container leads to undefined results.
444
//! [next]
445
446
\sa hasNext(), peekNext(), previous()
447
*/
448
449
/*!
450
\fn template <class T> const T &QSetIterator<T>::next()
451
\include qiterator.qdoc next
452
\sa hasNext(), peekNext()
453
*/
454
455
/* \fn template <class T> const T &QMutableSetIterator<T>::next()
456
Returns the next item and advances the iterator by one position.
457
458
Calling this function on an iterator located at the back of the
459
container leads to undefined results.
460
461
\sa hasNext(), peekNext()
462
*/
463
464
/*! \fn template <class T> const T &QMutableSetIterator<T>::next()
465
466
Returns the next item and advances the iterator by one position.
467
468
Calling this function on an iterator located at the back of the
469
container leads to undefined results.
470
471
\sa hasNext(), peekNext()
472
*/
473
474
/*! \fn template <class T> T &QMutableListIterator<T>::next()
475
476
Returns a reference to the next item, and advances the iterator
477
by one position.
478
479
Calling this function on an iterator located at the back of the
480
container leads to undefined results.
481
482
\sa hasNext(), peekNext(), previous()
483
*/
484
485
/*! \fn template <class T> const T &QListIterator<T>::peekNext() const
486
487
//! [peekNext]
488
Returns the next item without moving the iterator.
489
490
Calling this function on an iterator located at the back of the
491
container leads to undefined results.
492
//! [peekNext]
493
494
\sa hasNext(), next(), peekPrevious()
495
*/
496
497
/*!
498
\fn template <class T> const T &QSetIterator<T>::peekNext() const
499
\include qiterator.qdoc peekNext
500
\sa hasNext(), next()
501
*/
502
503
/*!
504
\fn template <class T> const T &QMutableSetIterator<T>::peekNext() const
505
506
Returns the next item without moving the iterator.
507
508
Calling this function on an iterator located at the back of the
509
container leads to undefined results.
510
511
\sa hasNext(), next()
512
*/
513
514
/*! \fn template <class T> T &QMutableListIterator<T>::peekNext() const
515
516
Returns a reference to the next item, without moving the iterator.
517
518
Calling this function on an iterator located at the back of the
519
container leads to undefined results.
520
521
\sa hasNext(), next(), peekPrevious()
522
*/
523
524
/*! \fn template <class T> bool QListIterator<T>::hasPrevious() const
525
\fn template <class T> bool QMutableListIterator<T>::hasPrevious() const
526
527
Returns \c true if there is at least one item behind the iterator,
528
i.e. the iterator is \e not at the front of the container;
529
otherwise returns \c false.
530
531
\sa hasNext(), previous()
532
*/
533
534
/*! \fn template <class T> const T &QListIterator<T>::previous()
535
536
Returns the previous item and moves the iterator back by one
537
position.
538
539
Calling this function on an iterator located at the front of the
540
container leads to undefined results.
541
542
\sa hasPrevious(), peekPrevious(), next()
543
*/
544
545
/*! \fn template <class T> T &QMutableListIterator<T>::previous()
546
547
Returns a reference to the previous item and moves the iterator
548
back by one position.
549
550
Calling this function on an iterator located at the front of the
551
container leads to undefined results.
552
553
\sa hasPrevious(), peekPrevious(), next()
554
*/
555
556
/*! \fn template <class T> const T &QListIterator<T>::peekPrevious() const
557
558
Returns the previous item without moving the iterator.
559
560
Calling this function on an iterator located at the front of the
561
container leads to undefined results.
562
563
\sa hasPrevious(), previous(), peekNext()
564
*/
565
566
/*! \fn template <class T> T &QMutableListIterator<T>::peekPrevious() const
567
568
Returns a reference to the previous item, without moving the iterator.
569
570
Calling this function on an iterator located at the front of the
571
container leads to undefined results.
572
573
\sa hasPrevious(), previous(), peekNext()
574
*/
575
576
/*!
577
\fn template <class T> bool QMutableSetIterator<T>::findNext(const T &value)
578
579
Searches for \a value starting from the current iterator position
580
forward. Returns \c true if \a value is found; otherwise returns \c false.
581
582
After the call, if \a value was found, the iterator is positioned
583
just after the matching item; otherwise, the iterator is
584
positioned at the back of the container.
585
*/
586
587
/*! \fn template <class T> bool QListIterator<T>::findNext(const T &value)
588
\fn template <class T> bool QMutableListIterator<T>::findNext(const T &value)
589
590
//! [findNext]
591
Searches for \a value starting from the current iterator position
592
forward. Returns \c true if \a value is found; otherwise returns \c false.
593
594
After the call, if \a value was found, the iterator is positioned
595
just after the matching item; otherwise, the iterator is
596
positioned at the back of the container.
597
//! [findNext]
598
599
\sa findPrevious()
600
*/
601
602
/*! \fn template <class T> bool QSetIterator<T>::findNext(const T &value)
603
\include qiterator.qdoc findNext
604
*/
605
606
/*! \fn template <class T> bool QListIterator<T>::findPrevious(const T &value)
607
\fn template <class T> bool QMutableListIterator<T>::findPrevious(const T &value)
608
609
Searches for \a value starting from the current iterator position
610
backward. Returns \c true if \a value is found; otherwise returns
611
false.
612
613
After the call, if \a value was found, the iterator is positioned
614
just before the matching item; otherwise, the iterator is
615
positioned at the front of the container.
616
617
\sa findNext()
618
*/
619
620
/*! \fn template <class T> void QMutableListIterator<T>::remove()
621
622
Removes the last item that was jumped over using one of the
623
traversal functions (next(), previous(), findNext(), findPrevious()).
624
625
Example:
626
\snippet code/doc_src_qiterator.cpp 19
627
628
\sa insert(), setValue()
629
*/
630
631
/*! \fn template <class T> void QMutableSetIterator<T>::remove()
632
633
Removes the last item that was jumped over using one of the
634
traversal functions (next(), findNext()).
635
636
Example:
637
\snippet code/doc_src_qiterator.cpp 22
638
639
\sa value()
640
*/
641
642
/*! \fn template <class T> void QMutableListIterator<T>::setValue(const T &value) const
643
644
Replaces the value of the last item that was jumped over using
645
one of the traversal functions with \a value.
646
647
The traversal functions are next(), previous(), findNext(), and
648
findPrevious().
649
650
Example:
651
\snippet code/doc_src_qiterator.cpp 23
652
653
\sa value(), remove(), insert()
654
*/
655
656
/*! \fn template <class T> const T &QMutableListIterator<T>::value() const
657
658
Returns the value of the last item that was jumped over using one
659
of the traversal functions (next(), previous(), findNext(),
660
findPrevious()).
661
662
After a call to next() or findNext(), value() is equivalent to
663
peekPrevious(). After a call to previous() or findPrevious(), value() is
664
equivalent to peekNext().
665
*/
666
667
/*! \fn template <class T> const T &QMutableSetIterator<T>::value() const
668
669
Returns the value of the last item that was jumped over using
670
next() or findNext().
671
*/
672
673
/*!
674
\fn template <class T> T &QMutableListIterator<T>::value()
675
\overload
676
677
Returns a non-const reference to the value of the last item that
678
was jumped over using one of the traversal functions.
679
*/
680
681
/*! \fn template <class T> void QMutableListIterator<T>::insert(const T &value)
682
683
Inserts \a value at the current iterator position. After the
684
call, the iterator is located just after the inserted item.
685
686
\sa remove(), setValue()
687
*/
688
689
/*!
690
\class QMapIterator
691
\inmodule QtCore
692
693
\brief The QMapIterator class provides a Java-style const iterator for QMap.
694
695
QMap has both \l{Java-style iterators} and \l{STL-style
696
iterators}. STL-style iterators are more efficient and should
697
be preferred.
698
699
QMapIterator<Key, T> allows you to iterate over a QMap.
700
If you want to modify the map as you iterate over
701
it, use QMutableMapIterator instead.
702
703
The QMapIterator constructor takes a QMap as argument. After
704
construction, the iterator is located at the very beginning of
705
the map (before the first item). Here's how to iterate over all
706
the elements sequentially:
707
708
\snippet code/doc_src_qiterator.cpp 26
709
710
The next() function returns the next item in the map and
711
advances the iterator. The key() and value() functions return the
712
key and value of the last item that was jumped over.
713
714
Unlike STL-style iterators, Java-style iterators point \e between
715
items rather than directly \e at items. The first call to next()
716
advances the iterator to the position between the first and
717
second item, and returns the first item; the second call to
718
next() advances the iterator to the position between the second
719
and third item; and so on.
720
721
\image javaiterators1.png
722
723
Here's how to iterate over the elements in reverse order:
724
725
\snippet code/doc_src_qiterator.cpp 27
726
727
If you want to find all occurrences of a particular value, use
728
findNext() or findPrevious() in a loop. For example:
729
730
\snippet code/doc_src_qiterator.cpp 28
731
732
Multiple iterators can be used on the same map. If the map is
733
modified while a QMapIterator is active, the QMapIterator will
734
continue iterating over the original map, ignoring the modified
735
copy.
736
737
\sa QMutableMapIterator, QMap::const_iterator
738
*/
739
740
/*!
741
\class QMultiMapIterator
742
\inmodule QtCore
743
744
\brief The QMultiMapIterator class provides a Java-style const iterator for QMultiMap.
745
QMultiMap has both \l{Java-style iterators} and \l{STL-style
746
iterators}. STL-style iterators are more efficient and should
747
be preferred.
748
749
QMultiMapIterator<Key, T> allows you to iterate over a QMultiMap.
750
If you want to modify the map as you iterate over
751
it, use QMutableMultiMapIterator instead.
752
753
The QMultiMapIterator constructor takes a QMultiMap as argument. After
754
construction, the iterator is located at the very beginning of
755
the map (before the first item). Here's how to iterate over all
756
the elements sequentially:
757
758
\snippet code/doc_src_qiterator.cpp 26multi
759
760
The next() function returns the next item in the map and
761
advances the iterator. The key() and value() functions return the
762
key and value of the last item that was jumped over.
763
764
Unlike STL-style iterators, Java-style iterators point \e between
765
items rather than directly \e at items. The first call to next()
766
advances the iterator to the position between the first and
767
second item, and returns the first item; the second call to
768
next() advances the iterator to the position between the second
769
and third item; and so on.
770
771
\image javaiterators1.png
772
773
Here's how to iterate over the elements in reverse order:
774
775
\snippet code/doc_src_qiterator.cpp 27multi
776
777
If you want to find all occurrences of a particular value, use
778
findNext() or findPrevious() in a loop. For example:
779
780
\snippet code/doc_src_qiterator.cpp 28multi
781
782
Multiple iterators can be used on the same map. If the map is
783
modified while a QMultiMapIterator is active, the QMultiMapIterator will
784
continue iterating over the original map, ignoring the modified
785
copy.
786
787
\sa QMutableMultiMapIterator
788
*/
789
790
/*!
791
\class QHashIterator
792
\inmodule QtCore
793
794
\brief The QHashIterator class provides a Java-style const iterator for QHash and QMultiHash.
795
796
QHash has both \l{Java-style iterators} and \l{STL-style
797
iterators}. STL-style iterators are more efficient and should
798
be preferred.
799
800
QHashIterator<Key, T> allows you to iterate over a QHash (or a
801
QMultiHash). If you want to modify the hash as you iterate over
802
it, use QMutableHashIterator instead.
803
804
The QHashIterator constructor takes a QHash as argument. After
805
construction, the iterator is located at the very beginning of
806
the hash (before the first item). Here's how to iterate over all
807
the elements sequentially:
808
809
\snippet code/doc_src_qiterator.cpp 29
810
811
The next() function returns the next item in the hash and
812
advances the iterator. The key() and value() functions return the
813
key and value of the last item that was jumped over.
814
815
Unlike STL-style iterators, Java-style iterators point \e between
816
items rather than directly \e at items. The first call to next()
817
advances the iterator to the position between the first and
818
second item, and returns the first item; the second call to
819
next() advances the iterator to the position between the second
820
and third item; and so on.
821
822
\image javaiterators1.png
823
824
If you want to find all occurrences of a particular value, use
825
findNext() in a loop. For example:
826
827
\snippet code/doc_src_qiterator.cpp 31
828
829
Multiple iterators can be used on the same hash. If the hash is
830
modified while a QHashIterator is active, the QHashIterator will
831
continue iterating over the original hash, ignoring the modified
832
copy.
833
834
\sa QMutableHashIterator, QHash::const_iterator
835
*/
836
837
/*!
838
\class QMutableMapIterator
839
\inmodule QtCore
840
841
\brief The QMutableMapIterator class provides a Java-style non-const iterator for QMap.
842
843
QMap has both \l{Java-style iterators} and \l{STL-style
844
iterators}. STL-style iterators are more efficient and should
845
be preferred.
846
847
QMutableMapIterator<Key, T> allows you to iterate over a QMap
848
and modify the map. If you don't want to modify
849
the map (or have a const QMap), use the slightly faster
850
QMapIterator instead.
851
852
The QMutableMapIterator constructor takes a QMap as argument.
853
After construction, the iterator is located at the very beginning
854
of the map (before the first item). Here's how to iterate over
855
all the elements sequentially:
856
857
\snippet code/doc_src_qiterator.cpp 32
858
859
The next() function returns the next item in the map and
860
advances the iterator. The key() and value() functions return the
861
key and value of the last item that was jumped over.
862
863
Unlike STL-style iterators, Java-style iterators point \e between
864
items rather than directly \e at items. The first call to next()
865
advances the iterator to the position between the first and
866
second item, and returns the first item; the second call to
867
next() advances the iterator to the position between the second
868
and third item; and so on.
869
870
\image javaiterators1.png
871
872
Here's how to iterate over the elements in reverse order:
873
874
\snippet code/doc_src_qiterator.cpp 33
875
876
If you want to find all occurrences of a particular value, use
877
findNext() or findPrevious() in a loop. For example:
878
879
\snippet code/doc_src_qiterator.cpp 34
880
881
If you want to remove items as you iterate over the map, use
882
remove(). If you want to modify the value of an item, use
883
setValue().
884
885
Example:
886
887
\snippet code/doc_src_qiterator.cpp 35
888
889
The example removes all (key, value) pairs where the key and the
890
value are the same.
891
892
Only one mutable iterator can be active on a given map at any
893
time. Furthermore, no changes should be done directly to the map
894
while the iterator is active (as opposed to through the
895
iterator), since this could invalidate the iterator and lead to
896
undefined behavior.
897
898
\sa QMapIterator, QMap::iterator
899
*/
900
901
/*!
902
\class QMutableMultiMapIterator
903
\inmodule QtCore
904
905
\brief The QMutableMultiMapIterator class provides a Java-style non-const iterator for QMultiMap.
906
907
QMultiMap has both \l{Java-style iterators} and \l{STL-style
908
iterators}. STL-style iterators are more efficient and should
909
be preferred.
910
911
QMutableMultiMapIterator<Key, T> allows you to iterate over a QMultiMap
912
and modify the map. If you don't want to modify
913
the map (or have a const QMultiMap), use the slightly faster
914
QMultiMapIterator instead.
915
916
The QMutableMultiMapIterator constructor takes a QMultiMap as argument.
917
After construction, the iterator is located at the very beginning
918
of the map (before the first item). Here's how to iterate over
919
all the elements sequentially:
920
921
\snippet code/doc_src_qiterator.cpp 32multi
922
923
The next() function returns the next item in the map and
924
advances the iterator. The key() and value() functions return the
925
key and value of the last item that was jumped over.
926
927
Unlike STL-style iterators, Java-style iterators point \e between
928
items rather than directly \e at items. The first call to next()
929
advances the iterator to the position between the first and
930
second item, and returns the first item; the second call to
931
next() advances the iterator to the position between the second
932
and third item; and so on.
933
934
\image javaiterators1.png
935
936
Here's how to iterate over the elements in reverse order:
937
938
\snippet code/doc_src_qiterator.cpp 33multi
939
940
If you want to find all occurrences of a particular value, use
941
findNext() or findPrevious() in a loop. For example:
942
943
\snippet code/doc_src_qiterator.cpp 34multi
944
945
If you want to remove items as you iterate over the map, use
946
remove(). If you want to modify the value of an item, use
947
setValue().
948
949
Example:
950
951
\snippet code/doc_src_qiterator.cpp 35multi
952
953
The example removes all (key, value) pairs where the key and the
954
value are the same.
955
956
Only one mutable iterator can be active on a given map at any
957
time. Furthermore, no changes should be done directly to the map
958
while the iterator is active (as opposed to through the
959
iterator), since this could invalidate the iterator and lead to
960
undefined behavior.
961
962
\sa QMultiMapIterator, QMultiMap::iterator
963
*/
964
965
/*!
966
\class QMutableHashIterator
967
\inmodule QtCore
968
969
\brief The QMutableHashIterator class provides a Java-style non-const iterator for QHash and QMultiHash.
970
971
QHash has both \l{Java-style iterators} and \l{STL-style
972
iterators}. STL-style iterators are more efficient and should
973
be preferred.
974
975
QMutableHashIterator<Key, T> allows you to iterate over a QHash
976
and modify the hash. If you don't want to modify the hash (or have
977
a const QHash), use the slightly faster QHashIterator instead.
978
979
The QMutableHashIterator constructor takes a QHash as argument.
980
After construction, the iterator is located at the very beginning
981
of the hash (before the first item). Here's how to iterate over
982
all the elements sequentially:
983
984
\snippet code/doc_src_qiterator.cpp 36
985
986
The next() function returns the next item in the hash and
987
advances the iterator. The key() and value() functions return the
988
key and value of the last item that was jumped over.
989
990
Unlike STL-style iterators, Java-style iterators point \e between
991
items rather than directly \e at items. The first call to next()
992
advances the iterator to the position between the first and
993
second item, and returns the first item; the second call to
994
next() advances the iterator to the position between the second
995
and third item; and so on.
996
997
\image javaiterators1.png
998
999
If you want to find all occurrences of a particular value, use
1000
findNext() in a loop. For example:
1001
1002
\snippet code/doc_src_qiterator.cpp 38
1003
1004
If you want to remove items as you iterate over the hash, use
1005
remove(). If you want to modify the value of an item, use
1006
setValue().
1007
1008
Example:
1009
1010
\snippet code/doc_src_qiterator.cpp 39
1011
1012
The example removes all (key, value) pairs where the key and the
1013
value are the same.
1014
1015
Only one mutable iterator can be active on a given hash at any
1016
time. Furthermore, no changes should be done directly to the hash
1017
while the iterator is active (as opposed to through the
1018
iterator), since this could invalidate the iterator and lead to
1019
undefined behavior.
1020
1021
\sa QHashIterator, QHash::iterator
1022
*/
1023
1024
/*! \fn template <class Key, class T> QMapIterator<Key, T>::QMapIterator(const QMap<Key, T> &map)
1025
\fn template <class Key, class T> QMutableMapIterator<Key, T>::QMutableMapIterator(QMap<Key, T> &map)
1026
\fn template <class Key, class T> QMultiMapIterator<Key, T>::QMultiMapIterator(const QMultiMap<Key, T> &map)
1027
\fn template <class Key, class T> QMutableMultiMapIterator<Key, T>::QMutableMultiMapIterator(QMultiMap<Key, T> &map)
1028
1029
Constructs an iterator for traversing \a map. The iterator is set
1030
to be at the front of the map (before the first item).
1031
1032
\sa operator=()
1033
*/
1034
1035
/*! \fn template <class Key, class T> QHashIterator<Key, T>::QHashIterator(const QHash<Key, T> &hash)
1036
\fn template <class Key, class T> QMutableHashIterator<Key, T>::QMutableHashIterator(QHash<Key, T> &hash)
1037
1038
Constructs an iterator for traversing \a hash. The iterator is
1039
set to be at the front of the hash (before the first item).
1040
1041
\sa operator=()
1042
*/
1043
1044
/*! \fn template <class Key, class T> QMapIterator &QMapIterator<Key, T>::operator=(const QMap<Key, T> &map)
1045
\fn template <class Key, class T> QMutableMapIterator &QMutableMapIterator<Key, T>::operator=(QMap<Key, T> &map)
1046
\fn template <class Key, class T> QMultiMapIterator &QMultiMapIterator<Key, T>::operator=(const QMultiMap<Key, T> &map)
1047
\fn template <class Key, class T> QMutableMultiMapIterator &QMutableMultiMapIterator<Key, T>::operator=(QMultiMap<Key, T> &map)
1048
1049
Makes the iterator operate on \a map. The iterator is set to be
1050
at the front of the map (before the first item).
1051
1052
\sa toFront(), toBack()
1053
*/
1054
1055
/*! \fn template <class Key, class T> QHashIterator &QHashIterator<Key, T>::operator=(const QHash<Key, T> &hash)
1056
\fn template <class Key, class T> QMutableHashIterator &QMutableHashIterator<Key, T>::operator=(QHash<Key, T> &hash)
1057
1058
Makes the iterator operate on \a hash. The iterator is set to be
1059
at the front of the hash (before the first item).
1060
1061
\sa toFront(), toBack()
1062
*/
1063
1064
/*! \fn template <class Key, class T> void QMapIterator<Key, T>::toFront()
1065
\fn template <class Key, class T> void QMultiMapIterator<Key, T>::toFront()
1066
\fn template <class Key, class T> void QHashIterator<Key, T>::toFront()
1067
\fn template <class Key, class T> void QMutableMapIterator<Key, T>::toFront()
1068
\fn template <class Key, class T> void QMutableMultiMapIterator<Key, T>::toFront()
1069
\fn template <class Key, class T> void QMutableHashIterator<Key, T>::toFront()
1070
1071
Moves the iterator to the front of the container (before the
1072
first item).
1073
1074
\sa toBack(), next()
1075
*/
1076
1077
/*! \fn template <class Key, class T> void QMapIterator<Key, T>::toBack()
1078
\fn template <class Key, class T> void QMultiMapIterator<Key, T>::toBack()
1079
\fn template <class Key, class T> void QMutableMapIterator<Key, T>::toBack()
1080
\fn template <class Key, class T> void QMutableMultiMapIterator<Key, T>::toBack()
1081
1082
Moves the iterator to the back of the container (after the last
1083
item).
1084
1085
\sa toFront(), previous()
1086
*/
1087
1088
/*!
1089
\fn template <class Key, class T> void QHashIterator<Key, T>::toBack()
1090
\fn template <class Key, class T> void QMutableHashIterator<Key, T>::toBack()
1091
1092
Moves the iterator to the back of the container (after the last
1093
item).
1094
1095
\sa toFront()
1096
*/
1097
1098
/*! \fn template <class Key, class T> bool QMapIterator<Key, T>::hasNext() const
1099
\fn template <class Key, class T> bool QMultiMapIterator<Key, T>::hasNext() const
1100
\fn template <class Key, class T> bool QMutableMapIterator<Key, T>::hasNext() const
1101
\fn template <class Key, class T> bool QMutableMultiMapIterator<Key, T>::hasNext() const
1102
1103
Returns \c true if there is at least one item ahead of the iterator,
1104
i.e. the iterator is \e not at the back of the container;
1105
otherwise returns \c false.
1106
1107
\sa hasPrevious(), next()
1108
*/
1109
1110
/*!
1111
\fn template <class Key, class T> bool QHashIterator<Key, T>::hasNext() const
1112
\fn template <class Key, class T> bool QMutableHashIterator<Key, T>::hasNext() const
1113
1114
Returns \c true if there is at least one item ahead of the iterator,
1115
i.e. the iterator is \e not at the back of the container;
1116
otherwise returns \c false.
1117
1118
\sa next()
1119
*/
1120
1121
/*! \fn template <class Key, class T> QMapIterator<Key, T>::Item QMapIterator<Key, T>::next()
1122
\fn template <class Key, class T> QMultiMapIterator<Key, T>::Item QMultiMapIterator<Key, T>::next()
1123
1124
Returns the next item and advances the iterator by one position.
1125
1126
Call key() on the return value to obtain the item's key, and
1127
value() to obtain the value.
1128
1129
Calling this function on an iterator located at the back of the
1130
container leads to undefined results.
1131
1132
\sa hasNext(), {QMapIterator::}{peekNext()}, previous()
1133
*/
1134
1135
/*! \fn template <class Key, class T> QMutableMapIterator<Key, T>::Item QMutableMapIterator<Key, T>::next()
1136
\fn template <class Key, class T> QMutableMultiMapIterator<Key, T>::Item QMutableMultiMapIterator<Key, T>::next()
1137
1138
Returns the next item and advances the iterator by one position.
1139
1140
Call key() on the return value to obtain the item's key, and
1141
value() to obtain the value.
1142
1143
Calling this function on an iterator located at the back of the
1144
container leads to undefined results.
1145
1146
\sa hasNext(), peekNext(), previous()
1147
*/
1148
1149
/*!
1150
\fn template <class Key, class T> QHashIterator<Key, T>::Item QHashIterator<Key, T>::next()
1151
1152
Returns the next item and advances the iterator by one position.
1153
1154
Call key() on the return value to obtain the item's key, and
1155
value() to obtain the value.
1156
1157
Calling this function on an iterator located at the back of the
1158
container leads to undefined results.
1159
1160
\sa hasNext(), peekNext()
1161
*/
1162
1163
/*!
1164
\fn template <class Key, class T> QMutableHashIterator<Key, T>::Item QMutableHashIterator<Key, T>::next()
1165
1166
Returns the next item and advances the iterator by one position.
1167
1168
Call key() on the return value to obtain the item's key, and
1169
value() to obtain the value.
1170
1171
Calling this function on an iterator located at the back of the
1172
container leads to undefined results.
1173
1174
\sa hasNext(), peekNext()
1175
*/
1176
1177
/*! \fn template <class Key, class T> QMapIterator<Key, T>::Item QMapIterator<Key, T>::peekNext() const
1178
\fn template <class Key, class T> QMutableMapIterator<Key, T>::Item QMutableMapIterator<Key, T>::peekNext() const
1179
1180
Returns the next item without moving the iterator.
1181
1182
Call key() on the return value to obtain the item's key, and
1183
value() to obtain the value.
1184
1185
Calling this function on an iterator located at the back of the
1186
container leads to undefined results.
1187
1188
\sa hasNext(), next(), peekPrevious()
1189
*/
1190
1191
/*! \fn template <class Key, class T> QMutableMapIterator<Key, T>::Item QMutableMapIterator<Key, T>::peekNext() const
1192
\fn template <class Key, class T> QMutableMultiMapIterator<Key, T>::Item QMutableMultiMapIterator<Key, T>::peekNext() const
1193
1194
Returns a reference to the next item without moving the iterator.
1195
1196
Call key() on the return value to obtain the item's key, and
1197
value() to obtain the value.
1198
1199
Calling this function on an iterator located at the back of the
1200
container leads to undefined results.
1201
1202
\sa hasNext(), next(), peekPrevious()
1203
*/
1204
1205
/*!
1206
\fn template <class Key, class T> QHashIterator<Key, T>::Item QHashIterator<Key, T>::peekNext() const
1207
1208
Returns the next item without moving the iterator.
1209
1210
Call key() on the return value to obtain the item's key, and
1211
value() to obtain the value.
1212
1213
Calling this function on an iterator located at the back of the
1214
container leads to undefined results.
1215
1216
\sa hasNext(), next()
1217
*/
1218
1219
/*!
1220
\fn template <class Key, class T> QMutableHashIterator<Key, T>::Item QMutableHashIterator<Key, T>::peekNext() const
1221
1222
Returns a reference to the next item without moving the iterator.
1223
1224
Call key() on the return value to obtain the item's key, and
1225
value() to obtain the value.
1226
1227
Calling this function on an iterator located at the back of the
1228
container leads to undefined results.
1229
1230
\sa hasNext(), next()
1231
*/
1232
1233
/*! \fn template <class Key, class T> bool QMapIterator<Key, T>::hasPrevious() const
1234
\fn template <class Key, class T> bool QMultiMapIterator<Key, T>::hasPrevious() const
1235
\fn template <class Key, class T> bool QMutableMapIterator<Key, T>::hasPrevious() const
1236
\fn template <class Key, class T> bool QMutableMultiMapIterator<Key, T>::hasPrevious() const
1237
1238
Returns \c true if there is at least one item behind the iterator,
1239
i.e. the iterator is \e not at the front of the container;
1240
otherwise returns \c false.
1241
1242
\sa hasNext(), previous()
1243
*/
1244
1245
/*! \fn template <class Key, class T> QMapIterator<Key, T>::Item QMapIterator<Key, T>::previous()
1246
\fn template <class Key, class T> QMutableMapIterator<Key, T>::Item QMutableMapIterator<Key, T>::previous()
1247
\fn template <class Key, class T> QMultiMapIterator<Key, T>::Item QMultiMapIterator<Key, T>::previous()
1248
\fn template <class Key, class T> QMutableMultiMapIterator<Key, T>::Item QMutableMultiMapIterator<Key, T>::previous()
1249
1250
Returns the previous item and moves the iterator back by one
1251
position.
1252
1253
Call key() on the return value to obtain the item's key, and
1254
value() to obtain the value.
1255
1256
Calling this function on an iterator located at the front of the
1257
container leads to undefined results.
1258
1259
\sa hasPrevious(), peekPrevious(), next()
1260
*/
1261
1262
/*! \fn template <class Key, class T> QMapIterator<Key, T>::Item QMapIterator<Key, T>::peekPrevious() const
1263
\fn template <class Key, class T> QMutableMapIterator<Key, T>::Item QMutableMapIterator<Key, T>::peekPrevious() const
1264
\fn template <class Key, class T> QMultiMapIterator<Key, T>::Item QMultiMapIterator<Key, T>::peekPrevious() const
1265
\fn template <class Key, class T> QMutableMultiMapIterator<Key, T>::Item QMutableMultiMapIterator<Key, T>::peekPrevious() const
1266
1267
Returns the previous item without moving the iterator.
1268
1269
Call key() on the return value to obtain the item's key, and
1270
value() to obtain the value.
1271
1272
Calling this function on an iterator located at the front of the
1273
container leads to undefined results.
1274
1275
\sa hasPrevious(), previous(), {QMapIterator::}{peekNext()}
1276
*/
1277
1278
/*! \fn template <class Key, class T> const T &QMapIterator<Key, T>::value() const
1279
\fn template <class Key, class T> const T &QMultiMapIterator<Key, T>::value() const
1280
1281
Returns the value of the last item that was jumped over using one
1282
of the traversal functions (next(), previous(), findNext(),
1283
findPrevious()).
1284
1285
After a call to next() or findNext(), value() is
1286
equivalent to peekPrevious().value(). After a call to previous()
1287
or findPrevious(), value() is equivalent to peekNext().value().
1288
1289
\sa key()
1290
*/
1291
1292
/*!
1293
\fn template <class Key, class T> const T &QMutableMapIterator<Key, T>::value() const
1294
\fn template <class Key, class T> const T &QMutableMultiMapIterator<Key, T>::value() const
1295
1296
Returns the value of the last item that was jumped over using one
1297
of the traversal functions (next(), previous(), findNext(),
1298
findPrevious()).
1299
1300
After a call to next() or findNext(), value() is
1301
equivalent to peekPrevious().value(). After a call to previous()
1302
or findPrevious(), value() is equivalent to peekNext().value().
1303
1304
\sa key(), setValue()
1305
*/
1306
1307
/*! \fn template <class Key, class T> const T &QHashIterator<Key, T>::value() const
1308
1309
Returns the value of the last item that was jumped over using one
1310
of the traversal functions (next(), findNext()).
1311
1312
\sa key()
1313
*/
1314
1315
/*!
1316
\fn template <class Key, class T> const T &QMutableHashIterator<Key, T>::value() const
1317
1318
Returns the value of the last item that was jumped over using one
1319
of the traversal functions (next(), findNext()).
1320
1321
\sa key(), setValue()
1322
*/
1323
1324
/*!
1325
\fn template <class Key, class T> T &QMutableMapIterator<Key, T>::value()
1326
\fn template <class Key, class T> T &QMutableMultiMapIterator<Key, T>::value()
1327
\fn template <class Key, class T> T &QMutableHashIterator<Key, T>::value()
1328
\overload
1329
1330
Returns a non-const reference to the value of
1331
the last item that was jumped over using one
1332
of the traversal functions.
1333
*/
1334
1335
/*! \fn template <class Key, class T> const Key &QMapIterator<Key, T>::key() const
1336
\fn template <class Key, class T> const Key &QMutableMapIterator<Key, T>::key() const
1337
\fn template <class Key, class T> const Key &QMultiMapIterator<Key, T>::key() const
1338
\fn template <class Key, class T> const Key &QMutableMultiMapIterator<Key, T>::key() const
1339
1340
Returns the key of the last item that was jumped over using one
1341
of the traversal functions (next(), previous(), findNext(),
1342
findPrevious()).
1343
1344
After a call to next() or findNext(), key() is
1345
equivalent to peekPrevious().key(). After a call to previous() or
1346
findPrevious(), key() is equivalent to peekNext().key().
1347
1348
\sa value()
1349
*/
1350
1351
/*! \fn template <class Key, class T> const Key &QHashIterator<Key, T>::key() const
1352
\fn template <class Key, class T> const Key &QMutableHashIterator<Key, T>::key() const
1353
1354
Returns the key of the last item that was jumped over using one
1355
of the traversal functions (next(), findNext()).
1356
1357
\sa value()
1358
*/
1359
1360
/*! \fn template <class Key, class T> bool QMapIterator<Key, T>::findNext(const T &value)
1361
\fn template <class Key, class T> bool QMutableMapIterator<Key, T>::findNext(const T &value)
1362
\fn template <class Key, class T> bool QMultiMapIterator<Key, T>::findNext(const T &value)
1363
\fn template <class Key, class T> bool QMutableMultiMapIterator<Key, T>::findNext(const T &value)
1364
1365
Searches for \a value starting from the current iterator position
1366
forward. Returns \c true if a (key, value) pair with value \a value
1367
is found; otherwise returns \c false.
1368
1369
After the call, if \a value was found, the iterator is positioned
1370
just after the matching item; otherwise, the iterator is
1371
positioned at the back of the container.
1372
1373
\sa findPrevious()
1374
*/
1375
1376
/*! \fn template <class Key, class T> bool QHashIterator<Key, T>::findNext(const T &value)
1377
\fn template <class Key, class T> bool QMutableHashIterator<Key, T>::findNext(const T &value)
1378
1379
Searches for \a value starting from the current iterator position
1380
forward. Returns \c true if a (key, value) pair with value \a value
1381
is found; otherwise returns \c false.
1382
1383
After the call, if \a value was found, the iterator is positioned
1384
just after the matching item; otherwise, the iterator is
1385
positioned at the back of the container.
1386
*/
1387
1388
/*! \fn template <class Key, class T> bool QMapIterator<Key, T>::findPrevious(const T &value)
1389
\fn template <class Key, class T> bool QMutableMapIterator<Key, T>::findPrevious(const T &value)
1390
\fn template <class Key, class T> bool QMultiMapIterator<Key, T>::findPrevious(const T &value)
1391
\fn template <class Key, class T> bool QMutableMultiMapIterator<Key, T>::findPrevious(const T &value)
1392
1393
Searches for \a value starting from the current iterator position
1394
backward. Returns \c true if a (key, value) pair with value \a value
1395
is found; otherwise returns \c false.
1396
1397
After the call, if \a value was found, the iterator is positioned
1398
just before the matching item; otherwise, the iterator is
1399
positioned at the front of the container.
1400
1401
\sa findNext()
1402
*/
1403
1404
/*! \fn template <class Key, class T> void QMutableMapIterator<Key, T>::remove()
1405
\fn template <class Key, class T> void QMutableMultiMapIterator<Key, T>::remove()
1406
1407
Removes the last item that was jumped over using one of the
1408
traversal functions (next(), previous(), findNext(), findPrevious()).
1409
1410
\sa setValue()
1411
*/
1412
1413
/*! \fn template <class Key, class T> void QMutableHashIterator<Key, T>::remove()
1414
1415
Removes the last item that was jumped over using one of the
1416
traversal functions (next(), findNext()).
1417
1418
\sa setValue()
1419
*/
1420
1421
/*! \fn template <class Key, class T> void QMutableMapIterator<Key, T>::setValue(const T &value)
1422
\fn template <class Key, class T> void QMutableMultiMapIterator<Key, T>::setValue(const T &value)
1423
1424
Replaces the value of the last item that was jumped over using
1425
one of the traversal functions with \a value.
1426
1427
The traversal functions are next(), previous(), findNext(), and
1428
findPrevious().
1429
1430
\sa key(), value(), remove()
1431
*/
1432
1433
/*!
1434
\fn template <class Key, class T> void QMutableHashIterator<Key, T>::setValue(const T &value)
1435
1436
Replaces the value of the last item that was jumped over using
1437
one of the traversal functions with \a value.
1438
1439
The traversal functions are next() and findNext().
1440
1441
\sa key(), value(), remove()
1442
*/
qtbase
src
corelib
tools
qiterator.qdoc
Generated on Sun Mar 9 2025 01:10:26 for Qt by
1.13.2