1/****************************************************************************
2**
3** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: http://www.qt-project.org/
5**
6** This file is part of the QtCore module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** GNU Lesser General Public License Usage
10** This file may be used under the terms of the GNU Lesser General Public
11** License version 2.1 as published by the Free Software Foundation and
12** appearing in the file LICENSE.LGPL included in the packaging of this
13** file. Please review the following information to ensure the GNU Lesser
14** General Public License version 2.1 requirements will be met:
15** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16**
17** In addition, as a special exception, Nokia gives you certain additional
18** rights. These rights are described in the Nokia Qt LGPL Exception
19** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
20**
21** GNU General Public License Usage
22** Alternatively, this file may be used under the terms of the GNU General
23** Public License version 3.0 as published by the Free Software Foundation
24** and appearing in the file LICENSE.GPL included in the packaging of this
25** file. Please review the following information to ensure the GNU General
26** Public License version 3.0 requirements will be met:
27** http://www.gnu.org/copyleft/gpl.html.
28**
29** Other Usage
30** Alternatively, this file may be used in accordance with the terms and
31** conditions contained in a signed written agreement between you and Nokia.
32**
33**
34**
35**
36**
37**
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QLOCALE_H
43#define QLOCALE_H
44
45#include <QtCore/qvariant.h>
46#include <QtCore/qstring.h>
47#include <QtCore/qobjectdefs.h>
48
49QT_BEGIN_HEADER
50
51QT_BEGIN_NAMESPACE
52
53QT_MODULE(Core)
54
55class QDataStream;
56class QDate;
57class QDateTime;
58class QTime;
59class QVariant;
60class QTextStream;
61class QTextStreamPrivate;
62
63class QLocale;
64
65#ifndef QT_NO_SYSTEMLOCALE
66class Q_CORE_EXPORT QSystemLocale
67{
68public:
69 QSystemLocale();
70 virtual ~QSystemLocale();
71
72 struct CurrencyToStringArgument
73 {
74 CurrencyToStringArgument() { }
75 CurrencyToStringArgument(const QVariant &v, const QString &s)
76 : value(v), symbol(s) { }
77 QVariant value;
78 QString symbol;
79 };
80
81 enum QueryType {
82 LanguageId, // uint
83 CountryId, // uint
84 DecimalPoint, // QString
85 GroupSeparator, // QString
86 ZeroDigit, // QString
87 NegativeSign, // QString
88 DateFormatLong, // QString
89 DateFormatShort, // QString
90 TimeFormatLong, // QString
91 TimeFormatShort, // QString
92 DayNameLong, // QString, in: int
93 DayNameShort, // QString, in: int
94 MonthNameLong, // QString, in: int
95 MonthNameShort, // QString, in: int
96 DateToStringLong, // QString, in: QDate
97 DateToStringShort, // QString in: QDate
98 TimeToStringLong, // QString in: QTime
99 TimeToStringShort, // QString in: QTime
100 DateTimeFormatLong, // QString
101 DateTimeFormatShort, // QString
102 DateTimeToStringLong, // QString in: QDateTime
103 DateTimeToStringShort, // QString in: QDateTime
104 MeasurementSystem, // uint
105 PositiveSign, // QString
106 AMText, // QString
107 PMText, // QString
108 FirstDayOfWeek, // Qt::DayOfWeek
109 Weekdays, // QList<Qt::DayOfWeek>
110 CurrencySymbol, // QString in: CurrencyToStringArgument
111 CurrencyToString, // QString in: qlonglong, qulonglong or double
112 UILanguages, // QStringList
113 StringToStandardQuotation, // QString in: QStringRef to quote
114 StringToAlternateQuotation, // QString in: QStringRef to quote
115 ScriptId, // uint
116 ListToSeparatedString, // QString
117 LocaleChanged, // system locale changed
118 NativeLanguageName, // QString
119 NativeCountryName // QString
120 };
121 virtual QVariant query(QueryType type, QVariant in) const;
122 virtual QLocale fallbackLocale() const;
123
124private:
125 QSystemLocale(bool);
126 friend QSystemLocale *QSystemLocale_globalSystemLocale();
127};
128#endif
129
130struct QLocalePrivate;
131class Q_CORE_EXPORT QLocale
132{
133 Q_GADGET
134 Q_ENUMS(Language)
135 Q_ENUMS(Country)
136 friend class QString;
137 friend class QByteArray;
138 friend class QIntValidator;
139 friend class QDoubleValidatorPrivate;
140 friend class QTextStream;
141 friend class QTextStreamPrivate;
142
143public:
144// GENERATED PART STARTS HERE
145// see qlocale_data_p.h for more info on generated data
146 enum Language {
147 AnyLanguage = 0,
148 C = 1,
149 Abkhazian = 2,
150 Afan = 3,
151 Afar = 4,
152 Afrikaans = 5,
153 Albanian = 6,
154 Amharic = 7,
155 Arabic = 8,
156 Armenian = 9,
157 Assamese = 10,
158 Aymara = 11,
159 Azerbaijani = 12,
160 Bashkir = 13,
161 Basque = 14,
162 Bengali = 15,
163 Bhutani = 16,
164 Bihari = 17,
165 Bislama = 18,
166 Breton = 19,
167 Bulgarian = 20,
168 Burmese = 21,
169 Byelorussian = 22,
170 Cambodian = 23,
171 Catalan = 24,
172 Chinese = 25,
173 Corsican = 26,
174 Croatian = 27,
175 Czech = 28,
176 Danish = 29,
177 Dutch = 30,
178 English = 31,
179 Esperanto = 32,
180 Estonian = 33,
181 Faroese = 34,
182 FijiLanguage = 35,
183 Finnish = 36,
184 French = 37,
185 Frisian = 38,
186 Gaelic = 39,
187 Galician = 40,
188 Georgian = 41,
189 German = 42,
190 Greek = 43,
191 Greenlandic = 44,
192 Guarani = 45,
193 Gujarati = 46,
194 Hausa = 47,
195 Hebrew = 48,
196 Hindi = 49,
197 Hungarian = 50,
198 Icelandic = 51,
199 Indonesian = 52,
200 Interlingua = 53,
201 Interlingue = 54,
202 Inuktitut = 55,
203 Inupiak = 56,
204 Irish = 57,
205 Italian = 58,
206 Japanese = 59,
207 Javanese = 60,
208 Kannada = 61,
209 Kashmiri = 62,
210 Kazakh = 63,
211 Kinyarwanda = 64,
212 Kirghiz = 65,
213 Korean = 66,
214 Kurdish = 67,
215 Kurundi = 68,
216 Laothian = 69,
217 Latin = 70,
218 Latvian = 71,
219 Lingala = 72,
220 Lithuanian = 73,
221 Macedonian = 74,
222 Malagasy = 75,
223 Malay = 76,
224 Malayalam = 77,
225 Maltese = 78,
226 Maori = 79,
227 Marathi = 80,
228 Moldavian = 81,
229 Mongolian = 82,
230 NauruLanguage = 83,
231 Nepali = 84,
232 Norwegian = 85,
233 Occitan = 86,
234 Oriya = 87,
235 Pashto = 88,
236 Persian = 89,
237 Polish = 90,
238 Portuguese = 91,
239 Punjabi = 92,
240 Quechua = 93,
241 RhaetoRomance = 94,
242 Romanian = 95,
243 Russian = 96,
244 Samoan = 97,
245 Sangho = 98,
246 Sanskrit = 99,
247 Serbian = 100,
248 SerboCroatian = 101,
249 Sesotho = 102,
250 Setswana = 103,
251 Shona = 104,
252 Sindhi = 105,
253 Singhalese = 106,
254 Siswati = 107,
255 Slovak = 108,
256 Slovenian = 109,
257 Somali = 110,
258 Spanish = 111,
259 Sundanese = 112,
260 Swahili = 113,
261 Swedish = 114,
262 Tagalog = 115,
263 Tajik = 116,
264 Tamil = 117,
265 Tatar = 118,
266 Telugu = 119,
267 Thai = 120,
268 Tibetan = 121,
269 Tigrinya = 122,
270 TongaLanguage = 123,
271 Tsonga = 124,
272 Turkish = 125,
273 Turkmen = 126,
274 Twi = 127,
275 Uigur = 128,
276 Ukrainian = 129,
277 Urdu = 130,
278 Uzbek = 131,
279 Vietnamese = 132,
280 Volapuk = 133,
281 Welsh = 134,
282 Wolof = 135,
283 Xhosa = 136,
284 Yiddish = 137,
285 Yoruba = 138,
286 Zhuang = 139,
287 Zulu = 140,
288 Nynorsk = 141,
289 Bosnian = 142,
290 Divehi = 143,
291 Manx = 144,
292 Cornish = 145,
293 Akan = 146,
294 Konkani = 147,
295 Ga = 148,
296 Igbo = 149,
297 Kamba = 150,
298 Syriac = 151,
299 Blin = 152,
300 Geez = 153,
301 Koro = 154,
302 Sidamo = 155,
303 Atsam = 156,
304 Tigre = 157,
305 Jju = 158,
306 Friulian = 159,
307 Venda = 160,
308 Ewe = 161,
309 Walamo = 162,
310 Hawaiian = 163,
311 Tyap = 164,
312 Chewa = 165,
313 Filipino = 166,
314 SwissGerman = 167,
315 SichuanYi = 168,
316 Kpelle = 169,
317 LowGerman = 170,
318 SouthNdebele = 171,
319 NorthernSotho = 172,
320 NorthernSami = 173,
321 Taroko = 174,
322 Gusii = 175,
323 Taita = 176,
324 Fulah = 177,
325 Kikuyu = 178,
326 Samburu = 179,
327 Sena = 180,
328 NorthNdebele = 181,
329 Rombo = 182,
330 Tachelhit = 183,
331 Kabyle = 184,
332 Nyankole = 185,
333 Bena = 186,
334 Vunjo = 187,
335 Bambara = 188,
336 Embu = 189,
337 Cherokee = 190,
338 Morisyen = 191,
339 Makonde = 192,
340 Langi = 193,
341 Ganda = 194,
342 Bemba = 195,
343 Kabuverdianu = 196,
344 Meru = 197,
345 Kalenjin = 198,
346 Nama = 199,
347 Machame = 200,
348 Colognian = 201,
349 Masai = 202,
350 Soga = 203,
351 Luyia = 204,
352 Asu = 205,
353 Teso = 206,
354 Saho = 207,
355 KoyraChiini = 208,
356 Rwa = 209,
357 Luo = 210,
358 Chiga = 211,
359 CentralMoroccoTamazight = 212,
360 KoyraboroSenni = 213,
361 Shambala = 214,
362 NorwegianBokmal = Norwegian,
363 NorwegianNynorsk = Nynorsk,
364 LastLanguage = Shambala
365 };
366
367 enum Script {
368 AnyScript = 0,
369 ArabicScript = 1,
370 CyrillicScript = 2,
371 DeseretScript = 3,
372 GurmukhiScript = 4,
373 SimplifiedHanScript = 5,
374 TraditionalHanScript = 6,
375 LatinScript = 7,
376 MongolianScript = 8,
377 TifinaghScript = 9,
378 SimplifiedChineseScript = SimplifiedHanScript,
379 TraditionalChineseScript = TraditionalHanScript,
380 LastScript = TifinaghScript
381 };
382 enum Country {
383 AnyCountry = 0,
384 Afghanistan = 1,
385 Albania = 2,
386 Algeria = 3,
387 AmericanSamoa = 4,
388 Andorra = 5,
389 Angola = 6,
390 Anguilla = 7,
391 Antarctica = 8,
392 AntiguaAndBarbuda = 9,
393 Argentina = 10,
394 Armenia = 11,
395 Aruba = 12,
396 Australia = 13,
397 Austria = 14,
398 Azerbaijan = 15,
399 Bahamas = 16,
400 Bahrain = 17,
401 Bangladesh = 18,
402 Barbados = 19,
403 Belarus = 20,
404 Belgium = 21,
405 Belize = 22,
406 Benin = 23,
407 Bermuda = 24,
408 Bhutan = 25,
409 Bolivia = 26,
410 BosniaAndHerzegowina = 27,
411 Botswana = 28,
412 BouvetIsland = 29,
413 Brazil = 30,
414 BritishIndianOceanTerritory = 31,
415 BruneiDarussalam = 32,
416 Bulgaria = 33,
417 BurkinaFaso = 34,
418 Burundi = 35,
419 Cambodia = 36,
420 Cameroon = 37,
421 Canada = 38,
422 CapeVerde = 39,
423 CaymanIslands = 40,
424 CentralAfricanRepublic = 41,
425 Chad = 42,
426 Chile = 43,
427 China = 44,
428 ChristmasIsland = 45,
429 CocosIslands = 46,
430 Colombia = 47,
431 Comoros = 48,
432 DemocraticRepublicOfCongo = 49,
433 PeoplesRepublicOfCongo = 50,
434 CookIslands = 51,
435 CostaRica = 52,
436 IvoryCoast = 53,
437 Croatia = 54,
438 Cuba = 55,
439 Cyprus = 56,
440 CzechRepublic = 57,
441 Denmark = 58,
442 Djibouti = 59,
443 Dominica = 60,
444 DominicanRepublic = 61,
445 EastTimor = 62,
446 Ecuador = 63,
447 Egypt = 64,
448 ElSalvador = 65,
449 EquatorialGuinea = 66,
450 Eritrea = 67,
451 Estonia = 68,
452 Ethiopia = 69,
453 FalklandIslands = 70,
454 FaroeIslands = 71,
455 FijiCountry = 72,
456 Finland = 73,
457 France = 74,
458 MetropolitanFrance = 75,
459 FrenchGuiana = 76,
460 FrenchPolynesia = 77,
461 FrenchSouthernTerritories = 78,
462 Gabon = 79,
463 Gambia = 80,
464 Georgia = 81,
465 Germany = 82,
466 Ghana = 83,
467 Gibraltar = 84,
468 Greece = 85,
469 Greenland = 86,
470 Grenada = 87,
471 Guadeloupe = 88,
472 Guam = 89,
473 Guatemala = 90,
474 Guinea = 91,
475 GuineaBissau = 92,
476 Guyana = 93,
477 Haiti = 94,
478 HeardAndMcDonaldIslands = 95,
479 Honduras = 96,
480 HongKong = 97,
481 Hungary = 98,
482 Iceland = 99,
483 India = 100,
484 Indonesia = 101,
485 Iran = 102,
486 Iraq = 103,
487 Ireland = 104,
488 Israel = 105,
489 Italy = 106,
490 Jamaica = 107,
491 Japan = 108,
492 Jordan = 109,
493 Kazakhstan = 110,
494 Kenya = 111,
495 Kiribati = 112,
496 DemocraticRepublicOfKorea = 113,
497 RepublicOfKorea = 114,
498 Kuwait = 115,
499 Kyrgyzstan = 116,
500 Lao = 117,
501 Latvia = 118,
502 Lebanon = 119,
503 Lesotho = 120,
504 Liberia = 121,
505 LibyanArabJamahiriya = 122,
506 Liechtenstein = 123,
507 Lithuania = 124,
508 Luxembourg = 125,
509 Macau = 126,
510 Macedonia = 127,
511 Madagascar = 128,
512 Malawi = 129,
513 Malaysia = 130,
514 Maldives = 131,
515 Mali = 132,
516 Malta = 133,
517 MarshallIslands = 134,
518 Martinique = 135,
519 Mauritania = 136,
520 Mauritius = 137,
521 Mayotte = 138,
522 Mexico = 139,
523 Micronesia = 140,
524 Moldova = 141,
525 Monaco = 142,
526 Mongolia = 143,
527 Montserrat = 144,
528 Morocco = 145,
529 Mozambique = 146,
530 Myanmar = 147,
531 Namibia = 148,
532 NauruCountry = 149,
533 Nepal = 150,
534 Netherlands = 151,
535 NetherlandsAntilles = 152,
536 NewCaledonia = 153,
537 NewZealand = 154,
538 Nicaragua = 155,
539 Niger = 156,
540 Nigeria = 157,
541 Niue = 158,
542 NorfolkIsland = 159,
543 NorthernMarianaIslands = 160,
544 Norway = 161,
545 Oman = 162,
546 Pakistan = 163,
547 Palau = 164,
548 PalestinianTerritory = 165,
549 Panama = 166,
550 PapuaNewGuinea = 167,
551 Paraguay = 168,
552 Peru = 169,
553 Philippines = 170,
554 Pitcairn = 171,
555 Poland = 172,
556 Portugal = 173,
557 PuertoRico = 174,
558 Qatar = 175,
559 Reunion = 176,
560 Romania = 177,
561 RussianFederation = 178,
562 Rwanda = 179,
563 SaintKittsAndNevis = 180,
564 StLucia = 181,
565 StVincentAndTheGrenadines = 182,
566 Samoa = 183,
567 SanMarino = 184,
568 SaoTomeAndPrincipe = 185,
569 SaudiArabia = 186,
570 Senegal = 187,
571 Seychelles = 188,
572 SierraLeone = 189,
573 Singapore = 190,
574 Slovakia = 191,
575 Slovenia = 192,
576 SolomonIslands = 193,
577 Somalia = 194,
578 SouthAfrica = 195,
579 SouthGeorgiaAndTheSouthSandwichIslands = 196,
580 Spain = 197,
581 SriLanka = 198,
582 StHelena = 199,
583 StPierreAndMiquelon = 200,
584 Sudan = 201,
585 Suriname = 202,
586 SvalbardAndJanMayenIslands = 203,
587 Swaziland = 204,
588 Sweden = 205,
589 Switzerland = 206,
590 SyrianArabRepublic = 207,
591 Taiwan = 208,
592 Tajikistan = 209,
593 Tanzania = 210,
594 Thailand = 211,
595 Togo = 212,
596 Tokelau = 213,
597 TongaCountry = 214,
598 TrinidadAndTobago = 215,
599 Tunisia = 216,
600 Turkey = 217,
601 Turkmenistan = 218,
602 TurksAndCaicosIslands = 219,
603 Tuvalu = 220,
604 Uganda = 221,
605 Ukraine = 222,
606 UnitedArabEmirates = 223,
607 UnitedKingdom = 224,
608 UnitedStates = 225,
609 UnitedStatesMinorOutlyingIslands = 226,
610 Uruguay = 227,
611 Uzbekistan = 228,
612 Vanuatu = 229,
613 VaticanCityState = 230,
614 Venezuela = 231,
615 VietNam = 232,
616 BritishVirginIslands = 233,
617 USVirginIslands = 234,
618 WallisAndFutunaIslands = 235,
619 WesternSahara = 236,
620 Yemen = 237,
621 Yugoslavia = 238,
622 Zambia = 239,
623 Zimbabwe = 240,
624 SerbiaAndMontenegro = 241,
625 Montenegro = 242,
626 Serbia = 243,
627 SaintBarthelemy = 244,
628 SaintMartin = 245,
629 LatinAmericaAndTheCaribbean = 246,
630 LastCountry = LatinAmericaAndTheCaribbean
631 };
632// GENERATED PART ENDS HERE
633
634 enum MeasurementSystem { MetricSystem, ImperialSystem };
635
636 enum FormatType { LongFormat, ShortFormat, NarrowFormat };
637 enum NumberOption {
638 OmitGroupSeparator = 0x01,
639 RejectGroupSeparator = 0x02
640 };
641 Q_DECLARE_FLAGS(NumberOptions, NumberOption)
642
643 enum CurrencySymbolFormat {
644 CurrencyIsoCode,
645 CurrencySymbol,
646 CurrencyDisplayName
647 };
648
649 QLocale();
650 QLocale(const QString &name);
651 QLocale(Language language, Country country = AnyCountry);
652 QLocale(Language language, Script script, Country country);
653 QLocale(const QLocale &other);
654
655 QLocale &operator=(const QLocale &other);
656
657 Language language() const;
658 Script script() const;
659 Country country() const;
660 QString name() const;
661
662 QString bcp47Name() const;
663 QString nativeLanguageName() const;
664 QString nativeCountryName() const;
665
666 short toShort(const QString &s, bool *ok = 0, int base = 0) const;
667 ushort toUShort(const QString &s, bool *ok = 0, int base = 0) const;
668 int toInt(const QString &s, bool *ok = 0, int base = 0) const;
669 uint toUInt(const QString &s, bool *ok = 0, int base = 0) const;
670 qlonglong toLongLong(const QString &s, bool *ok = 0, int base = 0) const;
671 qlonglong toULongLong(const QString &s, bool *ok = 0, int base = 0) const;
672 float toFloat(const QString &s, bool *ok = 0) const;
673 double toDouble(const QString &s, bool *ok = 0) const;
674
675 QString toString(qlonglong i) const;
676 QString toString(qulonglong i) const;
677 inline QString toString(short i) const;
678 inline QString toString(ushort i) const;
679 inline QString toString(int i) const;
680 inline QString toString(uint i) const;
681 QString toString(double i, char f = 'g', int prec = 6) const;
682 inline QString toString(float i, char f = 'g', int prec = 6) const;
683 QString toString(const QDate &date, const QString &formatStr) const;
684 QString toString(const QDate &date, FormatType format = LongFormat) const;
685 QString toString(const QTime &time, const QString &formatStr) const;
686 QString toString(const QTime &time, FormatType format = LongFormat) const;
687 QString toString(const QDateTime &dateTime, FormatType format = LongFormat) const;
688 QString toString(const QDateTime &dateTime, const QString &format) const;
689
690 QString dateFormat(FormatType format = LongFormat) const;
691 QString timeFormat(FormatType format = LongFormat) const;
692 QString dateTimeFormat(FormatType format = LongFormat) const;
693#ifndef QT_NO_DATESTRING
694 QDate toDate(const QString &string, FormatType = LongFormat) const;
695 QTime toTime(const QString &string, FormatType = LongFormat) const;
696 QDateTime toDateTime(const QString &string, FormatType format = LongFormat) const;
697 QDate toDate(const QString &string, const QString &format) const;
698 QTime toTime(const QString &string, const QString &format) const;
699 QDateTime toDateTime(const QString &string, const QString &format) const;
700#endif
701
702 // ### Qt 5: We need to return QString from these function since
703 // unicode data contains several characters for these fields.
704 QChar decimalPoint() const;
705 QChar groupSeparator() const;
706 QChar percent() const;
707 QChar zeroDigit() const;
708 QChar negativeSign() const;
709 QChar positiveSign() const;
710 QChar exponential() const;
711
712 QString monthName(int, FormatType format = LongFormat) const;
713 QString standaloneMonthName(int, FormatType format = LongFormat) const;
714 QString dayName(int, FormatType format = LongFormat) const;
715 QString standaloneDayName(int, FormatType format = LongFormat) const;
716
717 Qt::DayOfWeek firstDayOfWeek() const;
718 QList<Qt::DayOfWeek> weekdays() const;
719
720 QString amText() const;
721 QString pmText() const;
722
723 MeasurementSystem measurementSystem() const;
724
725 Qt::LayoutDirection textDirection() const;
726
727 QString toUpper(const QString &str) const;
728 QString toLower(const QString &str) const;
729
730 QString currencySymbol(CurrencySymbolFormat = CurrencySymbol) const;
731 QString toCurrencyString(qlonglong, const QString &symbol = QString()) const;
732 QString toCurrencyString(qulonglong, const QString &symbol = QString()) const;
733 inline QString toCurrencyString(short, const QString &symbol = QString()) const;
734 inline QString toCurrencyString(ushort, const QString &symbol = QString()) const;
735 inline QString toCurrencyString(int, const QString &symbol = QString()) const;
736 inline QString toCurrencyString(uint, const QString &symbol = QString()) const;
737 QString toCurrencyString(double, const QString &symbol = QString()) const;
738 inline QString toCurrencyString(float, const QString &symbol = QString()) const;
739
740 QStringList uiLanguages() const;
741
742 inline bool operator==(const QLocale &other) const;
743 inline bool operator!=(const QLocale &other) const;
744
745 static QString languageToString(Language language);
746 static QString countryToString(Country country);
747 static QString scriptToString(Script script);
748 static void setDefault(const QLocale &locale);
749
750 static QLocale c() { return QLocale(C); }
751 static QLocale system();
752
753 static QList<QLocale> matchingLocales(QLocale::Language language, QLocale::Script script, QLocale::Country country);
754 static QList<Country> countriesForLanguage(Language lang);
755
756 void setNumberOptions(NumberOptions options);
757 NumberOptions numberOptions() const;
758
759 enum QuotationStyle { StandardQuotation, AlternateQuotation };
760 QString quoteString(const QString &str, QuotationStyle style = StandardQuotation) const;
761 QString quoteString(const QStringRef &str, QuotationStyle style = StandardQuotation) const;
762
763 QString createSeparatedList(const QStringList &strl) const;
764//private: // this should be private, but can't be
765 struct Data {
766 quint16 index;
767 quint16 numberOptions;
768 };
769private:
770 friend struct QLocalePrivate;
771 // ### We now use this field to pack an index into locale_data and NumberOptions.
772 // ### Qt 5: change to a QLocaleData *d; uint numberOptions.
773 union {
774 void *v;
775 Data p;
776 };
777 const QLocalePrivate *d() const;
778};
779Q_DECLARE_TYPEINFO(QLocale, Q_MOVABLE_TYPE);
780Q_DECLARE_OPERATORS_FOR_FLAGS(QLocale::NumberOptions)
781
782inline QString QLocale::toString(short i) const
783 { return toString(qlonglong(i)); }
784inline QString QLocale::toString(ushort i) const
785 { return toString(qulonglong(i)); }
786inline QString QLocale::toString(int i) const
787 { return toString(qlonglong(i)); }
788inline QString QLocale::toString(uint i) const
789 { return toString(qulonglong(i)); }
790inline QString QLocale::toString(float i, char f, int prec) const
791 { return toString(double(i), f, prec); }
792inline bool QLocale::operator==(const QLocale &other) const
793 { return d() == other.d() && numberOptions() == other.numberOptions(); }
794inline bool QLocale::operator!=(const QLocale &other) const
795 { return d() != other.d() || numberOptions() != other.numberOptions(); }
796
797inline QString QLocale::toCurrencyString(short i, const QString &symbol) const
798 { return toCurrencyString(qlonglong(i), symbol); }
799inline QString QLocale::toCurrencyString(ushort i, const QString &symbol) const
800 { return toCurrencyString(qulonglong(i), symbol); }
801inline QString QLocale::toCurrencyString(int i, const QString &symbol) const
802{ return toCurrencyString(qlonglong(i), symbol); }
803inline QString QLocale::toCurrencyString(uint i, const QString &symbol) const
804{ return toCurrencyString(qulonglong(i), symbol); }
805inline QString QLocale::toCurrencyString(float i, const QString &symbol) const
806{ return toCurrencyString(double(i), symbol); }
807
808#ifndef QT_NO_DATASTREAM
809Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QLocale &);
810Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QLocale &);
811#endif
812
813QT_END_NAMESPACE
814
815#ifndef QT_NO_SYSTEMLOCALE
816Q_DECLARE_METATYPE(QSystemLocale::CurrencyToStringArgument)
817#endif
818
819QT_END_HEADER
820
821#endif // QLOCALE_H
822