1/****************************************************************************
2**
3** Copyright (C) 2020 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtCore module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QLOCALE_H
41#define QLOCALE_H
42
43#include <QtCore/qvariant.h>
44#include <QtCore/qstring.h>
45#include <QtCore/qobjectdefs.h>
46#include <QtCore/qshareddata.h>
47
48QT_BEGIN_NAMESPACE
49
50class QCalendar;
51class QDataStream;
52class QDate;
53class QDateTime;
54class QLocale;
55class QTime;
56class QVariant;
57class QTextStream;
58class QTextStreamPrivate;
59
60class QLocalePrivate;
61
62Q_CORE_EXPORT uint qHash(const QLocale &key, uint seed = 0) noexcept;
63
64class Q_CORE_EXPORT QLocale
65{
66 Q_GADGET
67 friend class QString;
68 friend class QStringRef;
69 friend class QByteArray;
70 friend class QIntValidator;
71 friend class QDoubleValidatorPrivate;
72 friend class QTextStream;
73 friend class QTextStreamPrivate;
74
75public:
76// see qlocale_data_p.h for more info on generated data
77// GENERATED PART STARTS HERE
78 enum Language {
79 AnyLanguage = 0,
80 C = 1,
81 Abkhazian = 2,
82 Oromo = 3,
83 Afar = 4,
84 Afrikaans = 5,
85 Albanian = 6,
86 Amharic = 7,
87 Arabic = 8,
88 Armenian = 9,
89 Assamese = 10,
90 Aymara = 11,
91 Azerbaijani = 12,
92 Bashkir = 13,
93 Basque = 14,
94 Bengali = 15,
95 Dzongkha = 16,
96#if QT_DEPRECATED_SINCE(5, 15)
97 Bihari Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 17,
98#endif
99 Bislama = 18,
100 Breton = 19,
101 Bulgarian = 20,
102 Burmese = 21,
103 Belarusian = 22,
104 Khmer = 23,
105 Catalan = 24,
106 Chinese = 25,
107 Corsican = 26,
108 Croatian = 27,
109 Czech = 28,
110 Danish = 29,
111 Dutch = 30,
112 English = 31,
113 Esperanto = 32,
114 Estonian = 33,
115 Faroese = 34,
116 Fijian = 35,
117 Finnish = 36,
118 French = 37,
119 WesternFrisian = 38,
120 Gaelic = 39,
121 Galician = 40,
122 Georgian = 41,
123 German = 42,
124 Greek = 43,
125 Greenlandic = 44,
126 Guarani = 45,
127 Gujarati = 46,
128 Hausa = 47,
129 Hebrew = 48,
130 Hindi = 49,
131 Hungarian = 50,
132 Icelandic = 51,
133 Indonesian = 52,
134 Interlingua = 53,
135 Interlingue = 54,
136 Inuktitut = 55,
137 Inupiak = 56,
138 Irish = 57,
139 Italian = 58,
140 Japanese = 59,
141 Javanese = 60,
142 Kannada = 61,
143 Kashmiri = 62,
144 Kazakh = 63,
145 Kinyarwanda = 64,
146 Kirghiz = 65,
147 Korean = 66,
148 Kurdish = 67,
149 Rundi = 68,
150 Lao = 69,
151 Latin = 70,
152 Latvian = 71,
153 Lingala = 72,
154 Lithuanian = 73,
155 Macedonian = 74,
156 Malagasy = 75,
157 Malay = 76,
158 Malayalam = 77,
159 Maltese = 78,
160 Maori = 79,
161 Marathi = 80,
162 Marshallese = 81,
163 Mongolian = 82,
164 NauruLanguage = 83,
165 Nepali = 84,
166 NorwegianBokmal = 85,
167 Occitan = 86,
168 Oriya = 87,
169 Pashto = 88,
170 Persian = 89,
171 Polish = 90,
172 Portuguese = 91,
173 Punjabi = 92,
174 Quechua = 93,
175 Romansh = 94,
176 Romanian = 95,
177 Russian = 96,
178 Samoan = 97,
179 Sango = 98,
180 Sanskrit = 99,
181 Serbian = 100,
182 Ossetic = 101,
183 SouthernSotho = 102,
184 Tswana = 103,
185 Shona = 104,
186 Sindhi = 105,
187 Sinhala = 106,
188 Swati = 107,
189 Slovak = 108,
190 Slovenian = 109,
191 Somali = 110,
192 Spanish = 111,
193 Sundanese = 112,
194 Swahili = 113,
195 Swedish = 114,
196 Sardinian = 115,
197 Tajik = 116,
198 Tamil = 117,
199 Tatar = 118,
200 Telugu = 119,
201 Thai = 120,
202 Tibetan = 121,
203 Tigrinya = 122,
204 Tongan = 123,
205 Tsonga = 124,
206 Turkish = 125,
207 Turkmen = 126,
208 Tahitian = 127,
209 Uighur = 128,
210 Ukrainian = 129,
211 Urdu = 130,
212 Uzbek = 131,
213 Vietnamese = 132,
214 Volapuk = 133,
215 Welsh = 134,
216 Wolof = 135,
217 Xhosa = 136,
218 Yiddish = 137,
219 Yoruba = 138,
220 Zhuang = 139,
221 Zulu = 140,
222 NorwegianNynorsk = 141,
223 Bosnian = 142,
224 Divehi = 143,
225 Manx = 144,
226 Cornish = 145,
227 Akan = 146,
228 Konkani = 147,
229 Ga = 148,
230 Igbo = 149,
231 Kamba = 150,
232 Syriac = 151,
233 Blin = 152,
234 Geez = 153,
235 Koro = 154,
236 Sidamo = 155,
237 Atsam = 156,
238 Tigre = 157,
239 Jju = 158,
240 Friulian = 159,
241 Venda = 160,
242 Ewe = 161,
243 Walamo = 162,
244 Hawaiian = 163,
245 Tyap = 164,
246 Nyanja = 165,
247 Filipino = 166,
248 SwissGerman = 167,
249 SichuanYi = 168,
250 Kpelle = 169,
251 LowGerman = 170,
252 SouthNdebele = 171,
253 NorthernSotho = 172,
254 NorthernSami = 173,
255 Taroko = 174,
256 Gusii = 175,
257 Taita = 176,
258 Fulah = 177,
259 Kikuyu = 178,
260 Samburu = 179,
261 Sena = 180,
262 NorthNdebele = 181,
263 Rombo = 182,
264 Tachelhit = 183,
265 Kabyle = 184,
266 Nyankole = 185,
267 Bena = 186,
268 Vunjo = 187,
269 Bambara = 188,
270 Embu = 189,
271 Cherokee = 190,
272 Morisyen = 191,
273 Makonde = 192,
274 Langi = 193,
275 Ganda = 194,
276 Bemba = 195,
277 Kabuverdianu = 196,
278 Meru = 197,
279 Kalenjin = 198,
280 Nama = 199,
281 Machame = 200,
282 Colognian = 201,
283 Masai = 202,
284 Soga = 203,
285 Luyia = 204,
286 Asu = 205,
287 Teso = 206,
288 Saho = 207,
289 KoyraChiini = 208,
290 Rwa = 209,
291 Luo = 210,
292 Chiga = 211,
293 CentralMoroccoTamazight = 212,
294 KoyraboroSenni = 213,
295 Shambala = 214,
296 Bodo = 215,
297 Avaric = 216,
298 Chamorro = 217,
299 Chechen = 218,
300 Church = 219,
301 Chuvash = 220,
302 Cree = 221,
303 Haitian = 222,
304 Herero = 223,
305 HiriMotu = 224,
306 Kanuri = 225,
307 Komi = 226,
308 Kongo = 227,
309 Kwanyama = 228,
310 Limburgish = 229,
311 LubaKatanga = 230,
312 Luxembourgish = 231,
313 Navaho = 232,
314 Ndonga = 233,
315 Ojibwa = 234,
316 Pali = 235,
317 Walloon = 236,
318 Aghem = 237,
319 Basaa = 238,
320 Zarma = 239,
321 Duala = 240,
322 JolaFonyi = 241,
323 Ewondo = 242,
324 Bafia = 243,
325 MakhuwaMeetto = 244,
326 Mundang = 245,
327 Kwasio = 246,
328 Nuer = 247,
329 Sakha = 248,
330 Sangu = 249,
331#if QT_DEPRECATED_SINCE(5, 15)
332 CongoSwahili Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 250,
333#endif
334 Tasawaq = 251,
335 Vai = 252,
336 Walser = 253,
337 Yangben = 254,
338 Avestan = 255,
339 Asturian = 256,
340 Ngomba = 257,
341 Kako = 258,
342 Meta = 259,
343 Ngiemboon = 260,
344 Aragonese = 261,
345 Akkadian = 262,
346 AncientEgyptian = 263,
347 AncientGreek = 264,
348 Aramaic = 265,
349 Balinese = 266,
350 Bamun = 267,
351 BatakToba = 268,
352 Buginese = 269,
353#if QT_DEPRECATED_SINCE(5, 15)
354 Buhid Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 270,
355 Carian Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 271,
356#endif
357 Chakma = 272,
358#if QT_DEPRECATED_SINCE(5, 15)
359 ClassicalMandaic Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 273,
360#endif
361 Coptic = 274,
362 Dogri = 275,
363#if QT_DEPRECATED_SINCE(5, 15)
364 EasternCham Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 276,
365 EasternKayah Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 277,
366 Etruscan Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 278,
367#endif
368 Gothic = 279,
369#if QT_DEPRECATED_SINCE(5, 15)
370 Hanunoo Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 280,
371#endif
372 Ingush = 281,
373#if QT_DEPRECATED_SINCE(5, 15)
374 LargeFloweryMiao Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 282,
375 Lepcha Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 283,
376 Limbu Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 284,
377 Lisu Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 285,
378 Lu Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 286,
379 Lycian Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 287,
380 Lydian Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 288,
381#endif
382 Mandingo = 289,
383 Manipuri = 290,
384#if QT_DEPRECATED_SINCE(5, 15)
385 Meroitic Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 291,
386 NorthernThai Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 292,
387#endif
388 OldIrish = 293,
389 OldNorse = 294,
390 OldPersian = 295,
391#if QT_DEPRECATED_SINCE(5, 15)
392 OldTurkish Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 296,
393#endif
394 Pahlavi = 297,
395#if QT_DEPRECATED_SINCE(5, 15)
396 Parthian Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 298,
397#endif
398 Phoenician = 299,
399#if QT_DEPRECATED_SINCE(5, 15)
400 PrakritLanguage Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 300,
401 Rejang Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 301,
402 Sabaean Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 302,
403 Samaritan Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 303,
404#endif
405 Santali = 304,
406 Saurashtra = 305,
407#if QT_DEPRECATED_SINCE(5, 15)
408 Sora Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 306,
409 Sylheti Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 307,
410 Tagbanwa Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 308,
411#endif
412 TaiDam = 309,
413#if QT_DEPRECATED_SINCE(5, 15)
414 TaiNua Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 310,
415#endif
416 Ugaritic = 311,
417 Akoose = 312,
418 Lakota = 313,
419 StandardMoroccanTamazight = 314,
420 Mapuche = 315,
421 CentralKurdish = 316,
422 LowerSorbian = 317,
423 UpperSorbian = 318,
424 Kenyang = 319,
425 Mohawk = 320,
426 Nko = 321,
427 Prussian = 322,
428 Kiche = 323,
429 SouthernSami = 324,
430 LuleSami = 325,
431 InariSami = 326,
432 SkoltSami = 327,
433 Warlpiri = 328,
434#if QT_DEPRECATED_SINCE(5, 15)
435 ManichaeanMiddlePersian Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 329,
436#endif
437 Mende = 330,
438#if QT_DEPRECATED_SINCE(5, 15)
439 AncientNorthArabian Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 331,
440 LinearA Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 332,
441 HmongNjua Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 333,
442 Ho Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 334,
443#endif
444 Lezghian = 335,
445#if QT_DEPRECATED_SINCE(5, 15)
446 Bassa Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 336,
447 Mono Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 337,
448 TedimChin Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 338,
449#endif
450 Maithili = 339,
451#if QT_DEPRECATED_SINCE(5, 15)
452 Ahom Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 340,
453#endif
454 AmericanSignLanguage = 341,
455#if QT_DEPRECATED_SINCE(5, 15)
456 ArdhamagadhiPrakrit Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 342,
457#endif
458 Bhojpuri = 343,
459#if QT_DEPRECATED_SINCE(5, 15)
460 HieroglyphicLuwian Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 344,
461#endif
462 LiteraryChinese = 345,
463 Mazanderani = 346,
464#if QT_DEPRECATED_SINCE(5, 15)
465 Mru Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 347,
466#endif
467 Newari = 348,
468 NorthernLuri = 349,
469 Palauan = 350,
470 Papiamento = 351,
471#if QT_DEPRECATED_SINCE(5, 15)
472 Saraiki Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 352,
473#endif
474 TokelauLanguage = 353,
475 TokPisin = 354,
476 TuvaluLanguage = 355,
477#if QT_DEPRECATED_SINCE(5, 15)
478 UncodedLanguages Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 356,
479#endif
480 Cantonese = 357,
481 Osage = 358,
482#if QT_DEPRECATED_SINCE(5, 15)
483 Tangut Q_DECL_ENUMERATOR_DEPRECATED_X("No locale data for this language") = 359,
484#endif
485 Ido = 360,
486 Lojban = 361,
487 Sicilian = 362,
488 SouthernKurdish = 363,
489 WesternBalochi = 364,
490 Cebuano = 365,
491 Erzya = 366,
492 Chickasaw = 367,
493 Muscogee = 368,
494 Silesian = 369,
495 NigerianPidgin = 370,
496
497 Afan = Oromo,
498 Bhutani = Dzongkha,
499 Byelorussian = Belarusian,
500 Cambodian = Khmer,
501 Chewa = Nyanja,
502 Frisian = WesternFrisian,
503 Kurundi = Rundi,
504#if QT_DEPRECATED_SINCE(5, 15)
505 Moldavian Q_DECL_ENUMERATOR_DEPRECATED_X("Obsolete name, use Romanian") = Romanian,
506 Norwegian Q_DECL_ENUMERATOR_DEPRECATED_X("Obsolete name, use NorwegianBokmal") = NorwegianBokmal,
507#endif
508 RhaetoRomance = Romansh,
509#if QT_DEPRECATED_SINCE(5, 15)
510 SerboCroatian Q_DECL_ENUMERATOR_DEPRECATED_X("Obsolete name, use Serbian") = Serbian,
511 Tagalog Q_DECL_ENUMERATOR_DEPRECATED_X("Obsolete name, use Filipino") = Filipino,
512 Twi Q_DECL_ENUMERATOR_DEPRECATED_X("Obsolete name, use Akan") = Akan,
513#endif
514 Uigur = Uighur,
515
516 LastLanguage = NigerianPidgin
517 };
518
519 enum Script {
520 AnyScript = 0,
521 ArabicScript = 1,
522 CyrillicScript = 2,
523 DeseretScript = 3,
524 GurmukhiScript = 4,
525 SimplifiedHanScript = 5,
526 TraditionalHanScript = 6,
527 LatinScript = 7,
528 MongolianScript = 8,
529 TifinaghScript = 9,
530 ArmenianScript = 10,
531 BengaliScript = 11,
532 CherokeeScript = 12,
533 DevanagariScript = 13,
534 EthiopicScript = 14,
535 GeorgianScript = 15,
536 GreekScript = 16,
537 GujaratiScript = 17,
538 HebrewScript = 18,
539 JapaneseScript = 19,
540 KhmerScript = 20,
541 KannadaScript = 21,
542 KoreanScript = 22,
543 LaoScript = 23,
544 MalayalamScript = 24,
545 MyanmarScript = 25,
546 OriyaScript = 26,
547 TamilScript = 27,
548 TeluguScript = 28,
549 ThaanaScript = 29,
550 ThaiScript = 30,
551 TibetanScript = 31,
552 SinhalaScript = 32,
553 SyriacScript = 33,
554 YiScript = 34,
555 VaiScript = 35,
556 AvestanScript = 36,
557 BalineseScript = 37,
558 BamumScript = 38,
559 BatakScript = 39,
560 BopomofoScript = 40,
561 BrahmiScript = 41,
562 BugineseScript = 42,
563 BuhidScript = 43,
564 CanadianAboriginalScript = 44,
565 CarianScript = 45,
566 ChakmaScript = 46,
567 ChamScript = 47,
568 CopticScript = 48,
569 CypriotScript = 49,
570 EgyptianHieroglyphsScript = 50,
571 FraserScript = 51,
572 GlagoliticScript = 52,
573 GothicScript = 53,
574 HanScript = 54,
575 HangulScript = 55,
576 HanunooScript = 56,
577 ImperialAramaicScript = 57,
578 InscriptionalPahlaviScript = 58,
579 InscriptionalParthianScript = 59,
580 JavaneseScript = 60,
581 KaithiScript = 61,
582 KatakanaScript = 62,
583 KayahLiScript = 63,
584 KharoshthiScript = 64,
585 LannaScript = 65,
586 LepchaScript = 66,
587 LimbuScript = 67,
588 LinearBScript = 68,
589 LycianScript = 69,
590 LydianScript = 70,
591 MandaeanScript = 71,
592 MeiteiMayekScript = 72,
593 MeroiticScript = 73,
594 MeroiticCursiveScript = 74,
595 NkoScript = 75,
596 NewTaiLueScript = 76,
597 OghamScript = 77,
598 OlChikiScript = 78,
599 OldItalicScript = 79,
600 OldPersianScript = 80,
601 OldSouthArabianScript = 81,
602 OrkhonScript = 82,
603 OsmanyaScript = 83,
604 PhagsPaScript = 84,
605 PhoenicianScript = 85,
606 PollardPhoneticScript = 86,
607 RejangScript = 87,
608 RunicScript = 88,
609 SamaritanScript = 89,
610 SaurashtraScript = 90,
611 SharadaScript = 91,
612 ShavianScript = 92,
613 SoraSompengScript = 93,
614 CuneiformScript = 94,
615 SundaneseScript = 95,
616 SylotiNagriScript = 96,
617 TagalogScript = 97,
618 TagbanwaScript = 98,
619 TaiLeScript = 99,
620 TaiVietScript = 100,
621 TakriScript = 101,
622 UgariticScript = 102,
623 BrailleScript = 103,
624 HiraganaScript = 104,
625 CaucasianAlbanianScript = 105,
626 BassaVahScript = 106,
627 DuployanScript = 107,
628 ElbasanScript = 108,
629 GranthaScript = 109,
630 PahawhHmongScript = 110,
631 KhojkiScript = 111,
632 LinearAScript = 112,
633 MahajaniScript = 113,
634 ManichaeanScript = 114,
635 MendeKikakuiScript = 115,
636 ModiScript = 116,
637 MroScript = 117,
638 OldNorthArabianScript = 118,
639 NabataeanScript = 119,
640 PalmyreneScript = 120,
641 PauCinHauScript = 121,
642 OldPermicScript = 122,
643 PsalterPahlaviScript = 123,
644 SiddhamScript = 124,
645 KhudawadiScript = 125,
646 TirhutaScript = 126,
647 VarangKshitiScript = 127,
648 AhomScript = 128,
649 AnatolianHieroglyphsScript = 129,
650 HatranScript = 130,
651 MultaniScript = 131,
652 OldHungarianScript = 132,
653 SignWritingScript = 133,
654 AdlamScript = 134,
655 BhaiksukiScript = 135,
656 MarchenScript = 136,
657 NewaScript = 137,
658 OsageScript = 138,
659 TangutScript = 139,
660 HanWithBopomofoScript = 140,
661 JamoScript = 141,
662
663 SimplifiedChineseScript = SimplifiedHanScript,
664 TraditionalChineseScript = TraditionalHanScript,
665
666 LastScript = JamoScript
667 };
668
669 enum Country {
670 AnyCountry = 0,
671 Afghanistan = 1,
672 Albania = 2,
673 Algeria = 3,
674 AmericanSamoa = 4,
675 Andorra = 5,
676 Angola = 6,
677 Anguilla = 7,
678 Antarctica = 8,
679 AntiguaAndBarbuda = 9,
680 Argentina = 10,
681 Armenia = 11,
682 Aruba = 12,
683 Australia = 13,
684 Austria = 14,
685 Azerbaijan = 15,
686 Bahamas = 16,
687 Bahrain = 17,
688 Bangladesh = 18,
689 Barbados = 19,
690 Belarus = 20,
691 Belgium = 21,
692 Belize = 22,
693 Benin = 23,
694 Bermuda = 24,
695 Bhutan = 25,
696 Bolivia = 26,
697 BosniaAndHerzegowina = 27,
698 Botswana = 28,
699 BouvetIsland = 29,
700 Brazil = 30,
701 BritishIndianOceanTerritory = 31,
702 Brunei = 32,
703 Bulgaria = 33,
704 BurkinaFaso = 34,
705 Burundi = 35,
706 Cambodia = 36,
707 Cameroon = 37,
708 Canada = 38,
709 CapeVerde = 39,
710 CaymanIslands = 40,
711 CentralAfricanRepublic = 41,
712 Chad = 42,
713 Chile = 43,
714 China = 44,
715 ChristmasIsland = 45,
716 CocosIslands = 46,
717 Colombia = 47,
718 Comoros = 48,
719 CongoKinshasa = 49,
720 CongoBrazzaville = 50,
721 CookIslands = 51,
722 CostaRica = 52,
723 IvoryCoast = 53,
724 Croatia = 54,
725 Cuba = 55,
726 Cyprus = 56,
727 CzechRepublic = 57,
728 Denmark = 58,
729 Djibouti = 59,
730 Dominica = 60,
731 DominicanRepublic = 61,
732 EastTimor = 62,
733 Ecuador = 63,
734 Egypt = 64,
735 ElSalvador = 65,
736 EquatorialGuinea = 66,
737 Eritrea = 67,
738 Estonia = 68,
739 Ethiopia = 69,
740 FalklandIslands = 70,
741 FaroeIslands = 71,
742 Fiji = 72,
743 Finland = 73,
744 France = 74,
745 Guernsey = 75,
746 FrenchGuiana = 76,
747 FrenchPolynesia = 77,
748 FrenchSouthernTerritories = 78,
749 Gabon = 79,
750 Gambia = 80,
751 Georgia = 81,
752 Germany = 82,
753 Ghana = 83,
754 Gibraltar = 84,
755 Greece = 85,
756 Greenland = 86,
757 Grenada = 87,
758 Guadeloupe = 88,
759 Guam = 89,
760 Guatemala = 90,
761 Guinea = 91,
762 GuineaBissau = 92,
763 Guyana = 93,
764 Haiti = 94,
765 HeardAndMcDonaldIslands = 95,
766 Honduras = 96,
767 HongKong = 97,
768 Hungary = 98,
769 Iceland = 99,
770 India = 100,
771 Indonesia = 101,
772 Iran = 102,
773 Iraq = 103,
774 Ireland = 104,
775 Israel = 105,
776 Italy = 106,
777 Jamaica = 107,
778 Japan = 108,
779 Jordan = 109,
780 Kazakhstan = 110,
781 Kenya = 111,
782 Kiribati = 112,
783 NorthKorea = 113,
784 SouthKorea = 114,
785 Kuwait = 115,
786 Kyrgyzstan = 116,
787 Laos = 117,
788 Latvia = 118,
789 Lebanon = 119,
790 Lesotho = 120,
791 Liberia = 121,
792 Libya = 122,
793 Liechtenstein = 123,
794 Lithuania = 124,
795 Luxembourg = 125,
796 Macau = 126,
797 Macedonia = 127,
798 Madagascar = 128,
799 Malawi = 129,
800 Malaysia = 130,
801 Maldives = 131,
802 Mali = 132,
803 Malta = 133,
804 MarshallIslands = 134,
805 Martinique = 135,
806 Mauritania = 136,
807 Mauritius = 137,
808 Mayotte = 138,
809 Mexico = 139,
810 Micronesia = 140,
811 Moldova = 141,
812 Monaco = 142,
813 Mongolia = 143,
814 Montserrat = 144,
815 Morocco = 145,
816 Mozambique = 146,
817 Myanmar = 147,
818 Namibia = 148,
819 NauruCountry = 149,
820 Nepal = 150,
821 Netherlands = 151,
822 CuraSao = 152,
823 NewCaledonia = 153,
824 NewZealand = 154,
825 Nicaragua = 155,
826 Niger = 156,
827 Nigeria = 157,
828 Niue = 158,
829 NorfolkIsland = 159,
830 NorthernMarianaIslands = 160,
831 Norway = 161,
832 Oman = 162,
833 Pakistan = 163,
834 Palau = 164,
835 PalestinianTerritories = 165,
836 Panama = 166,
837 PapuaNewGuinea = 167,
838 Paraguay = 168,
839 Peru = 169,
840 Philippines = 170,
841 Pitcairn = 171,
842 Poland = 172,
843 Portugal = 173,
844 PuertoRico = 174,
845 Qatar = 175,
846 Reunion = 176,
847 Romania = 177,
848 Russia = 178,
849 Rwanda = 179,
850 SaintKittsAndNevis = 180,
851 SaintLucia = 181,
852 SaintVincentAndTheGrenadines = 182,
853 Samoa = 183,
854 SanMarino = 184,
855 SaoTomeAndPrincipe = 185,
856 SaudiArabia = 186,
857 Senegal = 187,
858 Seychelles = 188,
859 SierraLeone = 189,
860 Singapore = 190,
861 Slovakia = 191,
862 Slovenia = 192,
863 SolomonIslands = 193,
864 Somalia = 194,
865 SouthAfrica = 195,
866 SouthGeorgiaAndTheSouthSandwichIslands = 196,
867 Spain = 197,
868 SriLanka = 198,
869 SaintHelena = 199,
870 SaintPierreAndMiquelon = 200,
871 Sudan = 201,
872 Suriname = 202,
873 SvalbardAndJanMayenIslands = 203,
874 Swaziland = 204,
875 Sweden = 205,
876 Switzerland = 206,
877 Syria = 207,
878 Taiwan = 208,
879 Tajikistan = 209,
880 Tanzania = 210,
881 Thailand = 211,
882 Togo = 212,
883 TokelauCountry = 213,
884 Tonga = 214,
885 TrinidadAndTobago = 215,
886 Tunisia = 216,
887 Turkey = 217,
888 Turkmenistan = 218,
889 TurksAndCaicosIslands = 219,
890 TuvaluCountry = 220,
891 Uganda = 221,
892 Ukraine = 222,
893 UnitedArabEmirates = 223,
894 UnitedKingdom = 224,
895 UnitedStates = 225,
896 UnitedStatesMinorOutlyingIslands = 226,
897 Uruguay = 227,
898 Uzbekistan = 228,
899 Vanuatu = 229,
900 VaticanCityState = 230,
901 Venezuela = 231,
902 Vietnam = 232,
903 BritishVirginIslands = 233,
904 UnitedStatesVirginIslands = 234,
905 WallisAndFutunaIslands = 235,
906 WesternSahara = 236,
907 Yemen = 237,
908 CanaryIslands = 238,
909 Zambia = 239,
910 Zimbabwe = 240,
911 ClippertonIsland = 241,
912 Montenegro = 242,
913 Serbia = 243,
914 SaintBarthelemy = 244,
915 SaintMartin = 245,
916 LatinAmerica = 246,
917 AscensionIsland = 247,
918 AlandIslands = 248,
919 DiegoGarcia = 249,
920 CeutaAndMelilla = 250,
921 IsleOfMan = 251,
922 Jersey = 252,
923 TristanDaCunha = 253,
924 SouthSudan = 254,
925 Bonaire = 255,
926 SintMaarten = 256,
927 Kosovo = 257,
928 EuropeanUnion = 258,
929 OutlyingOceania = 259,
930 World = 260,
931 Europe = 261,
932
933 DemocraticRepublicOfCongo = CongoKinshasa,
934 DemocraticRepublicOfKorea = NorthKorea,
935 LatinAmericaAndTheCaribbean = LatinAmerica,
936 PeoplesRepublicOfCongo = CongoBrazzaville,
937 RepublicOfKorea = SouthKorea,
938 RussianFederation = Russia,
939 SyrianArabRepublic = Syria,
940#if QT_DEPRECATED_SINCE(5, 15)
941 Tokelau Q_DECL_ENUMERATOR_DEPRECATED_X("Obsolete name, use TokelauCountry") = TokelauCountry,
942 Tuvalu Q_DECL_ENUMERATOR_DEPRECATED_X("Obsolete name, use TuvaluCountry") = TuvaluCountry,
943#endif
944
945 LastCountry = Europe
946 };
947// GENERATED PART ENDS HERE
948
949 Q_ENUM(Language)
950 Q_ENUM(Country)
951 Q_ENUM(Script)
952
953 enum MeasurementSystem {
954 MetricSystem,
955 ImperialUSSystem,
956 ImperialUKSystem,
957 ImperialSystem = ImperialUSSystem // Qt 4 compatibility
958 };
959 Q_ENUM(MeasurementSystem)
960
961 enum FormatType { LongFormat, ShortFormat, NarrowFormat };
962 enum NumberOption {
963 DefaultNumberOptions = 0x0,
964 OmitGroupSeparator = 0x01,
965 RejectGroupSeparator = 0x02,
966 OmitLeadingZeroInExponent = 0x04,
967 RejectLeadingZeroInExponent = 0x08,
968 IncludeTrailingZeroesAfterDot = 0x10,
969 RejectTrailingZeroesAfterDot = 0x20
970 };
971 Q_DECLARE_FLAGS(NumberOptions, NumberOption)
972
973 enum FloatingPointPrecisionOption {
974 FloatingPointShortest = -128
975 };
976
977 enum CurrencySymbolFormat {
978 CurrencyIsoCode,
979 CurrencySymbol,
980 CurrencyDisplayName
981 };
982
983 enum DataSizeFormat {
984 // Single-bit values, for internal use.
985 DataSizeBase1000 = 1, // use factors of 1000 instead of IEC's 1024;
986 DataSizeSIQuantifiers = 2, // use SI quantifiers instead of IEC ones.
987
988 // Flags values for use in API:
989 DataSizeIecFormat = 0, // base 1024, KiB, MiB, GiB, ...
990 DataSizeTraditionalFormat = DataSizeSIQuantifiers, // base 1024, kB, MB, GB, ...
991 DataSizeSIFormat = DataSizeBase1000 | DataSizeSIQuantifiers // base 1000, kB, MB, GB, ...
992 };
993 Q_DECLARE_FLAGS(DataSizeFormats, DataSizeFormat)
994 Q_FLAG(DataSizeFormats)
995
996 QLocale();
997 QLocale(const QString &name);
998 QLocale(Language language, Country country = AnyCountry);
999 QLocale(Language language, Script script, Country country);
1000 QLocale(const QLocale &other);
1001 QLocale &operator=(QLocale &&other) noexcept { swap(other); return *this; }
1002 QLocale &operator=(const QLocale &other);
1003 ~QLocale();
1004
1005 void swap(QLocale &other) noexcept { qSwap(value1&: d, value2&: other.d); }
1006
1007 Language language() const;
1008 Script script() const;
1009 Country country() const;
1010 QString name() const;
1011
1012 QString bcp47Name() const;
1013 QString nativeLanguageName() const;
1014 QString nativeCountryName() const;
1015
1016#if QT_STRINGVIEW_LEVEL < 2
1017 short toShort(const QString &s, bool *ok = nullptr) const;
1018 ushort toUShort(const QString &s, bool *ok = nullptr) const;
1019 int toInt(const QString &s, bool *ok = nullptr) const;
1020 uint toUInt(const QString &s, bool *ok = nullptr) const;
1021 long toLong(const QString &s, bool *ok = nullptr) const;
1022 ulong toULong(const QString &s, bool *ok = nullptr) const;
1023 qlonglong toLongLong(const QString &s, bool *ok = nullptr) const;
1024 qulonglong toULongLong(const QString &s, bool *ok = nullptr) const;
1025 float toFloat(const QString &s, bool *ok = nullptr) const;
1026 double toDouble(const QString &s, bool *ok = nullptr) const;
1027
1028 short toShort(const QStringRef &s, bool *ok = nullptr) const;
1029 ushort toUShort(const QStringRef &s, bool *ok = nullptr) const;
1030 int toInt(const QStringRef &s, bool *ok = nullptr) const;
1031 uint toUInt(const QStringRef &s, bool *ok = nullptr) const;
1032 long toLong(const QStringRef &s, bool *ok = nullptr) const;
1033 ulong toULong(const QStringRef &s, bool *ok = nullptr) const;
1034 qlonglong toLongLong(const QStringRef &s, bool *ok = nullptr) const;
1035 qulonglong toULongLong(const QStringRef &s, bool *ok = nullptr) const;
1036 float toFloat(const QStringRef &s, bool *ok = nullptr) const;
1037 double toDouble(const QStringRef &s, bool *ok = nullptr) const;
1038#endif
1039
1040 short toShort(QStringView s, bool *ok = nullptr) const;
1041 ushort toUShort(QStringView s, bool *ok = nullptr) const;
1042 int toInt(QStringView s, bool *ok = nullptr) const;
1043 uint toUInt(QStringView s, bool *ok = nullptr) const;
1044 long toLong(QStringView s, bool *ok = nullptr) const;
1045 ulong toULong(QStringView s, bool *ok = nullptr) const;
1046 qlonglong toLongLong(QStringView s, bool *ok = nullptr) const;
1047 qulonglong toULongLong(QStringView s, bool *ok = nullptr) const;
1048 float toFloat(QStringView s, bool *ok = nullptr) const;
1049 double toDouble(QStringView s, bool *ok = nullptr) const;
1050
1051 QString toString(qlonglong i) const;
1052 QString toString(qulonglong i) const;
1053 inline QString toString(long i) const;
1054 inline QString toString(ulong i) const;
1055 inline QString toString(short i) const;
1056 inline QString toString(ushort i) const;
1057 inline QString toString(int i) const;
1058 inline QString toString(uint i) const;
1059 QString toString(double i, char f = 'g', int prec = 6) const;
1060 inline QString toString(float i, char f = 'g', int prec = 6) const;
1061
1062#if QT_STRINGVIEW_LEVEL < 2
1063 QString toString(const QDate &date, const QString &formatStr) const;
1064 QString toString(const QTime &time, const QString &formatStr) const;
1065 QString toString(const QDateTime &dateTime, const QString &format) const;
1066#endif
1067 QString toString(const QDate &date, QStringView formatStr) const;
1068 QString toString(const QTime &time, QStringView formatStr) const;
1069 QString toString(const QDateTime &dateTime, QStringView format) const;
1070 QString toString(const QDate &date, FormatType format = LongFormat) const;
1071 QString toString(const QTime &time, FormatType format = LongFormat) const;
1072 QString toString(const QDateTime &dateTime, FormatType format = LongFormat) const;
1073 /* We can't pass a default for QCalendar (its declaration mentions
1074 * QLocale::FormatType, so it has to #include this header, which thus can't
1075 * #include its, so we can't instantiate QCalendar() as default). This
1076 * precludes any default for format, too.
1077 */
1078 QString toString(const QDate &date, QStringView formatStr, QCalendar cal) const;
1079 QString toString(const QDate &date, FormatType format, QCalendar cal) const;
1080 QString toString(const QDateTime &dateTime, FormatType format, QCalendar cal) const;
1081 QString toString(const QDateTime &dateTime, QStringView formatStr, QCalendar cal) const;
1082
1083 QString dateFormat(FormatType format = LongFormat) const;
1084 QString timeFormat(FormatType format = LongFormat) const;
1085 QString dateTimeFormat(FormatType format = LongFormat) const;
1086#if QT_CONFIG(datestring)
1087 QDate toDate(const QString &string, FormatType = LongFormat) const;
1088 QTime toTime(const QString &string, FormatType = LongFormat) const;
1089 QDateTime toDateTime(const QString &string, FormatType format = LongFormat) const;
1090 QDate toDate(const QString &string, const QString &format) const;
1091 QTime toTime(const QString &string, const QString &format) const;
1092 QDateTime toDateTime(const QString &string, const QString &format) const;
1093 // Calendar-aware API
1094 QDate toDate(const QString &string, FormatType format, QCalendar cal) const;
1095 QDateTime toDateTime(const QString &string, FormatType format, QCalendar cal) const;
1096 QDate toDate(const QString &string, const QString &format, QCalendar cal) const;
1097 QDateTime toDateTime(const QString &string, const QString &format, QCalendar cal) const;
1098# if QT_DEPRECATED_SINCE(5, 15)
1099 QT_DEPRECATED_X("Calendar is ignored when parsing times")
1100 QTime toTime(const QString &string, FormatType format, QCalendar cal) const;
1101 QT_DEPRECATED_X("Calendar is ignored when parsing times")
1102 QTime toTime(const QString &string, const QString &format, QCalendar cal) const;
1103# endif // 5.15
1104#endif
1105
1106 // ### Qt 6: We need to return QString from these function since
1107 // UTF-16 may need surrogate pairs to represent these fields.
1108 QChar decimalPoint() const;
1109 QChar groupSeparator() const;
1110 QChar percent() const;
1111 QChar zeroDigit() const;
1112 QChar negativeSign() const;
1113 QChar positiveSign() const;
1114 QChar exponential() const;
1115
1116 QString monthName(int, FormatType format = LongFormat) const;
1117 QString standaloneMonthName(int, FormatType format = LongFormat) const;
1118 QString dayName(int, FormatType format = LongFormat) const;
1119 QString standaloneDayName(int, FormatType format = LongFormat) const;
1120
1121 Qt::DayOfWeek firstDayOfWeek() const;
1122 QList<Qt::DayOfWeek> weekdays() const;
1123
1124 QString amText() const;
1125 QString pmText() const;
1126
1127 MeasurementSystem measurementSystem() const;
1128 QLocale collation() const;
1129 Qt::LayoutDirection textDirection() const;
1130
1131 QString toUpper(const QString &str) const;
1132 QString toLower(const QString &str) const;
1133
1134 QString currencySymbol(CurrencySymbolFormat = CurrencySymbol) const;
1135 QString toCurrencyString(qlonglong, const QString &symbol = QString()) const;
1136 QString toCurrencyString(qulonglong, const QString &symbol = QString()) const;
1137 inline QString toCurrencyString(short, const QString &symbol = QString()) const;
1138 inline QString toCurrencyString(ushort, const QString &symbol = QString()) const;
1139 inline QString toCurrencyString(int, const QString &symbol = QString()) const;
1140 inline QString toCurrencyString(uint, const QString &symbol = QString()) const;
1141#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
1142 QString toCurrencyString(double, const QString &symbol = QString(), int precision = -1) const;
1143 inline QString toCurrencyString(float i, const QString &symbol = QString(), int precision = -1) const
1144 { return toCurrencyString(double(i), symbol, precision); }
1145#else
1146 QString toCurrencyString(double, const QString &symbol = QString()) const;
1147 QString toCurrencyString(double, const QString &symbol, int precision) const;
1148 inline QString toCurrencyString(float i, const QString &symbol = QString()) const
1149 { return toCurrencyString(double(i), symbol); }
1150 inline QString toCurrencyString(float i, const QString &symbol, int precision) const
1151 { return toCurrencyString(double(i), symbol, precision); }
1152#endif
1153
1154#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
1155 QString formattedDataSize(qint64 bytes, int precision = 2, DataSizeFormats format = DataSizeIecFormat);
1156#endif
1157 QString formattedDataSize(qint64 bytes, int precision = 2, DataSizeFormats format = DataSizeIecFormat) const;
1158
1159 QStringList uiLanguages() const;
1160
1161 bool operator==(const QLocale &other) const;
1162 bool operator!=(const QLocale &other) const;
1163
1164 static QString languageToString(Language language);
1165 static QString countryToString(Country country);
1166 static QString scriptToString(Script script);
1167 static void setDefault(const QLocale &locale);
1168
1169 static QLocale c() { return QLocale(C); }
1170 static QLocale system();
1171
1172 static QList<QLocale> matchingLocales(QLocale::Language language, QLocale::Script script, QLocale::Country country);
1173 static QList<Country> countriesForLanguage(Language lang);
1174
1175 void setNumberOptions(NumberOptions options);
1176 NumberOptions numberOptions() const;
1177
1178 enum QuotationStyle { StandardQuotation, AlternateQuotation };
1179 QString quoteString(const QString &str, QuotationStyle style = StandardQuotation) const;
1180 QString quoteString(const QStringRef &str, QuotationStyle style = StandardQuotation) const;
1181
1182 QString createSeparatedList(const QStringList &strl) const;
1183
1184private:
1185 QLocale(QLocalePrivate &dd);
1186 friend class QLocalePrivate;
1187 friend class QSystemLocale;
1188 friend class QCalendarBackend;
1189 friend class QGregorianCalendar;
1190 friend Q_CORE_EXPORT uint qHash(const QLocale &key, uint seed) noexcept;
1191
1192 QSharedDataPointer<QLocalePrivate> d;
1193};
1194Q_DECLARE_SHARED(QLocale)
1195Q_DECLARE_OPERATORS_FOR_FLAGS(QLocale::NumberOptions)
1196
1197inline QString QLocale::toString(long i) const
1198 { return toString(i: qlonglong(i)); }
1199inline QString QLocale::toString(ulong i) const
1200 { return toString(i: qulonglong(i)); }
1201inline QString QLocale::toString(short i) const
1202 { return toString(i: qlonglong(i)); }
1203inline QString QLocale::toString(ushort i) const
1204 { return toString(i: qulonglong(i)); }
1205inline QString QLocale::toString(int i) const
1206 { return toString(i: qlonglong(i)); }
1207inline QString QLocale::toString(uint i) const
1208 { return toString(i: qulonglong(i)); }
1209inline QString QLocale::toString(float i, char f, int prec) const
1210 { return toString(i: double(i), f, prec); }
1211
1212inline QString QLocale::toCurrencyString(short i, const QString &symbol) const
1213 { return toCurrencyString(qlonglong(i), symbol); }
1214inline QString QLocale::toCurrencyString(ushort i, const QString &symbol) const
1215 { return toCurrencyString(qulonglong(i), symbol); }
1216inline QString QLocale::toCurrencyString(int i, const QString &symbol) const
1217{ return toCurrencyString(qlonglong(i), symbol); }
1218inline QString QLocale::toCurrencyString(uint i, const QString &symbol) const
1219{ return toCurrencyString(qulonglong(i), symbol); }
1220
1221#ifndef QT_NO_DATASTREAM
1222Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QLocale &);
1223Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QLocale &);
1224#endif
1225
1226#ifndef QT_NO_DEBUG_STREAM
1227Q_CORE_EXPORT QDebug operator<<(QDebug, const QLocale &);
1228#endif
1229
1230QT_END_NAMESPACE
1231
1232#endif // QLOCALE_H
1233

source code of qtbase/src/corelib/text/qlocale.h