~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/corelib/tools/qlocale.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
 
4
**
 
5
** This file is part of the core module of the Qt Toolkit.
 
6
**
 
7
** This file may be distributed under the terms of the Q Public License
 
8
** as defined by Trolltech AS of Norway and appearing in the file
 
9
** LICENSE.QPL included in the packaging of this file.
 
10
**
 
11
** This file may be distributed and/or modified under the terms of the
 
12
** GNU General Public License version 2 as published by the Free Software
 
13
** Foundation and appearing in the file LICENSE.GPL included in the
 
14
** packaging of this file.
 
15
**
 
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
 
17
**   information about Qt Commercial License Agreements.
 
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
 
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
 
20
**
 
21
** Contact info@trolltech.com if any conditions of this licensing are
 
22
** not clear to you.
 
23
**
 
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
26
**
 
27
****************************************************************************/
 
28
 
 
29
#ifndef QLOCALE_H
 
30
#define QLOCALE_H
 
31
 
 
32
#include "QtCore/qstring.h"
 
33
 
 
34
class QDataStream;
 
35
struct QLocalePrivate;
 
36
 
 
37
class Q_CORE_EXPORT QLocale
 
38
{
 
39
    friend class QString;
 
40
    friend class QByteArray;
 
41
 
 
42
public:
 
43
    enum Language {
 
44
        C = 1,
 
45
        Abkhazian = 2,
 
46
        Afan = 3,
 
47
        Afar = 4,
 
48
        Afrikaans = 5,
 
49
        Albanian = 6,
 
50
        Amharic = 7,
 
51
        Arabic = 8,
 
52
        Armenian = 9,
 
53
        Assamese = 10,
 
54
        Aymara = 11,
 
55
        Azerbaijani = 12,
 
56
        Bashkir = 13,
 
57
        Basque = 14,
 
58
        Bengali = 15,
 
59
        Bhutani = 16,
 
60
        Bihari = 17,
 
61
        Bislama = 18,
 
62
        Breton = 19,
 
63
        Bulgarian = 20,
 
64
        Burmese = 21,
 
65
        Byelorussian = 22,
 
66
        Cambodian = 23,
 
67
        Catalan = 24,
 
68
        Chinese = 25,
 
69
        Corsican = 26,
 
70
        Croatian = 27,
 
71
        Czech = 28,
 
72
        Danish = 29,
 
73
        Dutch = 30,
 
74
        English = 31,
 
75
        Esperanto = 32,
 
76
        Estonian = 33,
 
77
        Faroese = 34,
 
78
        FijiLanguage = 35,
 
79
        Finnish = 36,
 
80
        French = 37,
 
81
        Frisian = 38,
 
82
        Gaelic = 39,
 
83
        Galician = 40,
 
84
        Georgian = 41,
 
85
        German = 42,
 
86
        Greek = 43,
 
87
        Greenlandic = 44,
 
88
        Guarani = 45,
 
89
        Gujarati = 46,
 
90
        Hausa = 47,
 
91
        Hebrew = 48,
 
92
        Hindi = 49,
 
93
        Hungarian = 50,
 
94
        Icelandic = 51,
 
95
        Indonesian = 52,
 
96
        Interlingua = 53,
 
97
        Interlingue = 54,
 
98
        Inuktitut = 55,
 
99
        Inupiak = 56,
 
100
        Irish = 57,
 
101
        Italian = 58,
 
102
        Japanese = 59,
 
103
        Javanese = 60,
 
104
        Kannada = 61,
 
105
        Kashmiri = 62,
 
106
        Kazakh = 63,
 
107
        Kinyarwanda = 64,
 
108
        Kirghiz = 65,
 
109
        Korean = 66,
 
110
        Kurdish = 67,
 
111
        Kurundi = 68,
 
112
        Laothian = 69,
 
113
        Latin = 70,
 
114
        Latvian = 71,
 
115
        Lingala = 72,
 
116
        Lithuanian = 73,
 
117
        Macedonian = 74,
 
118
        Malagasy = 75,
 
119
        Malay = 76,
 
120
        Malayalam = 77,
 
121
        Maltese = 78,
 
122
        Maori = 79,
 
123
        Marathi = 80,
 
124
        Moldavian = 81,
 
125
        Mongolian = 82,
 
126
        NauruLanguage = 83,
 
127
        Nepali = 84,
 
128
        Norwegian = 85,
 
129
        Occitan = 86,
 
130
        Oriya = 87,
 
131
        Pashto = 88,
 
132
        Persian = 89,
 
133
        Polish = 90,
 
134
        Portuguese = 91,
 
135
        Punjabi = 92,
 
136
        Quechua = 93,
 
137
        RhaetoRomance = 94,
 
138
        Romanian = 95,
 
139
        Russian = 96,
 
140
        Samoan = 97,
 
141
        Sangho = 98,
 
142
        Sanskrit = 99,
 
143
        Serbian = 100,
 
144
        SerboCroatian = 101,
 
145
        Sesotho = 102,
 
146
        Setswana = 103,
 
147
        Shona = 104,
 
148
        Sindhi = 105,
 
149
        Singhalese = 106,
 
150
        Siswati = 107,
 
151
        Slovak = 108,
 
152
        Slovenian = 109,
 
153
        Somali = 110,
 
154
        Spanish = 111,
 
155
        Sundanese = 112,
 
156
        Swahili = 113,
 
157
        Swedish = 114,
 
158
        Tagalog = 115,
 
159
        Tajik = 116,
 
160
        Tamil = 117,
 
161
        Tatar = 118,
 
162
        Telugu = 119,
 
163
        Thai = 120,
 
164
        Tibetan = 121,
 
165
        Tigrinya = 122,
 
166
        TongaLanguage = 123,
 
167
        Tsonga = 124,
 
168
        Turkish = 125,
 
169
        Turkmen = 126,
 
170
        Twi = 127,
 
171
        Uigur = 128,
 
172
        Ukrainian = 129,
 
173
        Urdu = 130,
 
174
        Uzbek = 131,
 
175
        Vietnamese = 132,
 
176
        Volapuk = 133,
 
177
        Welsh = 134,
 
178
        Wolof = 135,
 
179
        Xhosa = 136,
 
180
        Yiddish = 137,
 
181
        Yoruba = 138,
 
182
        Zhuang = 139,
 
183
        Zulu = 140,
 
184
        Nynorsk = 141,
 
185
        LastLanguage = Nynorsk
 
186
    };
 
187
 
 
188
    enum Country {
 
189
        AnyCountry = 0,
 
190
        Afghanistan = 1,
 
191
        Albania = 2,
 
192
        Algeria = 3,
 
193
        AmericanSamoa = 4,
 
194
        Andorra = 5,
 
195
        Angola = 6,
 
196
        Anguilla = 7,
 
197
        Antarctica = 8,
 
198
        AntiguaAndBarbuda = 9,
 
199
        Argentina = 10,
 
200
        Armenia = 11,
 
201
        Aruba = 12,
 
202
        Australia = 13,
 
203
        Austria = 14,
 
204
        Azerbaijan = 15,
 
205
        Bahamas = 16,
 
206
        Bahrain = 17,
 
207
        Bangladesh = 18,
 
208
        Barbados = 19,
 
209
        Belarus = 20,
 
210
        Belgium = 21,
 
211
        Belize = 22,
 
212
        Benin = 23,
 
213
        Bermuda = 24,
 
214
        Bhutan = 25,
 
215
        Bolivia = 26,
 
216
        BosniaAndHerzegowina = 27,
 
217
        Botswana = 28,
 
218
        BouvetIsland = 29,
 
219
        Brazil = 30,
 
220
        BritishIndianOceanTerritory = 31,
 
221
        BruneiDarussalam = 32,
 
222
        Bulgaria = 33,
 
223
        BurkinaFaso = 34,
 
224
        Burundi = 35,
 
225
        Cambodia = 36,
 
226
        Cameroon = 37,
 
227
        Canada = 38,
 
228
        CapeVerde = 39,
 
229
        CaymanIslands = 40,
 
230
        CentralAfricanRepublic = 41,
 
231
        Chad = 42,
 
232
        Chile = 43,
 
233
        China = 44,
 
234
        ChristmasIsland = 45,
 
235
        CocosIslands = 46,
 
236
        Colombia = 47,
 
237
        Comoros = 48,
 
238
        DemocraticRepublicOfCongo = 49,
 
239
        PeoplesRepublicOfCongo = 50,
 
240
        CookIslands = 51,
 
241
        CostaRica = 52,
 
242
        IvoryCoast = 53,
 
243
        Croatia = 54,
 
244
        Cuba = 55,
 
245
        Cyprus = 56,
 
246
        CzechRepublic = 57,
 
247
        Denmark = 58,
 
248
        Djibouti = 59,
 
249
        Dominica = 60,
 
250
        DominicanRepublic = 61,
 
251
        EastTimor = 62,
 
252
        Ecuador = 63,
 
253
        Egypt = 64,
 
254
        ElSalvador = 65,
 
255
        EquatorialGuinea = 66,
 
256
        Eritrea = 67,
 
257
        Estonia = 68,
 
258
        Ethiopia = 69,
 
259
        FalklandIslands = 70,
 
260
        FaroeIslands = 71,
 
261
        FijiCountry = 72,
 
262
        Finland = 73,
 
263
        France = 74,
 
264
        MetropolitanFrance = 75,
 
265
        FrenchGuiana = 76,
 
266
        FrenchPolynesia = 77,
 
267
        FrenchSouthernTerritories = 78,
 
268
        Gabon = 79,
 
269
        Gambia = 80,
 
270
        Georgia = 81,
 
271
        Germany = 82,
 
272
        Ghana = 83,
 
273
        Gibraltar = 84,
 
274
        Greece = 85,
 
275
        Greenland = 86,
 
276
        Grenada = 87,
 
277
        Guadeloupe = 88,
 
278
        Guam = 89,
 
279
        Guatemala = 90,
 
280
        Guinea = 91,
 
281
        GuineaBissau = 92,
 
282
        Guyana = 93,
 
283
        Haiti = 94,
 
284
        HeardAndMcDonaldIslands = 95,
 
285
        Honduras = 96,
 
286
        HongKong = 97,
 
287
        Hungary = 98,
 
288
        Iceland = 99,
 
289
        India = 100,
 
290
        Indonesia = 101,
 
291
        Iran = 102,
 
292
        Iraq = 103,
 
293
        Ireland = 104,
 
294
        Israel = 105,
 
295
        Italy = 106,
 
296
        Jamaica = 107,
 
297
        Japan = 108,
 
298
        Jordan = 109,
 
299
        Kazakhstan = 110,
 
300
        Kenya = 111,
 
301
        Kiribati = 112,
 
302
        DemocraticRepublicOfKorea = 113,
 
303
        RepublicOfKorea = 114,
 
304
        Kuwait = 115,
 
305
        Kyrgyzstan = 116,
 
306
        Lao = 117,
 
307
        Latvia = 118,
 
308
        Lebanon = 119,
 
309
        Lesotho = 120,
 
310
        Liberia = 121,
 
311
        LibyanArabJamahiriya = 122,
 
312
        Liechtenstein = 123,
 
313
        Lithuania = 124,
 
314
        Luxembourg = 125,
 
315
        Macau = 126,
 
316
        Macedonia = 127,
 
317
        Madagascar = 128,
 
318
        Malawi = 129,
 
319
        Malaysia = 130,
 
320
        Maldives = 131,
 
321
        Mali = 132,
 
322
        Malta = 133,
 
323
        MarshallIslands = 134,
 
324
        Martinique = 135,
 
325
        Mauritania = 136,
 
326
        Mauritius = 137,
 
327
        Mayotte = 138,
 
328
        Mexico = 139,
 
329
        Micronesia = 140,
 
330
        Moldova = 141,
 
331
        Monaco = 142,
 
332
        Mongolia = 143,
 
333
        Montserrat = 144,
 
334
        Morocco = 145,
 
335
        Mozambique = 146,
 
336
        Myanmar = 147,
 
337
        Namibia = 148,
 
338
        NauruCountry = 149,
 
339
        Nepal = 150,
 
340
        Netherlands = 151,
 
341
        NetherlandsAntilles = 152,
 
342
        NewCaledonia = 153,
 
343
        NewZealand = 154,
 
344
        Nicaragua = 155,
 
345
        Niger = 156,
 
346
        Nigeria = 157,
 
347
        Niue = 158,
 
348
        NorfolkIsland = 159,
 
349
        NorthernMarianaIslands = 160,
 
350
        Norway = 161,
 
351
        Oman = 162,
 
352
        Pakistan = 163,
 
353
        Palau = 164,
 
354
        PalestinianTerritory = 165,
 
355
        Panama = 166,
 
356
        PapuaNewGuinea = 167,
 
357
        Paraguay = 168,
 
358
        Peru = 169,
 
359
        Philippines = 170,
 
360
        Pitcairn = 171,
 
361
        Poland = 172,
 
362
        Portugal = 173,
 
363
        PuertoRico = 174,
 
364
        Qatar = 175,
 
365
        Reunion = 176,
 
366
        Romania = 177,
 
367
        RussianFederation = 178,
 
368
        Rwanda = 179,
 
369
        SaintKittsAndNevis = 180,
 
370
        StLucia = 181,
 
371
        StVincentAndTheGrenadines = 182,
 
372
        Samoa = 183,
 
373
        SanMarino = 184,
 
374
        SaoTomeAndPrincipe = 185,
 
375
        SaudiArabia = 186,
 
376
        Senegal = 187,
 
377
        Seychelles = 188,
 
378
        SierraLeone = 189,
 
379
        Singapore = 190,
 
380
        Slovakia = 191,
 
381
        Slovenia = 192,
 
382
        SolomonIslands = 193,
 
383
        Somalia = 194,
 
384
        SouthAfrica = 195,
 
385
        SouthGeorgiaAndTheSouthSandwichIslands = 196,
 
386
        Spain = 197,
 
387
        SriLanka = 198,
 
388
        StHelena = 199,
 
389
        StPierreAndMiquelon = 200,
 
390
        Sudan = 201,
 
391
        Suriname = 202,
 
392
        SvalbardAndJanMayenIslands = 203,
 
393
        Swaziland = 204,
 
394
        Sweden = 205,
 
395
        Switzerland = 206,
 
396
        SyrianArabRepublic = 207,
 
397
        Taiwan = 208,
 
398
        Tajikistan = 209,
 
399
        Tanzania = 210,
 
400
        Thailand = 211,
 
401
        Togo = 212,
 
402
        Tokelau = 213,
 
403
        TongaCountry = 214,
 
404
        TrinidadAndTobago = 215,
 
405
        Tunisia = 216,
 
406
        Turkey = 217,
 
407
        Turkmenistan = 218,
 
408
        TurksAndCaicosIslands = 219,
 
409
        Tuvalu = 220,
 
410
        Uganda = 221,
 
411
        Ukraine = 222,
 
412
        UnitedArabEmirates = 223,
 
413
        UnitedKingdom = 224,
 
414
        UnitedStates = 225,
 
415
        UnitedStatesMinorOutlyingIslands = 226,
 
416
        Uruguay = 227,
 
417
        Uzbekistan = 228,
 
418
        Vanuatu = 229,
 
419
        VaticanCityState = 230,
 
420
        Venezuela = 231,
 
421
        VietNam = 232,
 
422
        BritishVirginIslands = 233,
 
423
        USVirginIslands = 234,
 
424
        WallisAndFutunaIslands = 235,
 
425
        WesternSahara = 236,
 
426
        Yemen = 237,
 
427
        Yugoslavia = 238,
 
428
        Zambia = 239,
 
429
        Zimbabwe = 240,
 
430
        LastCountry = Zimbabwe
 
431
    };
 
432
 
 
433
    QLocale();
 
434
    QLocale(const QString &name);
 
435
    QLocale(Language language, Country country = AnyCountry);
 
436
    QLocale(const QLocale &other);
 
437
 
 
438
    QLocale &operator=(const QLocale &other);
 
439
 
 
440
    Language language() const;
 
441
    Country country() const;
 
442
    QString name() const;
 
443
 
 
444
    short toShort(const QString &s, bool *ok = 0, int base = 0) const;
 
445
    ushort toUShort(const QString &s, bool *ok = 0, int base = 0) const;
 
446
    int toInt(const QString &s, bool *ok = 0, int base = 0) const;
 
447
    uint toUInt(const QString &s, bool *ok = 0, int base = 0) const;
 
448
    qlonglong toLongLong(const QString &s, bool *ok = 0, int base = 0) const;
 
449
    qlonglong toULongLong(const QString &s, bool *ok = 0, int base = 0) const;
 
450
    float toFloat(const QString &s, bool *ok = 0) const;
 
451
    double toDouble(const QString &s, bool *ok = 0) const;
 
452
 
 
453
    QString toString(short i) const
 
454
    { return toString(qlonglong(i)); }
 
455
    QString toString(ushort i) const
 
456
    { return toString(qulonglong(i)); }
 
457
    QString toString(int i) const
 
458
    { return toString(qlonglong(i)); }
 
459
    QString toString(uint i) const
 
460
    { return toString(qulonglong(i)); }
 
461
    QString toString(qlonglong i) const;
 
462
    QString toString(qulonglong i) const;
 
463
    QString toString(float i, char f = 'g', int prec = 6) const
 
464
    { return toString(double(i), f, prec); }
 
465
    QString toString(double i, char f = 'g', int prec = 6) const;
 
466
 
 
467
    inline bool operator==(const QLocale &other) const { return d == other.d; }
 
468
    inline bool operator!=(const QLocale &other) const { return d != other.d; }
 
469
 
 
470
    static QString languageToString(Language language);
 
471
    static QString countryToString(Country country);
 
472
    static void setDefault(const QLocale &locale);
 
473
 
 
474
    static QLocale c() { return QLocale(C); }
 
475
    static QLocale system();
 
476
 
 
477
private:
 
478
    const QLocalePrivate *d;
 
479
    static const QLocalePrivate *default_d;
 
480
};
 
481
Q_DECLARE_TYPEINFO(QLocale, Q_MOVABLE_TYPE);
 
482
 
 
483
#ifndef QT_NO_DATASTREAM
 
484
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QLocale &);
 
485
Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QLocale &);
 
486
#endif
 
487
 
 
488
#endif // QLOCALE_H