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