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