Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qlist.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||||||||
2 | ** | - | ||||||||||||
3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||||||||
4 | ** Copyright (C) 2015 Intel Corporation. | - | ||||||||||||
5 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||
6 | ** | - | ||||||||||||
7 | ** This file is part of the QtCore module of the Qt Toolkit. | - | ||||||||||||
8 | ** | - | ||||||||||||
9 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||
10 | ** Commercial License Usage | - | ||||||||||||
11 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||
12 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||
13 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||
14 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||
15 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||||||||
16 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||||||||
17 | ** | - | ||||||||||||
18 | ** GNU Lesser General Public License Usage | - | ||||||||||||
19 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||
20 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||||||||
21 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||
22 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||
23 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||
24 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||
25 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||
26 | ** | - | ||||||||||||
27 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||
28 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||
29 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||
30 | ** | - | ||||||||||||
31 | ** $QT_END_LICENSE$ | - | ||||||||||||
32 | ** | - | ||||||||||||
33 | ****************************************************************************/ | - | ||||||||||||
34 | - | |||||||||||||
35 | #include <new> | - | ||||||||||||
36 | #include "qlist.h" | - | ||||||||||||
37 | #include "qtools_p.h" | - | ||||||||||||
38 | - | |||||||||||||
39 | #include <string.h> | - | ||||||||||||
40 | #include <stdlib.h> | - | ||||||||||||
41 | - | |||||||||||||
42 | QT_BEGIN_NAMESPACE | - | ||||||||||||
43 | - | |||||||||||||
44 | /* | - | ||||||||||||
45 | QList as an array-list combines the easy-of-use of a random | - | ||||||||||||
46 | access interface with fast list operations and the low memory | - | ||||||||||||
47 | management overhead of an array. Accessing elements by index, | - | ||||||||||||
48 | appending, prepending, and removing elements from both the front | - | ||||||||||||
49 | and the back all happen in constant time O(1). Inserting or | - | ||||||||||||
50 | removing elements at random index positions \ai happens in linear | - | ||||||||||||
51 | time, or more precisly in O(min{i,n-i}) <= O(n/2), with n being | - | ||||||||||||
52 | the number of elements in the list. | - | ||||||||||||
53 | */ | - | ||||||||||||
54 | - | |||||||||||||
55 | const QListData::Data QListData::shared_null = { Q_REFCOUNT_INITIALIZE_STATIC, 0, 0, 0, { 0 } }; | - | ||||||||||||
56 | - | |||||||||||||
57 | static int grow(int size) | - | ||||||||||||
58 | { | - | ||||||||||||
59 | if (size_t(size) > (MaxAllocSize - QListData::DataHeaderSize) / sizeof(void *))
| 0-1810339 | ||||||||||||
60 | qBadAlloc(); never executed: qBadAlloc(); | 0 | ||||||||||||
61 | // dear compiler: don't optimize me out. | - | ||||||||||||
62 | volatile int x = qAllocMore(size * sizeof(void *), QListData::DataHeaderSize) / sizeof(void *); | - | ||||||||||||
63 | return x; executed 1810339 times by 597 tests: return x; Executed by:
| 1810339 | ||||||||||||
64 | } | - | ||||||||||||
65 | - | |||||||||||||
66 | /*! | - | ||||||||||||
67 | * Detaches the QListData by allocating new memory for a list which will be bigger | - | ||||||||||||
68 | * than the copied one and is expected to grow further. | - | ||||||||||||
69 | * *idx is the desired insertion point and is clamped to the actual size of the list. | - | ||||||||||||
70 | * num is the number of new elements to insert at the insertion point. | - | ||||||||||||
71 | * Returns the old (shared) data, it is up to the caller to deref() and free(). | - | ||||||||||||
72 | * For the new data node_copy needs to be called. | - | ||||||||||||
73 | * | - | ||||||||||||
74 | * \internal | - | ||||||||||||
75 | */ | - | ||||||||||||
76 | QListData::Data *QListData::detach_grow(int *idx, int num) | - | ||||||||||||
77 | { | - | ||||||||||||
78 | Data *x = d; | - | ||||||||||||
79 | int l = x->end - x->begin; | - | ||||||||||||
80 | int nl = l + num; | - | ||||||||||||
81 | int alloc = grow(nl); | - | ||||||||||||
82 | Data* t = static_cast<Data *>(::malloc(DataHeaderSize + alloc * sizeof(void *))); | - | ||||||||||||
83 | Q_CHECK_PTR(t); never executed: qBadAlloc();
| 0-1377860 | ||||||||||||
84 | - | |||||||||||||
85 | t->ref.initializeOwned(); | - | ||||||||||||
86 | t->alloc = alloc; | - | ||||||||||||
87 | // The space reservation algorithm's optimization is biased towards appending: | - | ||||||||||||
88 | // Something which looks like an append will put the data at the beginning, | - | ||||||||||||
89 | // while something which looks like a prepend will put it in the middle | - | ||||||||||||
90 | // instead of at the end. That's based on the assumption that prepending | - | ||||||||||||
91 | // is uncommon and even an initial prepend will eventually be followed by | - | ||||||||||||
92 | // at least some appends. | - | ||||||||||||
93 | int bg; | - | ||||||||||||
94 | if (*idx < 0) {
| 0-1377860 | ||||||||||||
95 | *idx = 0; | - | ||||||||||||
96 | bg = (alloc - nl) >> 1; | - | ||||||||||||
97 | } else if (*idx > l) { never executed: end of block
| 0-1212671 | ||||||||||||
98 | *idx = l; | - | ||||||||||||
99 | bg = 0; | - | ||||||||||||
100 | } else if (*idx < (l >> 1)) { executed 1212671 times by 595 tests: end of block Executed by:
| 3831-1212671 | ||||||||||||
101 | bg = (alloc - nl) >> 1; | - | ||||||||||||
102 | } else { executed 3831 times by 13 tests: end of block Executed by:
| 3831 | ||||||||||||
103 | bg = 0; | - | ||||||||||||
104 | } executed 161358 times by 278 tests: end of block Executed by:
| 161358 | ||||||||||||
105 | t->begin = bg; | - | ||||||||||||
106 | t->end = bg + nl; | - | ||||||||||||
107 | d = t; | - | ||||||||||||
108 | - | |||||||||||||
109 | return x; executed 1377860 times by 597 tests: return x; Executed by:
| 1377860 | ||||||||||||
110 | } | - | ||||||||||||
111 | - | |||||||||||||
112 | /*! | - | ||||||||||||
113 | * Detaches the QListData by allocating new memory for a list which possibly | - | ||||||||||||
114 | * has a different size than the copied one. | - | ||||||||||||
115 | * Returns the old (shared) data, it is up to the caller to deref() and free() | - | ||||||||||||
116 | * For the new data node_copy needs to be called. | - | ||||||||||||
117 | * | - | ||||||||||||
118 | * \internal | - | ||||||||||||
119 | */ | - | ||||||||||||
120 | QListData::Data *QListData::detach(int alloc) | - | ||||||||||||
121 | { | - | ||||||||||||
122 | Data *x = d; | - | ||||||||||||
123 | Data* t = static_cast<Data *>(::malloc(DataHeaderSize + alloc * sizeof(void *))); | - | ||||||||||||
124 | Q_CHECK_PTR(t); never executed: qBadAlloc();
| 0-240371 | ||||||||||||
125 | - | |||||||||||||
126 | t->ref.initializeOwned(); | - | ||||||||||||
127 | t->alloc = alloc; | - | ||||||||||||
128 | if (!alloc) {
| 21599-218772 | ||||||||||||
129 | t->begin = 0; | - | ||||||||||||
130 | t->end = 0; | - | ||||||||||||
131 | } else { executed 21599 times by 135 tests: end of block Executed by:
| 21599 | ||||||||||||
132 | t->begin = x->begin; | - | ||||||||||||
133 | t->end = x->end; | - | ||||||||||||
134 | } executed 218772 times by 451 tests: end of block Executed by:
| 218772 | ||||||||||||
135 | d = t; | - | ||||||||||||
136 | - | |||||||||||||
137 | return x; executed 240371 times by 464 tests: return x; Executed by:
| 240371 | ||||||||||||
138 | } | - | ||||||||||||
139 | - | |||||||||||||
140 | void QListData::realloc(int alloc) | - | ||||||||||||
141 | { | - | ||||||||||||
142 | Q_ASSERT(!d->ref.isShared()); | - | ||||||||||||
143 | Data *x = static_cast<Data *>(::realloc(d, DataHeaderSize + alloc * sizeof(void *))); | - | ||||||||||||
144 | Q_CHECK_PTR(x); never executed: qBadAlloc();
| 0-836 | ||||||||||||
145 | - | |||||||||||||
146 | d = x; | - | ||||||||||||
147 | d->alloc = alloc; | - | ||||||||||||
148 | if (!alloc)
| 0-836 | ||||||||||||
149 | d->begin = d->end = 0; never executed: d->begin = d->end = 0; | 0 | ||||||||||||
150 | } executed 836 times by 15 tests: end of block Executed by:
| 836 | ||||||||||||
151 | - | |||||||||||||
152 | void QListData::realloc_grow(int growth) | - | ||||||||||||
153 | { | - | ||||||||||||
154 | Q_ASSERT(!d->ref.isShared()); | - | ||||||||||||
155 | int alloc = grow(d->alloc + growth); | - | ||||||||||||
156 | Data *x = static_cast<Data *>(::realloc(d, DataHeaderSize + alloc * sizeof(void *))); | - | ||||||||||||
157 | Q_CHECK_PTR(x); never executed: qBadAlloc();
| 0-432479 | ||||||||||||
158 | - | |||||||||||||
159 | d = x; | - | ||||||||||||
160 | d->alloc = alloc; | - | ||||||||||||
161 | } executed 432479 times by 417 tests: end of block Executed by:
| 432479 | ||||||||||||
162 | - | |||||||||||||
163 | void QListData::dispose(Data *d) | - | ||||||||||||
164 | { | - | ||||||||||||
165 | Q_ASSERT(!d->ref.isShared()); | - | ||||||||||||
166 | free(d); | - | ||||||||||||
167 | } executed 1615298 times by 940 tests: end of block Executed by:
| 1615298 | ||||||||||||
168 | - | |||||||||||||
169 | // ensures that enough space is available to append n elements | - | ||||||||||||
170 | void **QListData::append(int n) | - | ||||||||||||
171 | { | - | ||||||||||||
172 | Q_ASSERT(!d->ref.isShared()); | - | ||||||||||||
173 | int e = d->end; | - | ||||||||||||
174 | if (e + n > d->alloc) {
| 1449420-8678145 | ||||||||||||
175 | int b = d->begin; | - | ||||||||||||
176 | if (b - n >= 2 * d->alloc / 3) {
| 322746-1126674 | ||||||||||||
177 | // we have enough space. Just not at the end -> move it. | - | ||||||||||||
178 | e -= b; | - | ||||||||||||
179 | ::memcpy(d->array, d->array + b, e * sizeof(void *)); | - | ||||||||||||
180 | d->begin = 0; | - | ||||||||||||
181 | } else { executed 1126674 times by 200 tests: end of block Executed by:
| 1126674 | ||||||||||||
182 | realloc_grow(n); | - | ||||||||||||
183 | } executed 322746 times by 403 tests: end of block Executed by:
| 322746 | ||||||||||||
184 | } | - | ||||||||||||
185 | d->end = e + n; | - | ||||||||||||
186 | return d->array + e; executed 10127565 times by 533 tests: return d->array + e; Executed by:
| 10127565 | ||||||||||||
187 | } | - | ||||||||||||
188 | - | |||||||||||||
189 | // ensures that enough space is available to append one element | - | ||||||||||||
190 | void **QListData::append() | - | ||||||||||||
191 | { | - | ||||||||||||
192 | return append(1); executed 10116461 times by 533 tests: return append(1); Executed by:
| 10116461 | ||||||||||||
193 | } | - | ||||||||||||
194 | - | |||||||||||||
195 | // ensures that enough space is available to append the list | - | ||||||||||||
196 | void **QListData::append(const QListData& l) | - | ||||||||||||
197 | { | - | ||||||||||||
198 | return append(l.d->end - l.d->begin); executed 11104 times by 44 tests: return append(l.d->end - l.d->begin); Executed by:
| 11104 | ||||||||||||
199 | } | - | ||||||||||||
200 | - | |||||||||||||
201 | void **QListData::prepend() | - | ||||||||||||
202 | { | - | ||||||||||||
203 | Q_ASSERT(!d->ref.isShared()); | - | ||||||||||||
204 | if (d->begin == 0) {
| 110875-1744875 | ||||||||||||
205 | if (d->end >= d->alloc / 3)
| 1274-109601 | ||||||||||||
206 | realloc_grow(1); executed 109601 times by 230 tests: realloc_grow(1); Executed by:
| 109601 | ||||||||||||
207 | - | |||||||||||||
208 | if (d->end < d->alloc / 3)
| 34318-76557 | ||||||||||||
209 | d->begin = d->alloc - 2 * d->end; executed 76557 times by 223 tests: d->begin = d->alloc - 2 * d->end; Executed by:
| 76557 | ||||||||||||
210 | else | - | ||||||||||||
211 | d->begin = d->alloc - d->end; executed 34318 times by 79 tests: d->begin = d->alloc - d->end; Executed by:
| 34318 | ||||||||||||
212 | - | |||||||||||||
213 | ::memmove(d->array + d->begin, d->array, d->end * sizeof(void *)); | - | ||||||||||||
214 | d->end += d->begin; | - | ||||||||||||
215 | } executed 110875 times by 231 tests: end of block Executed by:
| 110875 | ||||||||||||
216 | return d->array + --d->begin; executed 1855750 times by 259 tests: return d->array + --d->begin; Executed by:
| 1855750 | ||||||||||||
217 | } | - | ||||||||||||
218 | - | |||||||||||||
219 | void **QListData::insert(int i) | - | ||||||||||||
220 | { | - | ||||||||||||
221 | Q_ASSERT(!d->ref.isShared()); | - | ||||||||||||
222 | if (i <= 0)
| 115918-251826 | ||||||||||||
223 | return prepend(); executed 115918 times by 206 tests: return prepend(); Executed by:
| 115918 | ||||||||||||
224 | int size = d->end - d->begin; | - | ||||||||||||
225 | if (i >= size)
| 58225-193601 | ||||||||||||
226 | return append(); executed 193601 times by 144 tests: return append(); Executed by:
| 193601 | ||||||||||||
227 | - | |||||||||||||
228 | bool leftward = false; | - | ||||||||||||
229 | - | |||||||||||||
230 | if (d->begin == 0) {
| 3393-54832 | ||||||||||||
231 | if (d->end == d->alloc) {
| 132-3261 | ||||||||||||
232 | // If the array is full, we expand it and move some items rightward | - | ||||||||||||
233 | realloc_grow(1); | - | ||||||||||||
234 | } else { executed 132 times by 29 tests: end of block Executed by:
| 132 | ||||||||||||
235 | // If there is free space at the end of the array, we move some items rightward | - | ||||||||||||
236 | } executed 3261 times by 37 tests: end of block Executed by:
| 3261 | ||||||||||||
237 | } else { | - | ||||||||||||
238 | if (d->end == d->alloc) {
| 22556-32276 | ||||||||||||
239 | // If there is free space at the beginning of the array, we move some items leftward | - | ||||||||||||
240 | leftward = true; | - | ||||||||||||
241 | } else { executed 22556 times by 53 tests: end of block Executed by:
| 22556 | ||||||||||||
242 | // If there is free space at both ends, we move as few items as possible | - | ||||||||||||
243 | leftward = (i < size - i); | - | ||||||||||||
244 | } executed 32276 times by 71 tests: end of block Executed by:
| 32276 | ||||||||||||
245 | } | - | ||||||||||||
246 | - | |||||||||||||
247 | if (leftward) {
| 24788-33437 | ||||||||||||
248 | --d->begin; | - | ||||||||||||
249 | ::memmove(d->array + d->begin, d->array + d->begin + 1, i * sizeof(void *)); | - | ||||||||||||
250 | } else { executed 24788 times by 56 tests: end of block Executed by:
| 24788 | ||||||||||||
251 | ::memmove(d->array + d->begin + i + 1, d->array + d->begin + i, | - | ||||||||||||
252 | (size - i) * sizeof(void *)); | - | ||||||||||||
253 | ++d->end; | - | ||||||||||||
254 | } executed 33437 times by 78 tests: end of block Executed by:
| 33437 | ||||||||||||
255 | return d->array + d->begin + i; executed 58225 times by 79 tests: return d->array + d->begin + i; Executed by:
| 58225 | ||||||||||||
256 | } | - | ||||||||||||
257 | - | |||||||||||||
258 | void QListData::remove(int i) | - | ||||||||||||
259 | { | - | ||||||||||||
260 | Q_ASSERT(!d->ref.isShared()); | - | ||||||||||||
261 | i += d->begin; | - | ||||||||||||
262 | if (i - d->begin < d->end - i) {
| 177610-3772333 | ||||||||||||
263 | if (int offset = i - d->begin)
| 22342-3749991 | ||||||||||||
264 | ::memmove(d->array + d->begin + 1, d->array + d->begin, offset * sizeof(void *)); executed 22342 times by 333 tests: ::memmove(d->array + d->begin + 1, d->array + d->begin, offset * sizeof(void *)); Executed by:
| 22342 | ||||||||||||
265 | d->begin++; | - | ||||||||||||
266 | } else { executed 3772333 times by 567 tests: end of block Executed by:
| 3772333 | ||||||||||||
267 | if (int offset = d->end - i - 1)
| 42931-134679 | ||||||||||||
268 | ::memmove(d->array + i, d->array + i + 1, offset * sizeof(void *)); executed 42931 times by 208 tests: ::memmove(d->array + i, d->array + i + 1, offset * sizeof(void *)); Executed by:
| 42931 | ||||||||||||
269 | d->end--; | - | ||||||||||||
270 | } executed 177610 times by 498 tests: end of block Executed by:
| 177610 | ||||||||||||
271 | } | - | ||||||||||||
272 | - | |||||||||||||
273 | void QListData::remove(int i, int n) | - | ||||||||||||
274 | { | - | ||||||||||||
275 | Q_ASSERT(!d->ref.isShared()); | - | ||||||||||||
276 | i += d->begin; | - | ||||||||||||
277 | int middle = i + n/2; | - | ||||||||||||
278 | if (middle - d->begin < d->end - middle) {
| 75-74937 | ||||||||||||
279 | ::memmove(d->array + d->begin + n, d->array + d->begin, | - | ||||||||||||
280 | (i - d->begin) * sizeof(void*)); | - | ||||||||||||
281 | d->begin += n; | - | ||||||||||||
282 | } else { executed 75 times by 8 tests: end of block Executed by:
| 75 | ||||||||||||
283 | ::memmove(d->array + i, d->array + i + n, | - | ||||||||||||
284 | (d->end - i - n) * sizeof(void*)); | - | ||||||||||||
285 | d->end -= n; | - | ||||||||||||
286 | } executed 74937 times by 217 tests: end of block Executed by:
| 74937 | ||||||||||||
287 | } | - | ||||||||||||
288 | - | |||||||||||||
289 | void QListData::move(int from, int to) | - | ||||||||||||
290 | { | - | ||||||||||||
291 | Q_ASSERT(!d->ref.isShared()); | - | ||||||||||||
292 | if (from == to)
| 6914-407274 | ||||||||||||
293 | return; executed 407274 times by 77 tests: return; Executed by:
| 407274 | ||||||||||||
294 | - | |||||||||||||
295 | from += d->begin; | - | ||||||||||||
296 | to += d->begin; | - | ||||||||||||
297 | void *t = d->array[from]; | - | ||||||||||||
298 | - | |||||||||||||
299 | if (from < to) {
| 1544-5370 | ||||||||||||
300 | if (d->end == d->alloc || 3 * (to - from) < 2 * (d->end - d->begin)) {
| 1169-4201 | ||||||||||||
301 | ::memmove(d->array + from, d->array + from + 1, (to - from) * sizeof(void *)); | - | ||||||||||||
302 | } else { executed 4200 times by 52 tests: end of block Executed by:
| 4200 | ||||||||||||
303 | // optimization | - | ||||||||||||
304 | if (int offset = from - d->begin)
| 413-757 | ||||||||||||
305 | ::memmove(d->array + d->begin + 1, d->array + d->begin, offset * sizeof(void *)); executed 413 times by 16 tests: ::memmove(d->array + d->begin + 1, d->array + d->begin, offset * sizeof(void *)); Executed by:
| 413 | ||||||||||||
306 | if (int offset = d->end - (to + 1))
| 0-1170 | ||||||||||||
307 | ::memmove(d->array + to + 2, d->array + to + 1, offset * sizeof(void *)); never executed: ::memmove(d->array + to + 2, d->array + to + 1, offset * sizeof(void *)); | 0 | ||||||||||||
308 | ++d->begin; | - | ||||||||||||
309 | ++d->end; | - | ||||||||||||
310 | ++to; | - | ||||||||||||
311 | } executed 1170 times by 37 tests: end of block Executed by:
| 1170 | ||||||||||||
312 | } else { | - | ||||||||||||
313 | if (d->begin == 0 || 3 * (from - to) < 2 * (d->end - d->begin)) {
| 51-1052 | ||||||||||||
314 | ::memmove(d->array + to + 1, d->array + to, (from - to) * sizeof(void *)); | - | ||||||||||||
315 | } else { executed 1103 times by 30 tests: end of block Executed by:
| 1103 | ||||||||||||
316 | // optimization | - | ||||||||||||
317 | if (int offset = to - d->begin)
| 0-441 | ||||||||||||
318 | ::memmove(d->array + d->begin - 1, d->array + d->begin, offset * sizeof(void *)); never executed: ::memmove(d->array + d->begin - 1, d->array + d->begin, offset * sizeof(void *)); | 0 | ||||||||||||
319 | if (int offset = d->end - (from + 1))
| 52-389 | ||||||||||||
320 | ::memmove(d->array + from, d->array + from + 1, offset * sizeof(void *)); executed 389 times by 4 tests: ::memmove(d->array + from, d->array + from + 1, offset * sizeof(void *)); Executed by:
| 389 | ||||||||||||
321 | --d->begin; | - | ||||||||||||
322 | --d->end; | - | ||||||||||||
323 | --to; | - | ||||||||||||
324 | } executed 441 times by 10 tests: end of block Executed by:
| 441 | ||||||||||||
325 | } | - | ||||||||||||
326 | d->array[to] = t; | - | ||||||||||||
327 | } executed 6914 times by 62 tests: end of block Executed by:
| 6914 | ||||||||||||
328 | - | |||||||||||||
329 | void **QListData::erase(void **xi) | - | ||||||||||||
330 | { | - | ||||||||||||
331 | Q_ASSERT(!d->ref.isShared()); | - | ||||||||||||
332 | int i = xi - (d->array + d->begin); | - | ||||||||||||
333 | remove(i); | - | ||||||||||||
334 | return d->array + d->begin + i; executed 3562994 times by 502 tests: return d->array + d->begin + i; Executed by:
| 3562994 | ||||||||||||
335 | } | - | ||||||||||||
336 | - | |||||||||||||
337 | /*! \class QList | - | ||||||||||||
338 | \inmodule QtCore | - | ||||||||||||
339 | \brief The QList class is a template class that provides lists. | - | ||||||||||||
340 | - | |||||||||||||
341 | \ingroup tools | - | ||||||||||||
342 | \ingroup shared | - | ||||||||||||
343 | - | |||||||||||||
344 | \reentrant | - | ||||||||||||
345 | - | |||||||||||||
346 | QList\<T\> is one of Qt's generic \l{container classes}. It | - | ||||||||||||
347 | stores items in a list that provides fast index-based access | - | ||||||||||||
348 | and index-based insertions and removals. | - | ||||||||||||
349 | - | |||||||||||||
350 | QList\<T\>, QLinkedList\<T\>, and QVector\<T\> provide similar | - | ||||||||||||
351 | APIs and functionality. They are often interchangeable, but there | - | ||||||||||||
352 | are performance consequences. Here is an overview of use cases: | - | ||||||||||||
353 | - | |||||||||||||
354 | \list | - | ||||||||||||
355 | \li QVector should be your default first choice. | - | ||||||||||||
356 | QVector\<T\> will usually give better performance than QList\<T\>, | - | ||||||||||||
357 | because QVector\<T\> always stores its items sequentially in memory, | - | ||||||||||||
358 | where QList\<T\> will allocate its items on the heap unless | - | ||||||||||||
359 | \c {sizeof(T) <= sizeof(void*)} and T has been declared to be | - | ||||||||||||
360 | either a \c{Q_MOVABLE_TYPE} or a \c{Q_PRIMITIVE_TYPE} using | - | ||||||||||||
361 | \l {Q_DECLARE_TYPEINFO}. See the \l {Pros and Cons of Using QList} | - | ||||||||||||
362 | for an explanation. | - | ||||||||||||
363 | \li However, QList is used throughout the Qt APIs for passing | - | ||||||||||||
364 | parameters and for returning values. Use QList to interface with | - | ||||||||||||
365 | those APIs. | - | ||||||||||||
366 | \li If you need a real linked list, which guarantees | - | ||||||||||||
367 | \l {Algorithmic Complexity}{constant time} insertions mid-list and | - | ||||||||||||
368 | uses iterators to items rather than indexes, use QLinkedList. | - | ||||||||||||
369 | \endlist | - | ||||||||||||
370 | - | |||||||||||||
371 | \note QVector and QVarLengthArray both guarantee C-compatible | - | ||||||||||||
372 | array layout. QList does not. This might be important if your | - | ||||||||||||
373 | application must interface with a C API. | - | ||||||||||||
374 | - | |||||||||||||
375 | \note Iterators into a QLinkedList and references into | - | ||||||||||||
376 | heap-allocating QLists remain valid as long as the referenced items | - | ||||||||||||
377 | remain in the container. This is not true for iterators and | - | ||||||||||||
378 | references into a QVector and non-heap-allocating QLists. | - | ||||||||||||
379 | - | |||||||||||||
380 | Internally, QList\<T\> is represented as an array of T if | - | ||||||||||||
381 | \c{sizeof(T) <= sizeof(void*)} and T has been declared to be | - | ||||||||||||
382 | either a \c{Q_MOVABLE_TYPE} or a \c{Q_PRIMITIVE_TYPE} using | - | ||||||||||||
383 | \l {Q_DECLARE_TYPEINFO}. Otherwise, QList\<T\> is represented | - | ||||||||||||
384 | as an array of T* and the items are allocated on the heap. | - | ||||||||||||
385 | - | |||||||||||||
386 | The array representation allows very fast insertions and | - | ||||||||||||
387 | index-based access. The prepend() and append() operations are | - | ||||||||||||
388 | also very fast because QList preallocates memory at both | - | ||||||||||||
389 | ends of its internal array. (See \l{Algorithmic Complexity} for | - | ||||||||||||
390 | details. | - | ||||||||||||
391 | - | |||||||||||||
392 | Note, however, that when the conditions specified above are not met, | - | ||||||||||||
393 | each append or insert of a new item requires allocating the new item | - | ||||||||||||
394 | on the heap, and this per item allocation will make QVector a better | - | ||||||||||||
395 | choice for use cases that do a lot of appending or inserting, because | - | ||||||||||||
396 | QVector can allocate memory for many items in a single heap allocation. | - | ||||||||||||
397 | - | |||||||||||||
398 | Note that the internal array only ever gets bigger over the life | - | ||||||||||||
399 | of the list. It never shrinks. The internal array is deallocated | - | ||||||||||||
400 | by the destructor and by the assignment operator, when one list | - | ||||||||||||
401 | is assigned to another. | - | ||||||||||||
402 | - | |||||||||||||
403 | Here's an example of a QList that stores integers and | - | ||||||||||||
404 | a QList that stores QDate values: | - | ||||||||||||
405 | - | |||||||||||||
406 | \snippet code/src_corelib_tools_qlistdata.cpp 0 | - | ||||||||||||
407 | - | |||||||||||||
408 | Qt includes a QStringList class that inherits QList\<QString\> | - | ||||||||||||
409 | and adds a few convenience functions, such as QStringList::join() | - | ||||||||||||
410 | and QStringList::filter(). QString::split() creates QStringLists | - | ||||||||||||
411 | from strings. | - | ||||||||||||
412 | - | |||||||||||||
413 | QList stores a list of items. The default constructor creates an | - | ||||||||||||
414 | empty list. To insert items into the list, you can use | - | ||||||||||||
415 | operator<<(): | - | ||||||||||||
416 | - | |||||||||||||
417 | \snippet code/src_corelib_tools_qlistdata.cpp 1 | - | ||||||||||||
418 | - | |||||||||||||
419 | QList provides these basic functions to add, move, and remove | - | ||||||||||||
420 | items: insert(), replace(), removeAt(), move(), and swap(). In | - | ||||||||||||
421 | addition, it provides the following convenience functions: | - | ||||||||||||
422 | append(), prepend(), removeFirst(), and removeLast(). | - | ||||||||||||
423 | - | |||||||||||||
424 | QList uses 0-based indexes, just like C++ arrays. To access the | - | ||||||||||||
425 | item at a particular index position, you can use operator[](). On | - | ||||||||||||
426 | non-const lists, operator[]() returns a reference to the item and | - | ||||||||||||
427 | can be used on the left side of an assignment: | - | ||||||||||||
428 | - | |||||||||||||
429 | \snippet code/src_corelib_tools_qlistdata.cpp 2 | - | ||||||||||||
430 | - | |||||||||||||
431 | Because QList is implemented as an array of pointers for types | - | ||||||||||||
432 | that are larger than a pointer or are not movable, this operation | - | ||||||||||||
433 | requires (\l{Algorithmic Complexity}{constant time}). For read-only | - | ||||||||||||
434 | access, an alternative syntax is to use at(): | - | ||||||||||||
435 | - | |||||||||||||
436 | \snippet code/src_corelib_tools_qlistdata.cpp 3 | - | ||||||||||||
437 | - | |||||||||||||
438 | at() can be faster than operator[](), because it never causes a | - | ||||||||||||
439 | \l{deep copy} to occur. | - | ||||||||||||
440 | - | |||||||||||||
441 | A common requirement is to remove an item from a list and do | - | ||||||||||||
442 | something with it. For this, QList provides takeAt(), takeFirst(), | - | ||||||||||||
443 | and takeLast(). Here's a loop that removes the items from a list | - | ||||||||||||
444 | one at a time and calls \c delete on them: | - | ||||||||||||
445 | - | |||||||||||||
446 | \snippet code/src_corelib_tools_qlistdata.cpp 4 | - | ||||||||||||
447 | - | |||||||||||||
448 | Inserting and removing items at either end of the list is very | - | ||||||||||||
449 | fast (\l{Algorithmic Complexity}{constant time} in most cases), | - | ||||||||||||
450 | because QList preallocates extra space on both sides of its | - | ||||||||||||
451 | internal buffer to allow for fast growth at both ends of the list. | - | ||||||||||||
452 | - | |||||||||||||
453 | If you want to find all occurrences of a particular value in a | - | ||||||||||||
454 | list, use indexOf() or lastIndexOf(). The former searches forward | - | ||||||||||||
455 | starting from a given index position, the latter searches | - | ||||||||||||
456 | backward. Both return the index of a matching item if they find | - | ||||||||||||
457 | it; otherwise, they return -1. For example: | - | ||||||||||||
458 | - | |||||||||||||
459 | \snippet code/src_corelib_tools_qlistdata.cpp 5 | - | ||||||||||||
460 | - | |||||||||||||
461 | If you simply want to check whether a list contains a particular | - | ||||||||||||
462 | value, use contains(). If you want to find out how many times a | - | ||||||||||||
463 | particular value occurs in the list, use count(). If you want to | - | ||||||||||||
464 | replace all occurrences of a particular value with another, use | - | ||||||||||||
465 | replace(). | - | ||||||||||||
466 | - | |||||||||||||
467 | QList's value type must be an \l{assignable data type}. This | - | ||||||||||||
468 | covers most data types that are commonly used, but the compiler | - | ||||||||||||
469 | won't let you, for example, store a QWidget as a value; instead, | - | ||||||||||||
470 | store a QWidget *. A few functions have additional requirements; | - | ||||||||||||
471 | for example, indexOf() and lastIndexOf() expect the value type to | - | ||||||||||||
472 | support \c operator==(). These requirements are documented on a | - | ||||||||||||
473 | per-function basis. | - | ||||||||||||
474 | - | |||||||||||||
475 | Like the other container classes, QList provides \l{Java-style | - | ||||||||||||
476 | iterators} (QListIterator and QMutableListIterator) and | - | ||||||||||||
477 | \l{STL-style iterators} (QList::const_iterator and | - | ||||||||||||
478 | QList::iterator). In practice, these are rarely used, because you | - | ||||||||||||
479 | can use indexes into the QList. QList is implemented in such a way | - | ||||||||||||
480 | that direct index-based access is just as fast as using iterators. | - | ||||||||||||
481 | - | |||||||||||||
482 | QList does \e not support inserting, prepending, appending or | - | ||||||||||||
483 | replacing with references to its own values. Doing so will cause | - | ||||||||||||
484 | your application to abort with an error message. | - | ||||||||||||
485 | - | |||||||||||||
486 | To make QList as efficient as possible, its member functions don't | - | ||||||||||||
487 | validate their input before using it. Except for isEmpty(), member | - | ||||||||||||
488 | functions always assume the list is \e not empty. Member functions | - | ||||||||||||
489 | that take index values as parameters always assume their index | - | ||||||||||||
490 | value parameters are in the valid range. This means QList member | - | ||||||||||||
491 | functions can fail. If you define QT_NO_DEBUG when you compile, | - | ||||||||||||
492 | failures will not be detected. If you \e don't define QT_NO_DEBUG, | - | ||||||||||||
493 | failures will be detected using Q_ASSERT() or Q_ASSERT_X() with an | - | ||||||||||||
494 | appropriate message. | - | ||||||||||||
495 | - | |||||||||||||
496 | To avoid failures when your list can be empty, call isEmpty() | - | ||||||||||||
497 | before calling other member functions. If you must pass an index | - | ||||||||||||
498 | value that might not be in the valid range, check that it is less | - | ||||||||||||
499 | than the value returned by size() but \e not less than 0. | - | ||||||||||||
500 | - | |||||||||||||
501 | \section1 More Members | - | ||||||||||||
502 | - | |||||||||||||
503 | If T is a QByteArray, this class has a couple more members that can be | - | ||||||||||||
504 | used. See the documentation for QByteArrayList for more information. | - | ||||||||||||
505 | - | |||||||||||||
506 | If T is QString, this class has the following additional members: | - | ||||||||||||
507 | \l{QStringList::filter()}{filter}, | - | ||||||||||||
508 | \l{QStringList::join()}{join}, | - | ||||||||||||
509 | \l{QStringList::removeDuplicates()}{removeDuplicates}, | - | ||||||||||||
510 | \l{QStringList::sort()}{sort}. | - | ||||||||||||
511 | - | |||||||||||||
512 | \section1 More Information on Using Qt Containers | - | ||||||||||||
513 | - | |||||||||||||
514 | For a detailed discussion comparing Qt containers with each other and | - | ||||||||||||
515 | with STL containers, see \l {Understand the Qt Containers}. | - | ||||||||||||
516 | - | |||||||||||||
517 | \sa QListIterator, QMutableListIterator, QLinkedList, QVector | - | ||||||||||||
518 | */ | - | ||||||||||||
519 | - | |||||||||||||
520 | /*! | - | ||||||||||||
521 | \fn QList::QList(QList<T> &&other) | - | ||||||||||||
522 | - | |||||||||||||
523 | Move-constructs a QList instance, making it point at the same | - | ||||||||||||
524 | object that \a other was pointing to. | - | ||||||||||||
525 | - | |||||||||||||
526 | \since 5.2 | - | ||||||||||||
527 | */ | - | ||||||||||||
528 | - | |||||||||||||
529 | /*! | - | ||||||||||||
530 | \fn QList<T> QList<T>::mid(int pos, int length) const | - | ||||||||||||
531 | - | |||||||||||||
532 | Returns a sub-list which includes elements from this list, | - | ||||||||||||
533 | starting at position \a pos. If \a length is -1 (the default), all | - | ||||||||||||
534 | elements from \a pos are included; otherwise \a length elements (or | - | ||||||||||||
535 | all remaining elements if there are less than \a length elements) | - | ||||||||||||
536 | are included. | - | ||||||||||||
537 | */ | - | ||||||||||||
538 | - | |||||||||||||
539 | /*! \fn QList::QList() | - | ||||||||||||
540 | - | |||||||||||||
541 | Constructs an empty list. | - | ||||||||||||
542 | */ | - | ||||||||||||
543 | - | |||||||||||||
544 | /*! \fn QList::QList(const QList<T> &other) | - | ||||||||||||
545 | - | |||||||||||||
546 | Constructs a copy of \a other. | - | ||||||||||||
547 | - | |||||||||||||
548 | This operation takes \l{Algorithmic Complexity}{constant time}, | - | ||||||||||||
549 | because QList is \l{implicitly shared}. This makes returning a | - | ||||||||||||
550 | QList from a function very fast. If a shared instance is modified, | - | ||||||||||||
551 | it will be copied (copy-on-write), and that takes | - | ||||||||||||
552 | \l{Algorithmic Complexity}{linear time}. | - | ||||||||||||
553 | - | |||||||||||||
554 | \sa operator=() | - | ||||||||||||
555 | */ | - | ||||||||||||
556 | - | |||||||||||||
557 | /*! \fn inline QList::QList(std::initializer_list<T> args) | - | ||||||||||||
558 | \since 4.8 | - | ||||||||||||
559 | - | |||||||||||||
560 | Construct a list from the std::initializer_list specified by \a args. | - | ||||||||||||
561 | - | |||||||||||||
562 | This constructor is only enabled if the compiler supports C++11 initializer | - | ||||||||||||
563 | lists. | - | ||||||||||||
564 | */ | - | ||||||||||||
565 | - | |||||||||||||
566 | /*! \fn QList::~QList() | - | ||||||||||||
567 | - | |||||||||||||
568 | Destroys the list. References to the values in the list and all | - | ||||||||||||
569 | iterators of this list become invalid. | - | ||||||||||||
570 | */ | - | ||||||||||||
571 | - | |||||||||||||
572 | /*! \fn QList<T> &QList::operator=(const QList<T> &other) | - | ||||||||||||
573 | - | |||||||||||||
574 | Assigns \a other to this list and returns a reference to this | - | ||||||||||||
575 | list. | - | ||||||||||||
576 | */ | - | ||||||||||||
577 | - | |||||||||||||
578 | /*! | - | ||||||||||||
579 | \fn QList &QList::operator=(QList<T> &&other) | - | ||||||||||||
580 | - | |||||||||||||
581 | Move-assigns \a other to this QList instance. | - | ||||||||||||
582 | - | |||||||||||||
583 | \since 5.2 | - | ||||||||||||
584 | */ | - | ||||||||||||
585 | - | |||||||||||||
586 | /*! \fn void QList::swap(QList<T> &other) | - | ||||||||||||
587 | \since 4.8 | - | ||||||||||||
588 | - | |||||||||||||
589 | Swaps list \a other with this list. This operation is very | - | ||||||||||||
590 | fast and never fails. | - | ||||||||||||
591 | */ | - | ||||||||||||
592 | - | |||||||||||||
593 | /*! \fn bool QList::operator==(const QList<T> &other) const | - | ||||||||||||
594 | - | |||||||||||||
595 | Returns \c true if \a other is equal to this list; otherwise returns | - | ||||||||||||
596 | false. | - | ||||||||||||
597 | - | |||||||||||||
598 | Two lists are considered equal if they contain the same values in | - | ||||||||||||
599 | the same order. | - | ||||||||||||
600 | - | |||||||||||||
601 | This function requires the value type to have an implementation of | - | ||||||||||||
602 | \c operator==(). | - | ||||||||||||
603 | - | |||||||||||||
604 | \sa operator!=() | - | ||||||||||||
605 | */ | - | ||||||||||||
606 | - | |||||||||||||
607 | /*! \fn bool QList::operator!=(const QList<T> &other) const | - | ||||||||||||
608 | - | |||||||||||||
609 | Returns \c true if \a other is not equal to this list; otherwise | - | ||||||||||||
610 | returns \c false. | - | ||||||||||||
611 | - | |||||||||||||
612 | Two lists are considered equal if they contain the same values in | - | ||||||||||||
613 | the same order. | - | ||||||||||||
614 | - | |||||||||||||
615 | This function requires the value type to have an implementation of | - | ||||||||||||
616 | \c operator==(). | - | ||||||||||||
617 | - | |||||||||||||
618 | \sa operator==() | - | ||||||||||||
619 | */ | - | ||||||||||||
620 | - | |||||||||||||
621 | /*! \fn bool operator<(const QList<T> &lhs, const QList<T> &rhs) | - | ||||||||||||
622 | \since 5.6 | - | ||||||||||||
623 | \relates QList | - | ||||||||||||
624 | - | |||||||||||||
625 | Returns \c true if list \a lhs is | - | ||||||||||||
626 | \l{http://en.cppreference.com/w/cpp/algorithm/lexicographical_compare} | - | ||||||||||||
627 | {lexicographically less than} \a rhs; otherwise returns \c false. | - | ||||||||||||
628 | - | |||||||||||||
629 | This function requires the value type to have an implementation | - | ||||||||||||
630 | of \c operator<(). | - | ||||||||||||
631 | */ | - | ||||||||||||
632 | - | |||||||||||||
633 | /*! \fn bool operator<=(const QList<T> &lhs, const QList<T> &rhs) | - | ||||||||||||
634 | \since 5.6 | - | ||||||||||||
635 | \relates QList | - | ||||||||||||
636 | - | |||||||||||||
637 | Returns \c true if list \a lhs is | - | ||||||||||||
638 | \l{http://en.cppreference.com/w/cpp/algorithm/lexicographical_compare} | - | ||||||||||||
639 | {lexicographically less than or equal to} \a rhs; otherwise returns \c false. | - | ||||||||||||
640 | - | |||||||||||||
641 | This function requires the value type to have an implementation | - | ||||||||||||
642 | of \c operator<(). | - | ||||||||||||
643 | */ | - | ||||||||||||
644 | - | |||||||||||||
645 | /*! \fn bool operator>(const QList<T> &lhs, const QList<T> &rhs) | - | ||||||||||||
646 | \since 5.6 | - | ||||||||||||
647 | \relates QList | - | ||||||||||||
648 | - | |||||||||||||
649 | Returns \c true if list \a lhs is | - | ||||||||||||
650 | \l{http://en.cppreference.com/w/cpp/algorithm/lexicographical_compare} | - | ||||||||||||
651 | {lexicographically greater than} \a rhs; otherwise returns \c false. | - | ||||||||||||
652 | - | |||||||||||||
653 | This function requires the value type to have an implementation | - | ||||||||||||
654 | of \c operator<(). | - | ||||||||||||
655 | */ | - | ||||||||||||
656 | - | |||||||||||||
657 | /*! \fn bool operator>=(const QList<T> &lhs, const QList<T> &rhs) | - | ||||||||||||
658 | \since 5.6 | - | ||||||||||||
659 | \relates QList | - | ||||||||||||
660 | - | |||||||||||||
661 | Returns \c true if list \a lhs is | - | ||||||||||||
662 | \l{http://en.cppreference.com/w/cpp/algorithm/lexicographical_compare} | - | ||||||||||||
663 | {lexicographically greater than or equal to} \a rhs; otherwise returns \c false. | - | ||||||||||||
664 | - | |||||||||||||
665 | This function requires the value type to have an implementation | - | ||||||||||||
666 | of \c operator<(). | - | ||||||||||||
667 | */ | - | ||||||||||||
668 | - | |||||||||||||
669 | /*! | - | ||||||||||||
670 | \fn uint qHash(const QList<T> &key, uint seed = 0) | - | ||||||||||||
671 | \since 5.6 | - | ||||||||||||
672 | \relates QList | - | ||||||||||||
673 | - | |||||||||||||
674 | Returns the hash value for \a key, | - | ||||||||||||
675 | using \a seed to seed the calculation. | - | ||||||||||||
676 | - | |||||||||||||
677 | This function requires qHash() to be overloaded for the value type \c T. | - | ||||||||||||
678 | */ | - | ||||||||||||
679 | - | |||||||||||||
680 | /*! | - | ||||||||||||
681 | \fn int QList::size() const | - | ||||||||||||
682 | - | |||||||||||||
683 | Returns the number of items in the list. | - | ||||||||||||
684 | - | |||||||||||||
685 | \sa isEmpty(), count() | - | ||||||||||||
686 | */ | - | ||||||||||||
687 | - | |||||||||||||
688 | /*! \fn void QList::detach() | - | ||||||||||||
689 | - | |||||||||||||
690 | \internal | - | ||||||||||||
691 | */ | - | ||||||||||||
692 | - | |||||||||||||
693 | /*! \fn void QList::detachShared() | - | ||||||||||||
694 | - | |||||||||||||
695 | \internal | - | ||||||||||||
696 | - | |||||||||||||
697 | like detach(), but does nothing if we're shared_null. | - | ||||||||||||
698 | This prevents needless mallocs, and makes QList more exception safe | - | ||||||||||||
699 | in case of cleanup work done in destructors on empty lists. | - | ||||||||||||
700 | */ | - | ||||||||||||
701 | - | |||||||||||||
702 | /*! \fn bool QList::isDetached() const | - | ||||||||||||
703 | - | |||||||||||||
704 | \internal | - | ||||||||||||
705 | */ | - | ||||||||||||
706 | - | |||||||||||||
707 | /*! \fn void QList::setSharable(bool sharable) | - | ||||||||||||
708 | - | |||||||||||||
709 | \internal | - | ||||||||||||
710 | */ | - | ||||||||||||
711 | - | |||||||||||||
712 | /*! \fn bool QList::isSharedWith(const QList<T> &other) const | - | ||||||||||||
713 | - | |||||||||||||
714 | \internal | - | ||||||||||||
715 | */ | - | ||||||||||||
716 | - | |||||||||||||
717 | /*! \fn bool QList::isEmpty() const | - | ||||||||||||
718 | - | |||||||||||||
719 | Returns \c true if the list contains no items; otherwise returns | - | ||||||||||||
720 | false. | - | ||||||||||||
721 | - | |||||||||||||
722 | \sa size() | - | ||||||||||||
723 | */ | - | ||||||||||||
724 | - | |||||||||||||
725 | /*! \fn void QList::clear() | - | ||||||||||||
726 | - | |||||||||||||
727 | Removes all items from the list. | - | ||||||||||||
728 | - | |||||||||||||
729 | \sa removeAll() | - | ||||||||||||
730 | */ | - | ||||||||||||
731 | - | |||||||||||||
732 | /*! \fn const T &QList::at(int i) const | - | ||||||||||||
733 | - | |||||||||||||
734 | Returns the item at index position \a i in the list. \a i must be | - | ||||||||||||
735 | a valid index position in the list (i.e., 0 <= \a i < size()). | - | ||||||||||||
736 | - | |||||||||||||
737 | This function is very fast (\l{Algorithmic Complexity}{constant time}). | - | ||||||||||||
738 | - | |||||||||||||
739 | \sa value(), operator[]() | - | ||||||||||||
740 | */ | - | ||||||||||||
741 | - | |||||||||||||
742 | /*! \fn T &QList::operator[](int i) | - | ||||||||||||
743 | - | |||||||||||||
744 | Returns the item at index position \a i as a modifiable reference. | - | ||||||||||||
745 | \a i must be a valid index position in the list (i.e., 0 <= \a i < | - | ||||||||||||
746 | size()). | - | ||||||||||||
747 | - | |||||||||||||
748 | If this function is called on a list that is currently being shared, it | - | ||||||||||||
749 | will trigger a copy of all elements. Otherwise, this function runs in | - | ||||||||||||
750 | \l{Algorithmic Complexity}{constant time}. If you do not want to modify | - | ||||||||||||
751 | the list you should use QList::at(). | - | ||||||||||||
752 | - | |||||||||||||
753 | \sa at(), value() | - | ||||||||||||
754 | */ | - | ||||||||||||
755 | - | |||||||||||||
756 | /*! \fn const T &QList::operator[](int i) const | - | ||||||||||||
757 | - | |||||||||||||
758 | \overload | - | ||||||||||||
759 | - | |||||||||||||
760 | Same as at(). This function runs in \l{Algorithmic Complexity}{constant time}. | - | ||||||||||||
761 | */ | - | ||||||||||||
762 | - | |||||||||||||
763 | /*! \fn QList::reserve(int alloc) | - | ||||||||||||
764 | - | |||||||||||||
765 | Reserve space for \a alloc elements. | - | ||||||||||||
766 | - | |||||||||||||
767 | If \a alloc is smaller than the current size of the list, nothing will happen. | - | ||||||||||||
768 | - | |||||||||||||
769 | Use this function to avoid repetetive reallocation of QList's internal | - | ||||||||||||
770 | data if you can predict how many elements will be appended. | - | ||||||||||||
771 | Note that the reservation applies only to the internal pointer array. | - | ||||||||||||
772 | - | |||||||||||||
773 | \since 4.7 | - | ||||||||||||
774 | */ | - | ||||||||||||
775 | - | |||||||||||||
776 | /*! \fn void QList::append(const T &value) | - | ||||||||||||
777 | - | |||||||||||||
778 | Inserts \a value at the end of the list. | - | ||||||||||||
779 | - | |||||||||||||
780 | Example: | - | ||||||||||||
781 | \snippet code/src_corelib_tools_qlistdata.cpp 6 | - | ||||||||||||
782 | - | |||||||||||||
783 | This is the same as list.insert(size(), \a value). | - | ||||||||||||
784 | - | |||||||||||||
785 | If this list is not shared, this operation is typically | - | ||||||||||||
786 | very fast (amortized \l{Algorithmic Complexity}{constant time}), | - | ||||||||||||
787 | because QList preallocates extra space on both sides of its | - | ||||||||||||
788 | internal buffer to allow for fast growth at both ends of the list. | - | ||||||||||||
789 | - | |||||||||||||
790 | \sa operator<<(), prepend(), insert() | - | ||||||||||||
791 | */ | - | ||||||||||||
792 | - | |||||||||||||
793 | /*! \fn void QList::append(const QList<T> &value) | - | ||||||||||||
794 | - | |||||||||||||
795 | \overload | - | ||||||||||||
796 | - | |||||||||||||
797 | \since 4.5 | - | ||||||||||||
798 | - | |||||||||||||
799 | Appends the items of the \a value list to this list. | - | ||||||||||||
800 | - | |||||||||||||
801 | \sa operator<<(), operator+=() | - | ||||||||||||
802 | */ | - | ||||||||||||
803 | - | |||||||||||||
804 | /*! \fn void QList::prepend(const T &value) | - | ||||||||||||
805 | - | |||||||||||||
806 | Inserts \a value at the beginning of the list. | - | ||||||||||||
807 | - | |||||||||||||
808 | Example: | - | ||||||||||||
809 | \snippet code/src_corelib_tools_qlistdata.cpp 7 | - | ||||||||||||
810 | - | |||||||||||||
811 | This is the same as list.insert(0, \a value). | - | ||||||||||||
812 | - | |||||||||||||
813 | If this list is not shared, this operation is typically | - | ||||||||||||
814 | very fast (amortized \l{Algorithmic Complexity}{constant time}), | - | ||||||||||||
815 | because QList preallocates extra space on both sides of its | - | ||||||||||||
816 | internal buffer to allow for fast growth at both ends of the list. | - | ||||||||||||
817 | - | |||||||||||||
818 | \sa append(), insert() | - | ||||||||||||
819 | */ | - | ||||||||||||
820 | - | |||||||||||||
821 | /*! \fn void QList::insert(int i, const T &value) | - | ||||||||||||
822 | - | |||||||||||||
823 | Inserts \a value at index position \a i in the list. If \a i <= 0, | - | ||||||||||||
824 | the value is prepended to the list. If \a i >= size(), the | - | ||||||||||||
825 | value is appended to the list. | - | ||||||||||||
826 | - | |||||||||||||
827 | Example: | - | ||||||||||||
828 | \snippet code/src_corelib_tools_qlistdata.cpp 8 | - | ||||||||||||
829 | - | |||||||||||||
830 | \sa append(), prepend(), replace(), removeAt() | - | ||||||||||||
831 | */ | - | ||||||||||||
832 | - | |||||||||||||
833 | /*! \fn QList::iterator QList::insert(iterator before, const T &value) | - | ||||||||||||
834 | - | |||||||||||||
835 | \overload | - | ||||||||||||
836 | - | |||||||||||||
837 | Inserts \a value in front of the item pointed to by the | - | ||||||||||||
838 | iterator \a before. Returns an iterator pointing at the inserted | - | ||||||||||||
839 | item. Note that the iterator passed to the function will be | - | ||||||||||||
840 | invalid after the call; the returned iterator should be used | - | ||||||||||||
841 | instead. | - | ||||||||||||
842 | */ | - | ||||||||||||
843 | - | |||||||||||||
844 | /*! \fn void QList::replace(int i, const T &value) | - | ||||||||||||
845 | - | |||||||||||||
846 | Replaces the item at index position \a i with \a value. \a i must | - | ||||||||||||
847 | be a valid index position in the list (i.e., 0 <= \a i < size()). | - | ||||||||||||
848 | - | |||||||||||||
849 | \sa operator[](), removeAt() | - | ||||||||||||
850 | */ | - | ||||||||||||
851 | - | |||||||||||||
852 | /*! | - | ||||||||||||
853 | \fn int QList::removeAll(const T &value) | - | ||||||||||||
854 | - | |||||||||||||
855 | Removes all occurrences of \a value in the list and returns the | - | ||||||||||||
856 | number of entries removed. | - | ||||||||||||
857 | - | |||||||||||||
858 | Example: | - | ||||||||||||
859 | \snippet code/src_corelib_tools_qlistdata.cpp 9 | - | ||||||||||||
860 | - | |||||||||||||
861 | This function requires the value type to have an implementation of | - | ||||||||||||
862 | \c operator==(). | - | ||||||||||||
863 | - | |||||||||||||
864 | \sa removeOne(), removeAt(), takeAt(), replace() | - | ||||||||||||
865 | */ | - | ||||||||||||
866 | - | |||||||||||||
867 | /*! | - | ||||||||||||
868 | \fn bool QList::removeOne(const T &value) | - | ||||||||||||
869 | \since 4.4 | - | ||||||||||||
870 | - | |||||||||||||
871 | Removes the first occurrence of \a value in the list and returns | - | ||||||||||||
872 | true on success; otherwise returns \c false. | - | ||||||||||||
873 | - | |||||||||||||
874 | Example: | - | ||||||||||||
875 | \snippet code/src_corelib_tools_qlistdata.cpp 10 | - | ||||||||||||
876 | - | |||||||||||||
877 | This function requires the value type to have an implementation of | - | ||||||||||||
878 | \c operator==(). | - | ||||||||||||
879 | - | |||||||||||||
880 | \sa removeAll(), removeAt(), takeAt(), replace() | - | ||||||||||||
881 | */ | - | ||||||||||||
882 | - | |||||||||||||
883 | /*! \fn void QList::removeAt(int i) | - | ||||||||||||
884 | - | |||||||||||||
885 | Removes the item at index position \a i. \a i must be a valid | - | ||||||||||||
886 | index position in the list (i.e., 0 <= \a i < size()). | - | ||||||||||||
887 | - | |||||||||||||
888 | \sa takeAt(), removeFirst(), removeLast(), removeOne() | - | ||||||||||||
889 | */ | - | ||||||||||||
890 | - | |||||||||||||
891 | /*! \fn T QList::takeAt(int i) | - | ||||||||||||
892 | - | |||||||||||||
893 | Removes the item at index position \a i and returns it. \a i must | - | ||||||||||||
894 | be a valid index position in the list (i.e., 0 <= \a i < size()). | - | ||||||||||||
895 | - | |||||||||||||
896 | If you don't use the return value, removeAt() is more efficient. | - | ||||||||||||
897 | - | |||||||||||||
898 | \sa removeAt(), takeFirst(), takeLast() | - | ||||||||||||
899 | */ | - | ||||||||||||
900 | - | |||||||||||||
901 | /*! \fn T QList::takeFirst() | - | ||||||||||||
902 | - | |||||||||||||
903 | Removes the first item in the list and returns it. This is the | - | ||||||||||||
904 | same as takeAt(0). This function assumes the list is not empty. To | - | ||||||||||||
905 | avoid failure, call isEmpty() before calling this function. | - | ||||||||||||
906 | - | |||||||||||||
907 | If this list is not shared, this operation takes | - | ||||||||||||
908 | \l {Algorithmic Complexity}{constant time}. | - | ||||||||||||
909 | - | |||||||||||||
910 | If you don't use the return value, removeFirst() is more | - | ||||||||||||
911 | efficient. | - | ||||||||||||
912 | - | |||||||||||||
913 | \sa takeLast(), takeAt(), removeFirst() | - | ||||||||||||
914 | */ | - | ||||||||||||
915 | - | |||||||||||||
916 | /*! \fn T QList::takeLast() | - | ||||||||||||
917 | - | |||||||||||||
918 | Removes the last item in the list and returns it. This is the | - | ||||||||||||
919 | same as takeAt(size() - 1). This function assumes the list is | - | ||||||||||||
920 | not empty. To avoid failure, call isEmpty() before calling this | - | ||||||||||||
921 | function. | - | ||||||||||||
922 | - | |||||||||||||
923 | If this list is not shared, this operation takes | - | ||||||||||||
924 | \l {Algorithmic Complexity}{constant time}. | - | ||||||||||||
925 | - | |||||||||||||
926 | If you don't use the return value, removeLast() is more | - | ||||||||||||
927 | efficient. | - | ||||||||||||
928 | - | |||||||||||||
929 | \sa takeFirst(), takeAt(), removeLast() | - | ||||||||||||
930 | */ | - | ||||||||||||
931 | - | |||||||||||||
932 | /*! \fn void QList::move(int from, int to) | - | ||||||||||||
933 | - | |||||||||||||
934 | Moves the item at index position \a from to index position \a to. | - | ||||||||||||
935 | - | |||||||||||||
936 | Example: | - | ||||||||||||
937 | \snippet code/src_corelib_tools_qlistdata.cpp 11 | - | ||||||||||||
938 | - | |||||||||||||
939 | This is the same as insert(\a{to}, takeAt(\a{from})).This function | - | ||||||||||||
940 | assumes that both \a from and \a to are at least 0 but less than | - | ||||||||||||
941 | size(). To avoid failure, test that both \a from and \a to are at | - | ||||||||||||
942 | least 0 and less than size(). | - | ||||||||||||
943 | - | |||||||||||||
944 | \sa swap(), insert(), takeAt() | - | ||||||||||||
945 | */ | - | ||||||||||||
946 | - | |||||||||||||
947 | /*! \fn void QList::swap(int i, int j) | - | ||||||||||||
948 | - | |||||||||||||
949 | Exchange the item at index position \a i with the item at index | - | ||||||||||||
950 | position \a j. This function assumes that both \a i and \a j are | - | ||||||||||||
951 | at least 0 but less than size(). To avoid failure, test that both | - | ||||||||||||
952 | \a i and \a j are at least 0 and less than size(). | - | ||||||||||||
953 | - | |||||||||||||
954 | Example: | - | ||||||||||||
955 | \snippet code/src_corelib_tools_qlistdata.cpp 12 | - | ||||||||||||
956 | - | |||||||||||||
957 | \sa move() | - | ||||||||||||
958 | */ | - | ||||||||||||
959 | - | |||||||||||||
960 | /*! \fn int QList::indexOf(const T &value, int from = 0) const | - | ||||||||||||
961 | - | |||||||||||||
962 | Returns the index position of the first occurrence of \a value in | - | ||||||||||||
963 | the list, searching forward from index position \a from. Returns | - | ||||||||||||
964 | -1 if no item matched. | - | ||||||||||||
965 | - | |||||||||||||
966 | Example: | - | ||||||||||||
967 | \snippet code/src_corelib_tools_qlistdata.cpp 13 | - | ||||||||||||
968 | - | |||||||||||||
969 | This function requires the value type to have an implementation of | - | ||||||||||||
970 | \c operator==(). | - | ||||||||||||
971 | - | |||||||||||||
972 | Note that QList uses 0-based indexes, just like C++ arrays. Negative | - | ||||||||||||
973 | indexes are not supported with the exception of the value mentioned | - | ||||||||||||
974 | above. | - | ||||||||||||
975 | - | |||||||||||||
976 | \sa lastIndexOf(), contains() | - | ||||||||||||
977 | */ | - | ||||||||||||
978 | - | |||||||||||||
979 | /*! \fn int QList::lastIndexOf(const T &value, int from = -1) const | - | ||||||||||||
980 | - | |||||||||||||
981 | Returns the index position of the last occurrence of \a value in | - | ||||||||||||
982 | the list, searching backward from index position \a from. If \a | - | ||||||||||||
983 | from is -1 (the default), the search starts at the last item. | - | ||||||||||||
984 | Returns -1 if no item matched. | - | ||||||||||||
985 | - | |||||||||||||
986 | Example: | - | ||||||||||||
987 | \snippet code/src_corelib_tools_qlistdata.cpp 14 | - | ||||||||||||
988 | - | |||||||||||||
989 | This function requires the value type to have an implementation of | - | ||||||||||||
990 | \c operator==(). | - | ||||||||||||
991 | - | |||||||||||||
992 | Note that QList uses 0-based indexes, just like C++ arrays. Negative | - | ||||||||||||
993 | indexes are not supported with the exception of the value mentioned | - | ||||||||||||
994 | above. | - | ||||||||||||
995 | - | |||||||||||||
996 | \sa indexOf() | - | ||||||||||||
997 | */ | - | ||||||||||||
998 | - | |||||||||||||
999 | /*! \fn bool QList::contains(const T &value) const | - | ||||||||||||
1000 | - | |||||||||||||
1001 | Returns \c true if the list contains an occurrence of \a value; | - | ||||||||||||
1002 | otherwise returns \c false. | - | ||||||||||||
1003 | - | |||||||||||||
1004 | This function requires the value type to have an implementation of | - | ||||||||||||
1005 | \c operator==(). | - | ||||||||||||
1006 | - | |||||||||||||
1007 | \sa indexOf(), count() | - | ||||||||||||
1008 | */ | - | ||||||||||||
1009 | - | |||||||||||||
1010 | /*! \fn int QList::count(const T &value) const | - | ||||||||||||
1011 | - | |||||||||||||
1012 | Returns the number of occurrences of \a value in the list. | - | ||||||||||||
1013 | - | |||||||||||||
1014 | This function requires the value type to have an implementation of | - | ||||||||||||
1015 | \c operator==(). | - | ||||||||||||
1016 | - | |||||||||||||
1017 | \sa contains(), indexOf() | - | ||||||||||||
1018 | */ | - | ||||||||||||
1019 | - | |||||||||||||
1020 | /*! \fn bool QList::startsWith(const T &value) const | - | ||||||||||||
1021 | \since 4.5 | - | ||||||||||||
1022 | - | |||||||||||||
1023 | Returns \c true if this list is not empty and its first | - | ||||||||||||
1024 | item is equal to \a value; otherwise returns \c false. | - | ||||||||||||
1025 | - | |||||||||||||
1026 | \sa isEmpty(), contains() | - | ||||||||||||
1027 | */ | - | ||||||||||||
1028 | - | |||||||||||||
1029 | /*! \fn bool QList::endsWith(const T &value) const | - | ||||||||||||
1030 | \since 4.5 | - | ||||||||||||
1031 | - | |||||||||||||
1032 | Returns \c true if this list is not empty and its last | - | ||||||||||||
1033 | item is equal to \a value; otherwise returns \c false. | - | ||||||||||||
1034 | - | |||||||||||||
1035 | \sa isEmpty(), contains() | - | ||||||||||||
1036 | */ | - | ||||||||||||
1037 | - | |||||||||||||
1038 | /*! \fn QList::iterator QList::begin() | - | ||||||||||||
1039 | - | |||||||||||||
1040 | Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in | - | ||||||||||||
1041 | the list. | - | ||||||||||||
1042 | - | |||||||||||||
1043 | \sa constBegin(), end() | - | ||||||||||||
1044 | */ | - | ||||||||||||
1045 | - | |||||||||||||
1046 | /*! \fn QList::const_iterator QList::begin() const | - | ||||||||||||
1047 | - | |||||||||||||
1048 | \overload | - | ||||||||||||
1049 | */ | - | ||||||||||||
1050 | - | |||||||||||||
1051 | /*! \fn QList::const_iterator QList::cbegin() const | - | ||||||||||||
1052 | \since 5.0 | - | ||||||||||||
1053 | - | |||||||||||||
1054 | Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item | - | ||||||||||||
1055 | in the list. | - | ||||||||||||
1056 | - | |||||||||||||
1057 | \sa begin(), cend() | - | ||||||||||||
1058 | */ | - | ||||||||||||
1059 | - | |||||||||||||
1060 | /*! \fn QList::const_iterator QList::constBegin() const | - | ||||||||||||
1061 | - | |||||||||||||
1062 | Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item | - | ||||||||||||
1063 | in the list. | - | ||||||||||||
1064 | - | |||||||||||||
1065 | \sa begin(), constEnd() | - | ||||||||||||
1066 | */ | - | ||||||||||||
1067 | - | |||||||||||||
1068 | /*! \fn QList::iterator QList::end() | - | ||||||||||||
1069 | - | |||||||||||||
1070 | Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item | - | ||||||||||||
1071 | after the last item in the list. | - | ||||||||||||
1072 | - | |||||||||||||
1073 | \sa begin(), constEnd() | - | ||||||||||||
1074 | */ | - | ||||||||||||
1075 | - | |||||||||||||
1076 | /*! \fn const_iterator QList::end() const | - | ||||||||||||
1077 | - | |||||||||||||
1078 | \overload | - | ||||||||||||
1079 | */ | - | ||||||||||||
1080 | - | |||||||||||||
1081 | /*! \fn QList::const_iterator QList::cend() const | - | ||||||||||||
1082 | \since 5.0 | - | ||||||||||||
1083 | - | |||||||||||||
1084 | Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary | - | ||||||||||||
1085 | item after the last item in the list. | - | ||||||||||||
1086 | - | |||||||||||||
1087 | \sa cbegin(), end() | - | ||||||||||||
1088 | */ | - | ||||||||||||
1089 | - | |||||||||||||
1090 | /*! \fn QList::const_iterator QList::constEnd() const | - | ||||||||||||
1091 | - | |||||||||||||
1092 | Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary | - | ||||||||||||
1093 | item after the last item in the list. | - | ||||||||||||
1094 | - | |||||||||||||
1095 | \sa constBegin(), end() | - | ||||||||||||
1096 | */ | - | ||||||||||||
1097 | - | |||||||||||||
1098 | /*! \fn QList::reverse_iterator QList::rbegin() | - | ||||||||||||
1099 | \since 5.6 | - | ||||||||||||
1100 | - | |||||||||||||
1101 | Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to the first | - | ||||||||||||
1102 | item in the list, in reverse order. | - | ||||||||||||
1103 | - | |||||||||||||
1104 | \sa begin(), crbegin(), rend() | - | ||||||||||||
1105 | */ | - | ||||||||||||
1106 | - | |||||||||||||
1107 | /*! \fn QList::const_reverse_iterator QList::rbegin() const | - | ||||||||||||
1108 | \since 5.6 | - | ||||||||||||
1109 | \overload | - | ||||||||||||
1110 | */ | - | ||||||||||||
1111 | - | |||||||||||||
1112 | /*! \fn QList::const_reverse_iterator QList::crbegin() const | - | ||||||||||||
1113 | \since 5.6 | - | ||||||||||||
1114 | - | |||||||||||||
1115 | Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to the first | - | ||||||||||||
1116 | item in the list, in reverse order. | - | ||||||||||||
1117 | - | |||||||||||||
1118 | \sa begin(), rbegin(), rend() | - | ||||||||||||
1119 | */ | - | ||||||||||||
1120 | - | |||||||||||||
1121 | /*! \fn QList::reverse_iterator QList::rend() | - | ||||||||||||
1122 | \since 5.6 | - | ||||||||||||
1123 | - | |||||||||||||
1124 | Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to one past | - | ||||||||||||
1125 | the last item in the list, in reverse order. | - | ||||||||||||
1126 | - | |||||||||||||
1127 | \sa end(), crend(), rbegin() | - | ||||||||||||
1128 | */ | - | ||||||||||||
1129 | - | |||||||||||||
1130 | /*! \fn QList::const_reverse_iterator QList::rend() const | - | ||||||||||||
1131 | \since 5.6 | - | ||||||||||||
1132 | \overload | - | ||||||||||||
1133 | */ | - | ||||||||||||
1134 | - | |||||||||||||
1135 | /*! \fn QList::const_reverse_iterator QList::crend() const | - | ||||||||||||
1136 | \since 5.6 | - | ||||||||||||
1137 | - | |||||||||||||
1138 | Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to one | - | ||||||||||||
1139 | past the last item in the list, in reverse order. | - | ||||||||||||
1140 | - | |||||||||||||
1141 | \sa end(), rend(), rbegin() | - | ||||||||||||
1142 | */ | - | ||||||||||||
1143 | - | |||||||||||||
1144 | /*! \fn QList::iterator QList::erase(iterator pos) | - | ||||||||||||
1145 | - | |||||||||||||
1146 | Removes the item associated with the iterator \a pos from the | - | ||||||||||||
1147 | list, and returns an iterator to the next item in the list (which | - | ||||||||||||
1148 | may be end()). | - | ||||||||||||
1149 | - | |||||||||||||
1150 | \sa insert(), removeAt() | - | ||||||||||||
1151 | */ | - | ||||||||||||
1152 | - | |||||||||||||
1153 | /*! \fn QList::iterator QList::erase(iterator begin, iterator end) | - | ||||||||||||
1154 | - | |||||||||||||
1155 | \overload | - | ||||||||||||
1156 | - | |||||||||||||
1157 | Removes all the items from \a begin up to (but not including) \a | - | ||||||||||||
1158 | end. Returns an iterator to the same item that \a end referred to | - | ||||||||||||
1159 | before the call. | - | ||||||||||||
1160 | */ | - | ||||||||||||
1161 | - | |||||||||||||
1162 | /*! \typedef QList::Iterator | - | ||||||||||||
1163 | - | |||||||||||||
1164 | Qt-style synonym for QList::iterator. | - | ||||||||||||
1165 | */ | - | ||||||||||||
1166 | - | |||||||||||||
1167 | /*! \typedef QList::ConstIterator | - | ||||||||||||
1168 | - | |||||||||||||
1169 | Qt-style synonym for QList::const_iterator. | - | ||||||||||||
1170 | */ | - | ||||||||||||
1171 | - | |||||||||||||
1172 | /*! | - | ||||||||||||
1173 | \typedef QList::size_type | - | ||||||||||||
1174 | - | |||||||||||||
1175 | Typedef for int. Provided for STL compatibility. | - | ||||||||||||
1176 | */ | - | ||||||||||||
1177 | - | |||||||||||||
1178 | /*! | - | ||||||||||||
1179 | \typedef QList::value_type | - | ||||||||||||
1180 | - | |||||||||||||
1181 | Typedef for T. Provided for STL compatibility. | - | ||||||||||||
1182 | */ | - | ||||||||||||
1183 | - | |||||||||||||
1184 | /*! | - | ||||||||||||
1185 | \typedef QList::difference_type | - | ||||||||||||
1186 | - | |||||||||||||
1187 | Typedef for ptrdiff_t. Provided for STL compatibility. | - | ||||||||||||
1188 | */ | - | ||||||||||||
1189 | - | |||||||||||||
1190 | /*! | - | ||||||||||||
1191 | \typedef QList::pointer | - | ||||||||||||
1192 | - | |||||||||||||
1193 | Typedef for T *. Provided for STL compatibility. | - | ||||||||||||
1194 | */ | - | ||||||||||||
1195 | - | |||||||||||||
1196 | /*! | - | ||||||||||||
1197 | \typedef QList::const_pointer | - | ||||||||||||
1198 | - | |||||||||||||
1199 | Typedef for const T *. Provided for STL compatibility. | - | ||||||||||||
1200 | */ | - | ||||||||||||
1201 | - | |||||||||||||
1202 | /*! | - | ||||||||||||
1203 | \typedef QList::reference | - | ||||||||||||
1204 | - | |||||||||||||
1205 | Typedef for T &. Provided for STL compatibility. | - | ||||||||||||
1206 | */ | - | ||||||||||||
1207 | - | |||||||||||||
1208 | /*! | - | ||||||||||||
1209 | \typedef QList::const_reference | - | ||||||||||||
1210 | - | |||||||||||||
1211 | Typedef for const T &. Provided for STL compatibility. | - | ||||||||||||
1212 | */ | - | ||||||||||||
1213 | - | |||||||||||||
1214 | /*! \typedef QList::reverse_iterator | - | ||||||||||||
1215 | \since 5.6 | - | ||||||||||||
1216 | - | |||||||||||||
1217 | The QList::reverse_iterator typedef provides an STL-style non-const | - | ||||||||||||
1218 | reverse iterator for QList. | - | ||||||||||||
1219 | - | |||||||||||||
1220 | It is simply a typedef for \c{std::reverse_iterator<iterator>}. | - | ||||||||||||
1221 | - | |||||||||||||
1222 | \warning Iterators on implicitly shared containers do not work | - | ||||||||||||
1223 | exactly like STL-iterators. You should avoid copying a container | - | ||||||||||||
1224 | while iterators are active on that container. For more information, | - | ||||||||||||
1225 | read \l{Implicit sharing iterator problem}. | - | ||||||||||||
1226 | - | |||||||||||||
1227 | \sa QList::rbegin(), QList::rend(), QList::const_reverse_iterator, QList::iterator | - | ||||||||||||
1228 | */ | - | ||||||||||||
1229 | - | |||||||||||||
1230 | /*! \typedef QList::const_reverse_iterator | - | ||||||||||||
1231 | \since 5.6 | - | ||||||||||||
1232 | - | |||||||||||||
1233 | The QList::const_reverse_iterator typedef provides an STL-style const | - | ||||||||||||
1234 | reverse iterator for QList. | - | ||||||||||||
1235 | - | |||||||||||||
1236 | It is simply a typedef for \c{std::reverse_iterator<const_iterator>}. | - | ||||||||||||
1237 | - | |||||||||||||
1238 | \warning Iterators on implicitly shared containers do not work | - | ||||||||||||
1239 | exactly like STL-iterators. You should avoid copying a container | - | ||||||||||||
1240 | while iterators are active on that container. For more information, | - | ||||||||||||
1241 | read \l{Implicit sharing iterator problem}. | - | ||||||||||||
1242 | - | |||||||||||||
1243 | \sa QList::rbegin(), QList::rend(), QList::reverse_iterator, QList::const_iterator | - | ||||||||||||
1244 | */ | - | ||||||||||||
1245 | - | |||||||||||||
1246 | /*! \fn int QList::count() const | - | ||||||||||||
1247 | - | |||||||||||||
1248 | Returns the number of items in the list. This is effectively the | - | ||||||||||||
1249 | same as size(). | - | ||||||||||||
1250 | */ | - | ||||||||||||
1251 | - | |||||||||||||
1252 | /*! \fn int QList::length() const | - | ||||||||||||
1253 | \since 4.5 | - | ||||||||||||
1254 | - | |||||||||||||
1255 | This function is identical to count(). | - | ||||||||||||
1256 | - | |||||||||||||
1257 | \sa count() | - | ||||||||||||
1258 | */ | - | ||||||||||||
1259 | - | |||||||||||||
1260 | /*! \fn T& QList::first() | - | ||||||||||||
1261 | - | |||||||||||||
1262 | Returns a reference to the first item in the list. The list must | - | ||||||||||||
1263 | not be empty. If the list can be empty, call isEmpty() before | - | ||||||||||||
1264 | calling this function. | - | ||||||||||||
1265 | - | |||||||||||||
1266 | \sa constFirst(), last(), isEmpty() | - | ||||||||||||
1267 | */ | - | ||||||||||||
1268 | - | |||||||||||||
1269 | /*! \fn const T& QList::first() const | - | ||||||||||||
1270 | - | |||||||||||||
1271 | \overload | - | ||||||||||||
1272 | */ | - | ||||||||||||
1273 | - | |||||||||||||
1274 | /*! \fn const T& QList::constFirst() const | - | ||||||||||||
1275 | \since 5.6 | - | ||||||||||||
1276 | - | |||||||||||||
1277 | Returns a const reference to the first item in the list. The list must | - | ||||||||||||
1278 | not be empty. If the list can be empty, call isEmpty() before | - | ||||||||||||
1279 | calling this function. | - | ||||||||||||
1280 | - | |||||||||||||
1281 | \sa constLast(), isEmpty(), first() | - | ||||||||||||
1282 | */ | - | ||||||||||||
1283 | - | |||||||||||||
1284 | /*! \fn T& QList::last() | - | ||||||||||||
1285 | - | |||||||||||||
1286 | Returns a reference to the last item in the list. The list must | - | ||||||||||||
1287 | not be empty. If the list can be empty, call isEmpty() before | - | ||||||||||||
1288 | calling this function. | - | ||||||||||||
1289 | - | |||||||||||||
1290 | \sa constLast(), first(), isEmpty() | - | ||||||||||||
1291 | */ | - | ||||||||||||
1292 | - | |||||||||||||
1293 | /*! \fn const T& QList::last() const | - | ||||||||||||
1294 | - | |||||||||||||
1295 | \overload | - | ||||||||||||
1296 | */ | - | ||||||||||||
1297 | - | |||||||||||||
1298 | /*! \fn const T& QList::constLast() const | - | ||||||||||||
1299 | \since 5.6 | - | ||||||||||||
1300 | - | |||||||||||||
1301 | Returns a reference to the last item in the list. The list must | - | ||||||||||||
1302 | not be empty. If the list can be empty, call isEmpty() before | - | ||||||||||||
1303 | calling this function. | - | ||||||||||||
1304 | - | |||||||||||||
1305 | \sa constFirst(), isEmpty(), last() | - | ||||||||||||
1306 | */ | - | ||||||||||||
1307 | - | |||||||||||||
1308 | /*! \fn void QList::removeFirst() | - | ||||||||||||
1309 | - | |||||||||||||
1310 | Removes the first item in the list. Calling this function is | - | ||||||||||||
1311 | equivalent to calling removeAt(0). The list must not be empty. If | - | ||||||||||||
1312 | the list can be empty, call isEmpty() before calling this | - | ||||||||||||
1313 | function. | - | ||||||||||||
1314 | - | |||||||||||||
1315 | \sa removeAt(), takeFirst() | - | ||||||||||||
1316 | */ | - | ||||||||||||
1317 | - | |||||||||||||
1318 | /*! \fn void QList::removeLast() | - | ||||||||||||
1319 | - | |||||||||||||
1320 | Removes the last item in the list. Calling this function is | - | ||||||||||||
1321 | equivalent to calling removeAt(size() - 1). The list must not be | - | ||||||||||||
1322 | empty. If the list can be empty, call isEmpty() before calling | - | ||||||||||||
1323 | this function. | - | ||||||||||||
1324 | - | |||||||||||||
1325 | \sa removeAt(), takeLast() | - | ||||||||||||
1326 | */ | - | ||||||||||||
1327 | - | |||||||||||||
1328 | /*! \fn T QList::value(int i) const | - | ||||||||||||
1329 | - | |||||||||||||
1330 | Returns the value at index position \a i in the list. | - | ||||||||||||
1331 | - | |||||||||||||
1332 | If the index \a i is out of bounds, the function returns a | - | ||||||||||||
1333 | \l{default-constructed value}. If you are certain that the index | - | ||||||||||||
1334 | is going to be within bounds, you can use at() instead, which is | - | ||||||||||||
1335 | slightly faster. | - | ||||||||||||
1336 | - | |||||||||||||
1337 | \sa at(), operator[]() | - | ||||||||||||
1338 | */ | - | ||||||||||||
1339 | - | |||||||||||||
1340 | /*! \fn T QList::value(int i, const T &defaultValue) const | - | ||||||||||||
1341 | - | |||||||||||||
1342 | \overload | - | ||||||||||||
1343 | - | |||||||||||||
1344 | If the index \a i is out of bounds, the function returns | - | ||||||||||||
1345 | \a defaultValue. | - | ||||||||||||
1346 | */ | - | ||||||||||||
1347 | - | |||||||||||||
1348 | /*! \fn void QList::push_back(const T &value) | - | ||||||||||||
1349 | - | |||||||||||||
1350 | This function is provided for STL compatibility. It is equivalent | - | ||||||||||||
1351 | to \l{QList::append()}{append(\a value)}. | - | ||||||||||||
1352 | */ | - | ||||||||||||
1353 | - | |||||||||||||
1354 | /*! \fn void QList::push_front(const T &value) | - | ||||||||||||
1355 | - | |||||||||||||
1356 | This function is provided for STL compatibility. It is equivalent | - | ||||||||||||
1357 | to \l{QList::prepend()}{prepend(\a value)}. | - | ||||||||||||
1358 | */ | - | ||||||||||||
1359 | - | |||||||||||||
1360 | /*! \fn T& QList::front() | - | ||||||||||||
1361 | - | |||||||||||||
1362 | This function is provided for STL compatibility. It is equivalent | - | ||||||||||||
1363 | to first(). The list must not be empty. If the list can be empty, | - | ||||||||||||
1364 | call isEmpty() before calling this function. | - | ||||||||||||
1365 | */ | - | ||||||||||||
1366 | - | |||||||||||||
1367 | /*! \fn const T& QList::front() const | - | ||||||||||||
1368 | - | |||||||||||||
1369 | \overload | - | ||||||||||||
1370 | */ | - | ||||||||||||
1371 | - | |||||||||||||
1372 | /*! \fn T& QList::back() | - | ||||||||||||
1373 | - | |||||||||||||
1374 | This function is provided for STL compatibility. It is equivalent | - | ||||||||||||
1375 | to last(). The list must not be empty. If the list can be empty, | - | ||||||||||||
1376 | call isEmpty() before calling this function. | - | ||||||||||||
1377 | */ | - | ||||||||||||
1378 | - | |||||||||||||
1379 | /*! \fn const T& QList::back() const | - | ||||||||||||
1380 | - | |||||||||||||
1381 | \overload | - | ||||||||||||
1382 | */ | - | ||||||||||||
1383 | - | |||||||||||||
1384 | /*! \fn void QList::pop_front() | - | ||||||||||||
1385 | - | |||||||||||||
1386 | This function is provided for STL compatibility. It is equivalent | - | ||||||||||||
1387 | to removeFirst(). The list must not be empty. If the list can be | - | ||||||||||||
1388 | empty, call isEmpty() before calling this function. | - | ||||||||||||
1389 | */ | - | ||||||||||||
1390 | - | |||||||||||||
1391 | /*! \fn void QList::pop_back() | - | ||||||||||||
1392 | - | |||||||||||||
1393 | This function is provided for STL compatibility. It is equivalent | - | ||||||||||||
1394 | to removeLast(). The list must not be empty. If the list can be | - | ||||||||||||
1395 | empty, call isEmpty() before calling this function. | - | ||||||||||||
1396 | */ | - | ||||||||||||
1397 | - | |||||||||||||
1398 | /*! \fn bool QList::empty() const | - | ||||||||||||
1399 | - | |||||||||||||
1400 | This function is provided for STL compatibility. It is equivalent | - | ||||||||||||
1401 | to isEmpty() and returns \c true if the list is empty. | - | ||||||||||||
1402 | */ | - | ||||||||||||
1403 | - | |||||||||||||
1404 | /*! \fn QList<T> &QList::operator+=(const QList<T> &other) | - | ||||||||||||
1405 | - | |||||||||||||
1406 | Appends the items of the \a other list to this list and returns a | - | ||||||||||||
1407 | reference to this list. | - | ||||||||||||
1408 | - | |||||||||||||
1409 | \sa operator+(), append() | - | ||||||||||||
1410 | */ | - | ||||||||||||
1411 | - | |||||||||||||
1412 | /*! \fn void QList::operator+=(const T &value) | - | ||||||||||||
1413 | - | |||||||||||||
1414 | \overload | - | ||||||||||||
1415 | - | |||||||||||||
1416 | Appends \a value to the list. | - | ||||||||||||
1417 | - | |||||||||||||
1418 | \sa append(), operator<<() | - | ||||||||||||
1419 | */ | - | ||||||||||||
1420 | - | |||||||||||||
1421 | /*! \fn QList<T> QList::operator+(const QList<T> &other) const | - | ||||||||||||
1422 | - | |||||||||||||
1423 | Returns a list that contains all the items in this list followed | - | ||||||||||||
1424 | by all the items in the \a other list. | - | ||||||||||||
1425 | - | |||||||||||||
1426 | \sa operator+=() | - | ||||||||||||
1427 | */ | - | ||||||||||||
1428 | - | |||||||||||||
1429 | /*! \fn QList<T> &QList::operator<<(const QList<T> &other) | - | ||||||||||||
1430 | - | |||||||||||||
1431 | Appends the items of the \a other list to this list and returns a | - | ||||||||||||
1432 | reference to this list. | - | ||||||||||||
1433 | - | |||||||||||||
1434 | \sa operator+=(), append() | - | ||||||||||||
1435 | */ | - | ||||||||||||
1436 | - | |||||||||||||
1437 | /*! \fn void QList::operator<<(const T &value) | - | ||||||||||||
1438 | - | |||||||||||||
1439 | \overload | - | ||||||||||||
1440 | - | |||||||||||||
1441 | Appends \a value to the list. | - | ||||||||||||
1442 | */ | - | ||||||||||||
1443 | - | |||||||||||||
1444 | /*! \class QList::iterator | - | ||||||||||||
1445 | \inmodule QtCore | - | ||||||||||||
1446 | \brief The QList::iterator class provides an STL-style non-const iterator for QList and QQueue. | - | ||||||||||||
1447 | - | |||||||||||||
1448 | QList features both \l{STL-style iterators} and \l{Java-style | - | ||||||||||||
1449 | iterators}. The STL-style iterators are more low-level and more | - | ||||||||||||
1450 | cumbersome to use; on the other hand, they are slightly faster | - | ||||||||||||
1451 | and, for developers who already know STL, have the advantage of | - | ||||||||||||
1452 | familiarity. | - | ||||||||||||
1453 | - | |||||||||||||
1454 | QList\<T\>::iterator allows you to iterate over a QList\<T\> (or | - | ||||||||||||
1455 | QQueue\<T\>) and to modify the list item associated with the | - | ||||||||||||
1456 | iterator. If you want to iterate over a const QList, use | - | ||||||||||||
1457 | QList::const_iterator instead. It is generally good practice to | - | ||||||||||||
1458 | use QList::const_iterator on a non-const QList as well, unless | - | ||||||||||||
1459 | you need to change the QList through the iterator. Const | - | ||||||||||||
1460 | iterators are slightly faster, and can improve code readability. | - | ||||||||||||
1461 | - | |||||||||||||
1462 | The default QList::iterator constructor creates an uninitialized | - | ||||||||||||
1463 | iterator. You must initialize it using a QList function like | - | ||||||||||||
1464 | QList::begin(), QList::end(), or QList::insert() before you can | - | ||||||||||||
1465 | start iterating. Here's a typical loop that prints all the items | - | ||||||||||||
1466 | stored in a list: | - | ||||||||||||
1467 | - | |||||||||||||
1468 | \snippet code/src_corelib_tools_qlistdata.cpp 15 | - | ||||||||||||
1469 | - | |||||||||||||
1470 | Let's see a few examples of things we can do with a | - | ||||||||||||
1471 | QList::iterator that we cannot do with a QList::const_iterator. | - | ||||||||||||
1472 | Here's an example that increments every value stored in a | - | ||||||||||||
1473 | QList\<int\> by 2: | - | ||||||||||||
1474 | - | |||||||||||||
1475 | \snippet code/src_corelib_tools_qlistdata.cpp 16 | - | ||||||||||||
1476 | - | |||||||||||||
1477 | Most QList functions accept an integer index rather than an | - | ||||||||||||
1478 | iterator. For that reason, iterators are rarely useful in | - | ||||||||||||
1479 | connection with QList. One place where STL-style iterators do | - | ||||||||||||
1480 | make sense is as arguments to \l{generic algorithms}. | - | ||||||||||||
1481 | - | |||||||||||||
1482 | For example, here's how to delete all the widgets stored in a | - | ||||||||||||
1483 | QList\<QWidget *\>: | - | ||||||||||||
1484 | - | |||||||||||||
1485 | \snippet code/src_corelib_tools_qlistdata.cpp 17 | - | ||||||||||||
1486 | - | |||||||||||||
1487 | Multiple iterators can be used on the same list. However, be | - | ||||||||||||
1488 | aware that any non-const function call performed on the QList | - | ||||||||||||
1489 | will render all existing iterators undefined. If you need to keep | - | ||||||||||||
1490 | iterators over a long period of time, we recommend that you use | - | ||||||||||||
1491 | QLinkedList rather than QList. | - | ||||||||||||
1492 | - | |||||||||||||
1493 | \warning Iterators on implicitly shared containers do not work | - | ||||||||||||
1494 | exactly like STL-iterators. You should avoid copying a container | - | ||||||||||||
1495 | while iterators are active on that container. For more information, | - | ||||||||||||
1496 | read \l{Implicit sharing iterator problem}. | - | ||||||||||||
1497 | - | |||||||||||||
1498 | \sa QList::const_iterator, QMutableListIterator | - | ||||||||||||
1499 | */ | - | ||||||||||||
1500 | - | |||||||||||||
1501 | /*! \typedef QList::iterator::iterator_category | - | ||||||||||||
1502 | - | |||||||||||||
1503 | A synonym for \e {std::random_access_iterator_tag} indicating | - | ||||||||||||
1504 | this iterator is a random access iterator. | - | ||||||||||||
1505 | */ | - | ||||||||||||
1506 | - | |||||||||||||
1507 | /*! \typedef QList::iterator::difference_type | - | ||||||||||||
1508 | - | |||||||||||||
1509 | \internal | - | ||||||||||||
1510 | */ | - | ||||||||||||
1511 | - | |||||||||||||
1512 | /*! \typedef QList::iterator::value_type | - | ||||||||||||
1513 | - | |||||||||||||
1514 | \internal | - | ||||||||||||
1515 | */ | - | ||||||||||||
1516 | - | |||||||||||||
1517 | /*! \typedef QList::iterator::pointer | - | ||||||||||||
1518 | - | |||||||||||||
1519 | \internal | - | ||||||||||||
1520 | */ | - | ||||||||||||
1521 | - | |||||||||||||
1522 | /*! \typedef QList::iterator::reference | - | ||||||||||||
1523 | - | |||||||||||||
1524 | \internal | - | ||||||||||||
1525 | */ | - | ||||||||||||
1526 | - | |||||||||||||
1527 | /*! \fn QList::iterator::iterator() | - | ||||||||||||
1528 | - | |||||||||||||
1529 | Constructs an uninitialized iterator. | - | ||||||||||||
1530 | - | |||||||||||||
1531 | Functions like operator*() and operator++() should not be called | - | ||||||||||||
1532 | on an uninitialized iterator. Use operator=() to assign a value | - | ||||||||||||
1533 | to it before using it. | - | ||||||||||||
1534 | - | |||||||||||||
1535 | \sa QList::begin(), QList::end() | - | ||||||||||||
1536 | */ | - | ||||||||||||
1537 | - | |||||||||||||
1538 | /*! \fn QList::iterator::iterator(Node *node) | - | ||||||||||||
1539 | - | |||||||||||||
1540 | \internal | - | ||||||||||||
1541 | */ | - | ||||||||||||
1542 | - | |||||||||||||
1543 | /*! \fn QList::iterator::iterator(const iterator &other) | - | ||||||||||||
1544 | - | |||||||||||||
1545 | Constructs a copy of \a other. | - | ||||||||||||
1546 | */ | - | ||||||||||||
1547 | - | |||||||||||||
1548 | /*! \fn T &QList::iterator::operator*() const | - | ||||||||||||
1549 | - | |||||||||||||
1550 | Returns a modifiable reference to the current item. | - | ||||||||||||
1551 | - | |||||||||||||
1552 | You can change the value of an item by using operator*() on the | - | ||||||||||||
1553 | left side of an assignment, for example: | - | ||||||||||||
1554 | - | |||||||||||||
1555 | \snippet code/src_corelib_tools_qlistdata.cpp 18 | - | ||||||||||||
1556 | - | |||||||||||||
1557 | \sa operator->() | - | ||||||||||||
1558 | */ | - | ||||||||||||
1559 | - | |||||||||||||
1560 | /*! \fn T *QList::iterator::operator->() const | - | ||||||||||||
1561 | - | |||||||||||||
1562 | Returns a pointer to the current item. | - | ||||||||||||
1563 | - | |||||||||||||
1564 | \sa operator*() | - | ||||||||||||
1565 | */ | - | ||||||||||||
1566 | - | |||||||||||||
1567 | /*! \fn T &QList::iterator::operator[](difference_type j) const | - | ||||||||||||
1568 | - | |||||||||||||
1569 | Returns a modifiable reference to the item at position *this + | - | ||||||||||||
1570 | \a{j}. | - | ||||||||||||
1571 | - | |||||||||||||
1572 | This function is provided to make QList iterators behave like C++ | - | ||||||||||||
1573 | pointers. | - | ||||||||||||
1574 | - | |||||||||||||
1575 | \sa operator+() | - | ||||||||||||
1576 | */ | - | ||||||||||||
1577 | - | |||||||||||||
1578 | /*! | - | ||||||||||||
1579 | \fn bool QList::iterator::operator==(const iterator &other) const | - | ||||||||||||
1580 | \fn bool QList::iterator::operator==(const const_iterator &other) const | - | ||||||||||||
1581 | - | |||||||||||||
1582 | Returns \c true if \a other points to the same item as this | - | ||||||||||||
1583 | iterator; otherwise returns \c false. | - | ||||||||||||
1584 | - | |||||||||||||
1585 | \sa operator!=() | - | ||||||||||||
1586 | */ | - | ||||||||||||
1587 | - | |||||||||||||
1588 | /*! | - | ||||||||||||
1589 | \fn bool QList::iterator::operator!=(const iterator &other) const | - | ||||||||||||
1590 | \fn bool QList::iterator::operator!=(const const_iterator &other) const | - | ||||||||||||
1591 | - | |||||||||||||
1592 | Returns \c true if \a other points to a different item than this | - | ||||||||||||
1593 | iterator; otherwise returns \c false. | - | ||||||||||||
1594 | - | |||||||||||||
1595 | \sa operator==() | - | ||||||||||||
1596 | */ | - | ||||||||||||
1597 | - | |||||||||||||
1598 | /*! | - | ||||||||||||
1599 | \fn bool QList::iterator::operator<(const iterator& other) const | - | ||||||||||||
1600 | \fn bool QList::iterator::operator<(const const_iterator& other) const | - | ||||||||||||
1601 | - | |||||||||||||
1602 | Returns \c true if the item pointed to by this iterator is less than | - | ||||||||||||
1603 | the item pointed to by the \a other iterator. | - | ||||||||||||
1604 | */ | - | ||||||||||||
1605 | - | |||||||||||||
1606 | /*! | - | ||||||||||||
1607 | \fn bool QList::iterator::operator<=(const iterator& other) const | - | ||||||||||||
1608 | \fn bool QList::iterator::operator<=(const const_iterator& other) const | - | ||||||||||||
1609 | - | |||||||||||||
1610 | Returns \c true if the item pointed to by this iterator is less than | - | ||||||||||||
1611 | or equal to the item pointed to by the \a other iterator. | - | ||||||||||||
1612 | */ | - | ||||||||||||
1613 | - | |||||||||||||
1614 | /*! | - | ||||||||||||
1615 | \fn bool QList::iterator::operator>(const iterator& other) const | - | ||||||||||||
1616 | \fn bool QList::iterator::operator>(const const_iterator& other) const | - | ||||||||||||
1617 | - | |||||||||||||
1618 | Returns \c true if the item pointed to by this iterator is greater | - | ||||||||||||
1619 | than the item pointed to by the \a other iterator. | - | ||||||||||||
1620 | */ | - | ||||||||||||
1621 | - | |||||||||||||
1622 | /*! | - | ||||||||||||
1623 | \fn bool QList::iterator::operator>=(const iterator& other) const | - | ||||||||||||
1624 | \fn bool QList::iterator::operator>=(const const_iterator& other) const | - | ||||||||||||
1625 | - | |||||||||||||
1626 | Returns \c true if the item pointed to by this iterator is greater | - | ||||||||||||
1627 | than or equal to the item pointed to by the \a other iterator. | - | ||||||||||||
1628 | */ | - | ||||||||||||
1629 | - | |||||||||||||
1630 | /*! \fn QList::iterator &QList::iterator::operator++() | - | ||||||||||||
1631 | - | |||||||||||||
1632 | The prefix ++ operator (\c{++it}) advances the iterator to the | - | ||||||||||||
1633 | next item in the list and returns an iterator to the new current | - | ||||||||||||
1634 | item. | - | ||||||||||||
1635 | - | |||||||||||||
1636 | Calling this function on QList::end() leads to undefined results. | - | ||||||||||||
1637 | - | |||||||||||||
1638 | \sa operator--() | - | ||||||||||||
1639 | */ | - | ||||||||||||
1640 | - | |||||||||||||
1641 | /*! \fn QList::iterator QList::iterator::operator++(int) | - | ||||||||||||
1642 | - | |||||||||||||
1643 | \overload | - | ||||||||||||
1644 | - | |||||||||||||
1645 | The postfix ++ operator (\c{it++}) advances the iterator to the | - | ||||||||||||
1646 | next item in the list and returns an iterator to the previously | - | ||||||||||||
1647 | current item. | - | ||||||||||||
1648 | */ | - | ||||||||||||
1649 | - | |||||||||||||
1650 | /*! \fn QList::iterator &QList::iterator::operator--() | - | ||||||||||||
1651 | - | |||||||||||||
1652 | The prefix -- operator (\c{--it}) makes the preceding item | - | ||||||||||||
1653 | current and returns an iterator to the new current item. | - | ||||||||||||
1654 | - | |||||||||||||
1655 | Calling this function on QList::begin() leads to undefined results. | - | ||||||||||||
1656 | - | |||||||||||||
1657 | \sa operator++() | - | ||||||||||||
1658 | */ | - | ||||||||||||
1659 | - | |||||||||||||
1660 | /*! \fn QList::iterator QList::iterator::operator--(int) | - | ||||||||||||
1661 | - | |||||||||||||
1662 | \overload | - | ||||||||||||
1663 | - | |||||||||||||
1664 | The postfix -- operator (\c{it--}) makes the preceding item | - | ||||||||||||
1665 | current and returns an iterator to the previously current item. | - | ||||||||||||
1666 | */ | - | ||||||||||||
1667 | - | |||||||||||||
1668 | /*! \fn QList::iterator &QList::iterator::operator+=(difference_type j) | - | ||||||||||||
1669 | - | |||||||||||||
1670 | Advances the iterator by \a j items. (If \a j is negative, the | - | ||||||||||||
1671 | iterator goes backward.) | - | ||||||||||||
1672 | - | |||||||||||||
1673 | \sa operator-=(), operator+() | - | ||||||||||||
1674 | */ | - | ||||||||||||
1675 | - | |||||||||||||
1676 | /*! \fn QList::iterator &QList::iterator::operator-=(difference_type j) | - | ||||||||||||
1677 | - | |||||||||||||
1678 | Makes the iterator go back by \a j items. (If \a j is negative, | - | ||||||||||||
1679 | the iterator goes forward.) | - | ||||||||||||
1680 | - | |||||||||||||
1681 | \sa operator+=(), operator-() | - | ||||||||||||
1682 | */ | - | ||||||||||||
1683 | - | |||||||||||||
1684 | /*! \fn QList::iterator QList::iterator::operator+(difference_type j) const | - | ||||||||||||
1685 | - | |||||||||||||
1686 | Returns an iterator to the item at \a j positions forward from | - | ||||||||||||
1687 | this iterator. (If \a j is negative, the iterator goes backward.) | - | ||||||||||||
1688 | - | |||||||||||||
1689 | \sa operator-(), operator+=() | - | ||||||||||||
1690 | */ | - | ||||||||||||
1691 | - | |||||||||||||
1692 | /*! \fn QList::iterator QList::iterator::operator-(difference_type j) const | - | ||||||||||||
1693 | - | |||||||||||||
1694 | Returns an iterator to the item at \a j positions backward from | - | ||||||||||||
1695 | this iterator. (If \a j is negative, the iterator goes forward.) | - | ||||||||||||
1696 | - | |||||||||||||
1697 | \sa operator+(), operator-=() | - | ||||||||||||
1698 | */ | - | ||||||||||||
1699 | - | |||||||||||||
1700 | /*! \fn int QList::iterator::operator-(iterator other) const | - | ||||||||||||
1701 | - | |||||||||||||
1702 | Returns the number of items between the item pointed to by \a | - | ||||||||||||
1703 | other and the item pointed to by this iterator. | - | ||||||||||||
1704 | */ | - | ||||||||||||
1705 | - | |||||||||||||
1706 | /*! \class QList::const_iterator | - | ||||||||||||
1707 | \inmodule QtCore | - | ||||||||||||
1708 | \brief The QList::const_iterator class provides an STL-style const iterator for QList and QQueue. | - | ||||||||||||
1709 | - | |||||||||||||
1710 | QList provides both \l{STL-style iterators} and \l{Java-style | - | ||||||||||||
1711 | iterators}. The STL-style iterators are more low-level and more | - | ||||||||||||
1712 | cumbersome to use; on the other hand, they are slightly faster | - | ||||||||||||
1713 | and, for developers who already know STL, have the advantage of | - | ||||||||||||
1714 | familiarity. | - | ||||||||||||
1715 | - | |||||||||||||
1716 | QList\<T\>::const_iterator allows you to iterate over a | - | ||||||||||||
1717 | QList\<T\> (or a QQueue\<T\>). If you want to modify the QList as | - | ||||||||||||
1718 | you iterate over it, use QList::iterator instead. It is generally | - | ||||||||||||
1719 | good practice to use QList::const_iterator on a non-const QList | - | ||||||||||||
1720 | as well, unless you need to change the QList through the | - | ||||||||||||
1721 | iterator. Const iterators are slightly faster, and can improve | - | ||||||||||||
1722 | code readability. | - | ||||||||||||
1723 | - | |||||||||||||
1724 | The default QList::const_iterator constructor creates an | - | ||||||||||||
1725 | uninitialized iterator. You must initialize it using a QList | - | ||||||||||||
1726 | function like QList::constBegin(), QList::constEnd(), or | - | ||||||||||||
1727 | QList::insert() before you can start iterating. Here's a typical | - | ||||||||||||
1728 | loop that prints all the items stored in a list: | - | ||||||||||||
1729 | - | |||||||||||||
1730 | \snippet code/src_corelib_tools_qlistdata.cpp 19 | - | ||||||||||||
1731 | - | |||||||||||||
1732 | Most QList functions accept an integer index rather than an | - | ||||||||||||
1733 | iterator. For that reason, iterators are rarely useful in | - | ||||||||||||
1734 | connection with QList. One place where STL-style iterators do | - | ||||||||||||
1735 | make sense is as arguments to \l{generic algorithms}. | - | ||||||||||||
1736 | - | |||||||||||||
1737 | For example, here's how to delete all the widgets stored in a | - | ||||||||||||
1738 | QList\<QWidget *\>: | - | ||||||||||||
1739 | - | |||||||||||||
1740 | \snippet code/src_corelib_tools_qlistdata.cpp 20 | - | ||||||||||||
1741 | - | |||||||||||||
1742 | Multiple iterators can be used on the same list. However, be | - | ||||||||||||
1743 | aware that any non-const function call performed on the QList | - | ||||||||||||
1744 | will render all existing iterators undefined. If you need to keep | - | ||||||||||||
1745 | iterators over a long period of time, we recommend that you use | - | ||||||||||||
1746 | QLinkedList rather than QList. | - | ||||||||||||
1747 | - | |||||||||||||
1748 | \warning Iterators on implicitly shared containers do not work | - | ||||||||||||
1749 | exactly like STL-iterators. You should avoid copying a container | - | ||||||||||||
1750 | while iterators are active on that container. For more information, | - | ||||||||||||
1751 | read \l{Implicit sharing iterator problem}. | - | ||||||||||||
1752 | - | |||||||||||||
1753 | \sa QList::iterator, QListIterator | - | ||||||||||||
1754 | */ | - | ||||||||||||
1755 | - | |||||||||||||
1756 | /*! \fn QList::const_iterator::const_iterator() | - | ||||||||||||
1757 | - | |||||||||||||
1758 | Constructs an uninitialized iterator. | - | ||||||||||||
1759 | - | |||||||||||||
1760 | Functions like operator*() and operator++() should not be called | - | ||||||||||||
1761 | on an uninitialized iterator. Use operator=() to assign a value | - | ||||||||||||
1762 | to it before using it. | - | ||||||||||||
1763 | - | |||||||||||||
1764 | \sa QList::constBegin(), QList::constEnd() | - | ||||||||||||
1765 | */ | - | ||||||||||||
1766 | - | |||||||||||||
1767 | /*! \typedef QList::const_iterator::iterator_category | - | ||||||||||||
1768 | - | |||||||||||||
1769 | A synonym for \e {std::random_access_iterator_tag} indicating | - | ||||||||||||
1770 | this iterator is a random access iterator. | - | ||||||||||||
1771 | */ | - | ||||||||||||
1772 | - | |||||||||||||
1773 | /*! \typedef QList::const_iterator::difference_type | - | ||||||||||||
1774 | - | |||||||||||||
1775 | \internal | - | ||||||||||||
1776 | */ | - | ||||||||||||
1777 | - | |||||||||||||
1778 | /*! \typedef QList::const_iterator::value_type | - | ||||||||||||
1779 | - | |||||||||||||
1780 | \internal | - | ||||||||||||
1781 | */ | - | ||||||||||||
1782 | - | |||||||||||||
1783 | /*! \typedef QList::const_iterator::pointer | - | ||||||||||||
1784 | - | |||||||||||||
1785 | \internal | - | ||||||||||||
1786 | */ | - | ||||||||||||
1787 | - | |||||||||||||
1788 | /*! \typedef QList::const_iterator::reference | - | ||||||||||||
1789 | - | |||||||||||||
1790 | \internal | - | ||||||||||||
1791 | */ | - | ||||||||||||
1792 | - | |||||||||||||
1793 | /*! \fn QList::const_iterator::const_iterator(Node *node) | - | ||||||||||||
1794 | - | |||||||||||||
1795 | \internal | - | ||||||||||||
1796 | */ | - | ||||||||||||
1797 | - | |||||||||||||
1798 | /*! \fn QList::const_iterator::const_iterator(const const_iterator &other) | - | ||||||||||||
1799 | - | |||||||||||||
1800 | Constructs a copy of \a other. | - | ||||||||||||
1801 | */ | - | ||||||||||||
1802 | - | |||||||||||||
1803 | /*! \fn QList::const_iterator::const_iterator(const iterator &other) | - | ||||||||||||
1804 | - | |||||||||||||
1805 | Constructs a copy of \a other. | - | ||||||||||||
1806 | */ | - | ||||||||||||
1807 | - | |||||||||||||
1808 | /*! \fn const T &QList::const_iterator::operator*() const | - | ||||||||||||
1809 | - | |||||||||||||
1810 | Returns the current item. | - | ||||||||||||
1811 | - | |||||||||||||
1812 | \sa operator->() | - | ||||||||||||
1813 | */ | - | ||||||||||||
1814 | - | |||||||||||||
1815 | /*! \fn const T *QList::const_iterator::operator->() const | - | ||||||||||||
1816 | - | |||||||||||||
1817 | Returns a pointer to the current item. | - | ||||||||||||
1818 | - | |||||||||||||
1819 | \sa operator*() | - | ||||||||||||
1820 | */ | - | ||||||||||||
1821 | - | |||||||||||||
1822 | /*! \fn const T &QList::const_iterator::operator[](difference_type j) const | - | ||||||||||||
1823 | - | |||||||||||||
1824 | Returns the item at position *this + \a{j}. | - | ||||||||||||
1825 | - | |||||||||||||
1826 | This function is provided to make QList iterators behave like C++ | - | ||||||||||||
1827 | pointers. | - | ||||||||||||
1828 | - | |||||||||||||
1829 | \sa operator+() | - | ||||||||||||
1830 | */ | - | ||||||||||||
1831 | - | |||||||||||||
1832 | /*! \fn bool QList::const_iterator::operator==(const const_iterator &other) const | - | ||||||||||||
1833 | - | |||||||||||||
1834 | Returns \c true if \a other points to the same item as this | - | ||||||||||||
1835 | iterator; otherwise returns \c false. | - | ||||||||||||
1836 | - | |||||||||||||
1837 | \sa operator!=() | - | ||||||||||||
1838 | */ | - | ||||||||||||
1839 | - | |||||||||||||
1840 | /*! \fn bool QList::const_iterator::operator!=(const const_iterator &other) const | - | ||||||||||||
1841 | - | |||||||||||||
1842 | Returns \c true if \a other points to a different item than this | - | ||||||||||||
1843 | iterator; otherwise returns \c false. | - | ||||||||||||
1844 | - | |||||||||||||
1845 | \sa operator==() | - | ||||||||||||
1846 | */ | - | ||||||||||||
1847 | - | |||||||||||||
1848 | /*! | - | ||||||||||||
1849 | \fn bool QList::const_iterator::operator<(const const_iterator& other) const | - | ||||||||||||
1850 | - | |||||||||||||
1851 | Returns \c true if the item pointed to by this iterator is less than | - | ||||||||||||
1852 | the item pointed to by the \a other iterator. | - | ||||||||||||
1853 | */ | - | ||||||||||||
1854 | - | |||||||||||||
1855 | /*! | - | ||||||||||||
1856 | \fn bool QList::const_iterator::operator<=(const const_iterator& other) const | - | ||||||||||||
1857 | - | |||||||||||||
1858 | Returns \c true if the item pointed to by this iterator is less than | - | ||||||||||||
1859 | or equal to the item pointed to by the \a other iterator. | - | ||||||||||||
1860 | */ | - | ||||||||||||
1861 | - | |||||||||||||
1862 | /*! | - | ||||||||||||
1863 | \fn bool QList::const_iterator::operator>(const const_iterator& other) const | - | ||||||||||||
1864 | - | |||||||||||||
1865 | Returns \c true if the item pointed to by this iterator is greater | - | ||||||||||||
1866 | than the item pointed to by the \a other iterator. | - | ||||||||||||
1867 | */ | - | ||||||||||||
1868 | - | |||||||||||||
1869 | /*! | - | ||||||||||||
1870 | \fn bool QList::const_iterator::operator>=(const const_iterator& other) const | - | ||||||||||||
1871 | - | |||||||||||||
1872 | Returns \c true if the item pointed to by this iterator is greater | - | ||||||||||||
1873 | than or equal to the item pointed to by the \a other iterator. | - | ||||||||||||
1874 | */ | - | ||||||||||||
1875 | - | |||||||||||||
1876 | /*! \fn QList::const_iterator &QList::const_iterator::operator++() | - | ||||||||||||
1877 | - | |||||||||||||
1878 | The prefix ++ operator (\c{++it}) advances the iterator to the | - | ||||||||||||
1879 | next item in the list and returns an iterator to the new current | - | ||||||||||||
1880 | item. | - | ||||||||||||
1881 | - | |||||||||||||
1882 | Calling this function on QList::end() leads to undefined results. | - | ||||||||||||
1883 | - | |||||||||||||
1884 | \sa operator--() | - | ||||||||||||
1885 | */ | - | ||||||||||||
1886 | - | |||||||||||||
1887 | /*! \fn QList::const_iterator QList::const_iterator::operator++(int) | - | ||||||||||||
1888 | - | |||||||||||||
1889 | \overload | - | ||||||||||||
1890 | - | |||||||||||||
1891 | The postfix ++ operator (\c{it++}) advances the iterator to the | - | ||||||||||||
1892 | next item in the list and returns an iterator to the previously | - | ||||||||||||
1893 | current item. | - | ||||||||||||
1894 | */ | - | ||||||||||||
1895 | - | |||||||||||||
1896 | /*! \fn QList::const_iterator &QList::const_iterator::operator--() | - | ||||||||||||
1897 | - | |||||||||||||
1898 | The prefix -- operator (\c{--it}) makes the preceding item | - | ||||||||||||
1899 | current and returns an iterator to the new current item. | - | ||||||||||||
1900 | - | |||||||||||||
1901 | Calling this function on QList::begin() leads to undefined results. | - | ||||||||||||
1902 | - | |||||||||||||
1903 | \sa operator++() | - | ||||||||||||
1904 | */ | - | ||||||||||||
1905 | - | |||||||||||||
1906 | /*! \fn QList::const_iterator QList::const_iterator::operator--(int) | - | ||||||||||||
1907 | - | |||||||||||||
1908 | \overload | - | ||||||||||||
1909 | - | |||||||||||||
1910 | The postfix -- operator (\c{it--}) makes the preceding item | - | ||||||||||||
1911 | current and returns an iterator to the previously current item. | - | ||||||||||||
1912 | */ | - | ||||||||||||
1913 | - | |||||||||||||
1914 | /*! \fn QList::const_iterator &QList::const_iterator::operator+=(difference_type j) | - | ||||||||||||
1915 | - | |||||||||||||
1916 | Advances the iterator by \a j items. (If \a j is negative, the | - | ||||||||||||
1917 | iterator goes backward.) | - | ||||||||||||
1918 | - | |||||||||||||
1919 | \sa operator-=(), operator+() | - | ||||||||||||
1920 | */ | - | ||||||||||||
1921 | - | |||||||||||||
1922 | /*! \fn QList::const_iterator &QList::const_iterator::operator-=(difference_type j) | - | ||||||||||||
1923 | - | |||||||||||||
1924 | Makes the iterator go back by \a j items. (If \a j is negative, | - | ||||||||||||
1925 | the iterator goes forward.) | - | ||||||||||||
1926 | - | |||||||||||||
1927 | \sa operator+=(), operator-() | - | ||||||||||||
1928 | */ | - | ||||||||||||
1929 | - | |||||||||||||
1930 | /*! \fn QList::const_iterator QList::const_iterator::operator+(difference_type j) const | - | ||||||||||||
1931 | - | |||||||||||||
1932 | Returns an iterator to the item at \a j positions forward from | - | ||||||||||||
1933 | this iterator. (If \a j is negative, the iterator goes backward.) | - | ||||||||||||
1934 | - | |||||||||||||
1935 | \sa operator-(), operator+=() | - | ||||||||||||
1936 | */ | - | ||||||||||||
1937 | - | |||||||||||||
1938 | /*! \fn QList::const_iterator QList::const_iterator::operator-(difference_type j) const | - | ||||||||||||
1939 | - | |||||||||||||
1940 | Returns an iterator to the item at \a j positions backward from | - | ||||||||||||
1941 | this iterator. (If \a j is negative, the iterator goes forward.) | - | ||||||||||||
1942 | - | |||||||||||||
1943 | \sa operator+(), operator-=() | - | ||||||||||||
1944 | */ | - | ||||||||||||
1945 | - | |||||||||||||
1946 | /*! \fn int QList::const_iterator::operator-(const_iterator other) const | - | ||||||||||||
1947 | - | |||||||||||||
1948 | Returns the number of items between the item pointed to by \a | - | ||||||||||||
1949 | other and the item pointed to by this iterator. | - | ||||||||||||
1950 | */ | - | ||||||||||||
1951 | - | |||||||||||||
1952 | /*! \fn QDataStream &operator<<(QDataStream &out, const QList<T> &list) | - | ||||||||||||
1953 | \relates QList | - | ||||||||||||
1954 | - | |||||||||||||
1955 | Writes the list \a list to stream \a out. | - | ||||||||||||
1956 | - | |||||||||||||
1957 | This function requires the value type to implement \c | - | ||||||||||||
1958 | operator<<(). | - | ||||||||||||
1959 | - | |||||||||||||
1960 | \sa{Serializing Qt Data Types}{Format of the QDataStream operators} | - | ||||||||||||
1961 | */ | - | ||||||||||||
1962 | - | |||||||||||||
1963 | /*! \fn QDataStream &operator>>(QDataStream &in, QList<T> &list) | - | ||||||||||||
1964 | \relates QList | - | ||||||||||||
1965 | - | |||||||||||||
1966 | Reads a list from stream \a in into \a list. | - | ||||||||||||
1967 | - | |||||||||||||
1968 | This function requires the value type to implement \c | - | ||||||||||||
1969 | operator>>(). | - | ||||||||||||
1970 | - | |||||||||||||
1971 | \sa{Serializing Qt Data Types}{Format of the QDataStream operators} | - | ||||||||||||
1972 | */ | - | ||||||||||||
1973 | - | |||||||||||||
1974 | /*! \fn QList<T> QList<T>::fromVector(const QVector<T> &vector) | - | ||||||||||||
1975 | - | |||||||||||||
1976 | Returns a QList object with the data contained in \a vector. | - | ||||||||||||
1977 | - | |||||||||||||
1978 | Example: | - | ||||||||||||
1979 | - | |||||||||||||
1980 | \snippet code/src_corelib_tools_qlistdata.cpp 21 | - | ||||||||||||
1981 | - | |||||||||||||
1982 | \sa fromSet(), toVector(), QVector::toList() | - | ||||||||||||
1983 | */ | - | ||||||||||||
1984 | - | |||||||||||||
1985 | /*! \fn QVector<T> QList<T>::toVector() const | - | ||||||||||||
1986 | - | |||||||||||||
1987 | Returns a QVector object with the data contained in this QList. | - | ||||||||||||
1988 | - | |||||||||||||
1989 | Example: | - | ||||||||||||
1990 | - | |||||||||||||
1991 | \snippet code/src_corelib_tools_qlistdata.cpp 22 | - | ||||||||||||
1992 | - | |||||||||||||
1993 | \sa toSet(), fromVector(), QVector::fromList() | - | ||||||||||||
1994 | */ | - | ||||||||||||
1995 | - | |||||||||||||
1996 | /*! \fn QList<T> QList<T>::fromSet(const QSet<T> &set) | - | ||||||||||||
1997 | - | |||||||||||||
1998 | Returns a QList object with the data contained in \a set. The | - | ||||||||||||
1999 | order of the elements in the QList is undefined. | - | ||||||||||||
2000 | - | |||||||||||||
2001 | Example: | - | ||||||||||||
2002 | - | |||||||||||||
2003 | \snippet code/src_corelib_tools_qlistdata.cpp 23 | - | ||||||||||||
2004 | - | |||||||||||||
2005 | \sa fromVector(), toSet(), QSet::toList() | - | ||||||||||||
2006 | */ | - | ||||||||||||
2007 | - | |||||||||||||
2008 | /*! \fn QSet<T> QList<T>::toSet() const | - | ||||||||||||
2009 | - | |||||||||||||
2010 | Returns a QSet object with the data contained in this QList. | - | ||||||||||||
2011 | Since QSet doesn't allow duplicates, the resulting QSet might be | - | ||||||||||||
2012 | smaller than the original list was. | - | ||||||||||||
2013 | - | |||||||||||||
2014 | Example: | - | ||||||||||||
2015 | - | |||||||||||||
2016 | \snippet code/src_corelib_tools_qlistdata.cpp 24 | - | ||||||||||||
2017 | - | |||||||||||||
2018 | \sa toVector(), fromSet(), QSet::fromList() | - | ||||||||||||
2019 | */ | - | ||||||||||||
2020 | - | |||||||||||||
2021 | /*! \fn QList<T> QList<T>::fromStdList(const std::list<T> &list) | - | ||||||||||||
2022 | - | |||||||||||||
2023 | Returns a QList object with the data contained in \a list. The | - | ||||||||||||
2024 | order of the elements in the QList is the same as in \a list. | - | ||||||||||||
2025 | - | |||||||||||||
2026 | Example: | - | ||||||||||||
2027 | - | |||||||||||||
2028 | \snippet code/src_corelib_tools_qlistdata.cpp 25 | - | ||||||||||||
2029 | - | |||||||||||||
2030 | \sa toStdList(), QVector::fromStdVector() | - | ||||||||||||
2031 | */ | - | ||||||||||||
2032 | - | |||||||||||||
2033 | /*! \fn std::list<T> QList<T>::toStdList() const | - | ||||||||||||
2034 | - | |||||||||||||
2035 | Returns a std::list object with the data contained in this QList. | - | ||||||||||||
2036 | Example: | - | ||||||||||||
2037 | - | |||||||||||||
2038 | \snippet code/src_corelib_tools_qlistdata.cpp 26 | - | ||||||||||||
2039 | - | |||||||||||||
2040 | \sa fromStdList(), QVector::toStdVector() | - | ||||||||||||
2041 | */ | - | ||||||||||||
2042 | - | |||||||||||||
2043 | QT_END_NAMESPACE | - | ||||||||||||
Source code | Switch to Preprocessed file |