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

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