15QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QCollatorSortKeyPrivate)
27 int currentGeneration = QLocalePrivate::s_generation.loadRelaxed();
28 if (Q_UNLIKELY(
generation != currentGeneration)) {
31 theCollator = QCollator();
37Q_GLOBAL_STATIC(QThreadStorage<GenerationalCollator>, defaultCollator)
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
84
85
86
87
88
89
90
91
92
93
100
101
102
103
104QCollator::QCollator(
const QLocale &locale)
105 : d(
new QCollatorPrivate(locale))
110
111
112QCollator::QCollator(
const QCollator &other)
117 d->ensureInitialized();
123
124
125QCollator::~QCollator()
127 if (d && !d->ref.deref())
132
133
134QCollator &QCollator::operator=(
const QCollator &other)
136 if (
this != &other) {
137 if (d && !d->ref.deref())
142 d->ensureInitialized();
150
151
152
153
154
155
156
157
158
159
162
163
164
165
166
167
170
171
172
174bool comparesEqual(
const QCollator &lhs,
const QCollator &rhs)
noexcept
178 if (!lhs.d || !rhs.d)
181 return lhs.d->caseSensitivity == rhs.d->caseSensitivity
182 && lhs.d->numericMode == rhs.d->numericMode
183 && lhs.d->ignorePunctuation == rhs.d->ignorePunctuation
184 && lhs.d->locale == rhs.d->locale;
188
189
190void QCollator::detach()
193 d =
new QCollatorPrivate(QLocale().collation());
195 }
else if (d->ref.loadRelaxed() != 1) {
196 QCollatorPrivate *x =
new QCollatorPrivate(d->locale);
206
207
208
209
210void QCollator::setLocale(
const QLocale &locale)
212 if (locale ==
this->locale())
220
221
222
223
224
225
226
227QLocale QCollator::locale()
const
229 return d ? d->locale : QLocale().collation();
233
234
235
236
237void QCollator::setCaseSensitivity(Qt::CaseSensitivity cs)
239 if (cs == caseSensitivity())
243 d->caseSensitivity = cs;
247
248
249
250
251
252
253
254
255
256
257
258Qt::CaseSensitivity QCollator::caseSensitivity()
const
260 return d ? d->caseSensitivity : Qt::CaseSensitive;
264
265
266
267
268void QCollator::setNumericMode(
bool on)
270 if (on == numericMode())
278
279
280
281
282
283
284
285
286
287bool QCollator::numericMode()
const
289 return d ? d->numericMode :
false;
293
294
295
296
297void QCollator::setIgnorePunctuation(
bool on)
299 if (on == ignorePunctuation())
303 d->ignorePunctuation = on;
307
308
309
310
311
312
313
314bool QCollator::ignorePunctuation()
const
316 return d ? d->ignorePunctuation :
false;
320
321
322
323
324
325
326
327
330
331
332
333
334
335
336
337
340
341
342
343
346
347
348
349
352
353
354
355
356
357
358
359
360
361
362
363
364
365
368
369
370
371
372
373
374
375
376int QCollator::defaultCompare(QStringView s1, QStringView s2)
378 return defaultCollator->localData().collator().compare(s1, s2);
382
383
384
385
386
387
388
389QCollatorSortKey QCollator::defaultSortKey(QStringView key)
391 return defaultCollator->localData().collator().sortKey(key.toString());
395
396
397
398
399
400
401
402
403
404
405
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
427
428
429QCollatorSortKey::QCollatorSortKey(QCollatorSortKeyPrivate *d)
435
436
437QCollatorSortKey::QCollatorSortKey(
const QCollatorSortKey &other)
443
444
445
446
447
448
451
452
453QCollatorSortKey::~QCollatorSortKey()
458
459
460QCollatorSortKey& QCollatorSortKey::operator=(
const QCollatorSortKey &other)
462 if (
this != &other) {
469
470
471
472
473
474
477
478
479
480
481
482
483
484
487
488
489
492
493
494
495
496
497
498
499
500
501
502
Combined button and popup list for selecting options.
GenerationalCollator(const QCollator ©)
GenerationalCollator()=default