00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef QLOCALE_H
00037 #define QLOCALE_H
00038
00039 #include "qstring.h"
00040
00041 struct QLocalePrivate;
00042
00043 class Q_EXPORT QLocale
00044 {
00045 friend class QString;
00046
00047 public:
00048 enum Language {
00049 C = 1,
00050 Abkhazian = 2,
00051 Afan = 3,
00052 Afar = 4,
00053 Afrikaans = 5,
00054 Albanian = 6,
00055 Amharic = 7,
00056 Arabic = 8,
00057 Armenian = 9,
00058 Assamese = 10,
00059 Aymara = 11,
00060 Azerbaijani = 12,
00061 Bashkir = 13,
00062 Basque = 14,
00063 Bengali = 15,
00064 Bhutani = 16,
00065 Bihari = 17,
00066 Bislama = 18,
00067 Breton = 19,
00068 Bulgarian = 20,
00069 Burmese = 21,
00070 Byelorussian = 22,
00071 Cambodian = 23,
00072 Catalan = 24,
00073 Chinese = 25,
00074 Corsican = 26,
00075 Croatian = 27,
00076 Czech = 28,
00077 Danish = 29,
00078 Dutch = 30,
00079 English = 31,
00080 Esperanto = 32,
00081 Estonian = 33,
00082 Faroese = 34,
00083 FijiLanguage = 35,
00084 Finnish = 36,
00085 French = 37,
00086 Frisian = 38,
00087 Gaelic = 39,
00088 Galician = 40,
00089 Georgian = 41,
00090 German = 42,
00091 Greek = 43,
00092 Greenlandic = 44,
00093 Guarani = 45,
00094 Gujarati = 46,
00095 Hausa = 47,
00096 Hebrew = 48,
00097 Hindi = 49,
00098 Hungarian = 50,
00099 Icelandic = 51,
00100 Indonesian = 52,
00101 Interlingua = 53,
00102 Interlingue = 54,
00103 Inuktitut = 55,
00104 Inupiak = 56,
00105 Irish = 57,
00106 Italian = 58,
00107 Japanese = 59,
00108 Javanese = 60,
00109 Kannada = 61,
00110 Kashmiri = 62,
00111 Kazakh = 63,
00112 Kinyarwanda = 64,
00113 Kirghiz = 65,
00114 Korean = 66,
00115 Kurdish = 67,
00116 Kurundi = 68,
00117 Laothian = 69,
00118 Latin = 70,
00119 Latvian = 71,
00120 Lingala = 72,
00121 Lithuanian = 73,
00122 Macedonian = 74,
00123 Malagasy = 75,
00124 Malay = 76,
00125 Malayalam = 77,
00126 Maltese = 78,
00127 Maori = 79,
00128 Marathi = 80,
00129 Moldavian = 81,
00130 Mongolian = 82,
00131 NauruLanguage = 83,
00132 Nepali = 84,
00133 Norwegian = 85,
00134 Occitan = 86,
00135 Oriya = 87,
00136 Pashto = 88,
00137 Persian = 89,
00138 Polish = 90,
00139 Portuguese = 91,
00140 Punjabi = 92,
00141 Quechua = 93,
00142 RhaetoRomance = 94,
00143 Romanian = 95,
00144 Russian = 96,
00145 Samoan = 97,
00146 Sangho = 98,
00147 Sanskrit = 99,
00148 Serbian = 100,
00149 SerboCroatian = 101,
00150 Sesotho = 102,
00151 Setswana = 103,
00152 Shona = 104,
00153 Sindhi = 105,
00154 Singhalese = 106,
00155 Siswati = 107,
00156 Slovak = 108,
00157 Slovenian = 109,
00158 Somali = 110,
00159 Spanish = 111,
00160 Sundanese = 112,
00161 Swahili = 113,
00162 Swedish = 114,
00163 Tagalog = 115,
00164 Tajik = 116,
00165 Tamil = 117,
00166 Tatar = 118,
00167 Telugu = 119,
00168 Thai = 120,
00169 Tibetan = 121,
00170 Tigrinya = 122,
00171 TongaLanguage = 123,
00172 Tsonga = 124,
00173 Turkish = 125,
00174 Turkmen = 126,
00175 Twi = 127,
00176 Uigur = 128,
00177 Ukrainian = 129,
00178 Urdu = 130,
00179 Uzbek = 131,
00180 Vietnamese = 132,
00181 Volapuk = 133,
00182 Welsh = 134,
00183 Wolof = 135,
00184 Xhosa = 136,
00185 Yiddish = 137,
00186 Yoruba = 138,
00187 Zhuang = 139,
00188 Zulu = 140,
00189 LastLanguage = Zulu
00190 };
00191
00192 enum Country {
00193 AnyCountry = 0,
00194 Afghanistan = 1,
00195 Albania = 2,
00196 Algeria = 3,
00197 AmericanSamoa = 4,
00198 Andorra = 5,
00199 Angola = 6,
00200 Anguilla = 7,
00201 Antarctica = 8,
00202 AntiguaAndBarbuda = 9,
00203 Argentina = 10,
00204 Armenia = 11,
00205 Aruba = 12,
00206 Australia = 13,
00207 Austria = 14,
00208 Azerbaijan = 15,
00209 Bahamas = 16,
00210 Bahrain = 17,
00211 Bangladesh = 18,
00212 Barbados = 19,
00213 Belarus = 20,
00214 Belgium = 21,
00215 Belize = 22,
00216 Benin = 23,
00217 Bermuda = 24,
00218 Bhutan = 25,
00219 Bolivia = 26,
00220 BosniaAndHerzegowina = 27,
00221 Botswana = 28,
00222 BouvetIsland = 29,
00223 Brazil = 30,
00224 BritishIndianOceanTerritory = 31,
00225 BruneiDarussalam = 32,
00226 Bulgaria = 33,
00227 BurkinaFaso = 34,
00228 Burundi = 35,
00229 Cambodia = 36,
00230 Cameroon = 37,
00231 Canada = 38,
00232 CapeVerde = 39,
00233 CaymanIslands = 40,
00234 CentralAfricanRepublic = 41,
00235 Chad = 42,
00236 Chile = 43,
00237 China = 44,
00238 ChristmasIsland = 45,
00239 CocosIslands = 46,
00240 Colombia = 47,
00241 Comoros = 48,
00242 DemocraticRepublicOfCongo = 49,
00243 PeoplesRepublicOfCongo = 50,
00244 CookIslands = 51,
00245 CostaRica = 52,
00246 IvoryCoast = 53,
00247 Croatia = 54,
00248 Cuba = 55,
00249 Cyprus = 56,
00250 CzechRepublic = 57,
00251 Denmark = 58,
00252 Djibouti = 59,
00253 Dominica = 60,
00254 DominicanRepublic = 61,
00255 EastTimor = 62,
00256 Ecuador = 63,
00257 Egypt = 64,
00258 ElSalvador = 65,
00259 EquatorialGuinea = 66,
00260 Eritrea = 67,
00261 Estonia = 68,
00262 Ethiopia = 69,
00263 FalklandIslands = 70,
00264 FaroeIslands = 71,
00265 FijiCountry = 72,
00266 Finland = 73,
00267 France = 74,
00268 MetropolitanFrance = 75,
00269 FrenchGuiana = 76,
00270 FrenchPolynesia = 77,
00271 FrenchSouthernTerritories = 78,
00272 Gabon = 79,
00273 Gambia = 80,
00274 Georgia = 81,
00275 Germany = 82,
00276 Ghana = 83,
00277 Gibraltar = 84,
00278 Greece = 85,
00279 Greenland = 86,
00280 Grenada = 87,
00281 Guadeloupe = 88,
00282 Guam = 89,
00283 Guatemala = 90,
00284 Guinea = 91,
00285 GuineaBissau = 92,
00286 Guyana = 93,
00287 Haiti = 94,
00288 HeardAndMcDonaldIslands = 95,
00289 Honduras = 96,
00290 HongKong = 97,
00291 Hungary = 98,
00292 Iceland = 99,
00293 India = 100,
00294 Indonesia = 101,
00295 Iran = 102,
00296 Iraq = 103,
00297 Ireland = 104,
00298 Israel = 105,
00299 Italy = 106,
00300 Jamaica = 107,
00301 Japan = 108,
00302 Jordan = 109,
00303 Kazakhstan = 110,
00304 Kenya = 111,
00305 Kiribati = 112,
00306 DemocraticRepublicOfKorea = 113,
00307 RepublicOfKorea = 114,
00308 Kuwait = 115,
00309 Kyrgyzstan = 116,
00310 Lao = 117,
00311 Latvia = 118,
00312 Lebanon = 119,
00313 Lesotho = 120,
00314 Liberia = 121,
00315 LibyanArabJamahiriya = 122,
00316 Liechtenstein = 123,
00317 Lithuania = 124,
00318 Luxembourg = 125,
00319 Macau = 126,
00320 Macedonia = 127,
00321 Madagascar = 128,
00322 Malawi = 129,
00323 Malaysia = 130,
00324 Maldives = 131,
00325 Mali = 132,
00326 Malta = 133,
00327 MarshallIslands = 134,
00328 Martinique = 135,
00329 Mauritania = 136,
00330 Mauritius = 137,
00331 Mayotte = 138,
00332 Mexico = 139,
00333 Micronesia = 140,
00334 Moldova = 141,
00335 Monaco = 142,
00336 Mongolia = 143,
00337 Montserrat = 144,
00338 Morocco = 145,
00339 Mozambique = 146,
00340 Myanmar = 147,
00341 Namibia = 148,
00342 NauruCountry = 149,
00343 Nepal = 150,
00344 Netherlands = 151,
00345 NetherlandsAntilles = 152,
00346 NewCaledonia = 153,
00347 NewZealand = 154,
00348 Nicaragua = 155,
00349 Niger = 156,
00350 Nigeria = 157,
00351 Niue = 158,
00352 NorfolkIsland = 159,
00353 NorthernMarianaIslands = 160,
00354 Norway = 161,
00355 Oman = 162,
00356 Pakistan = 163,
00357 Palau = 164,
00358 PalestinianTerritory = 165,
00359 Panama = 166,
00360 PapuaNewGuinea = 167,
00361 Paraguay = 168,
00362 Peru = 169,
00363 Philippines = 170,
00364 Pitcairn = 171,
00365 Poland = 172,
00366 Portugal = 173,
00367 PuertoRico = 174,
00368 Qatar = 175,
00369 Reunion = 176,
00370 Romania = 177,
00371 RussianFederation = 178,
00372 Rwanda = 179,
00373 SaintKittsAndNevis = 180,
00374 StLucia = 181,
00375 StVincentAndTheGrenadines = 182,
00376 Samoa = 183,
00377 SanMarino = 184,
00378 SaoTomeAndPrincipe = 185,
00379 SaudiArabia = 186,
00380 Senegal = 187,
00381 Seychelles = 188,
00382 SierraLeone = 189,
00383 Singapore = 190,
00384 Slovakia = 191,
00385 Slovenia = 192,
00386 SolomonIslands = 193,
00387 Somalia = 194,
00388 SouthAfrica = 195,
00389 SouthGeorgiaAndTheSouthSandwichIslands = 196,
00390 Spain = 197,
00391 SriLanka = 198,
00392 StHelena = 199,
00393 StPierreAndMiquelon = 200,
00394 Sudan = 201,
00395 Suriname = 202,
00396 SvalbardAndJanMayenIslands = 203,
00397 Swaziland = 204,
00398 Sweden = 205,
00399 Switzerland = 206,
00400 SyrianArabRepublic = 207,
00401 Taiwan = 208,
00402 Tajikistan = 209,
00403 Tanzania = 210,
00404 Thailand = 211,
00405 Togo = 212,
00406 Tokelau = 213,
00407 TongaCountry = 214,
00408 TrinidadAndTobago = 215,
00409 Tunisia = 216,
00410 Turkey = 217,
00411 Turkmenistan = 218,
00412 TurksAndCaicosIslands = 219,
00413 Tuvalu = 220,
00414 Uganda = 221,
00415 Ukraine = 222,
00416 UnitedArabEmirates = 223,
00417 UnitedKingdom = 224,
00418 UnitedStates = 225,
00419 UnitedStatesMinorOutlyingIslands = 226,
00420 Uruguay = 227,
00421 Uzbekistan = 228,
00422 Vanuatu = 229,
00423 VaticanCityState = 230,
00424 Venezuela = 231,
00425 VietNam = 232,
00426 BritishVirginIslands = 233,
00427 USVirginIslands = 234,
00428 WallisAndFutunaIslands = 235,
00429 WesternSahara = 236,
00430 Yemen = 237,
00431 Yugoslavia = 238,
00432 Zambia = 239,
00433 Zimbabwe = 240,
00434 LastCountry = Zimbabwe
00435 };
00436
00437 QLocale();
00438 QLocale(const QString &name);
00439 QLocale(Language language, Country country = AnyCountry);
00440 QLocale(const QLocale &other);
00441
00442 QLocale &operator=(const QLocale &other);
00443
00444 Language language() const;
00445 Country country() const;
00446 QString name() const;
00447
00448 short toShort(const QString &s, bool *ok = 0) const;
00449 ushort toUShort(const QString &s, bool *ok = 0) const;
00450 int toInt(const QString &s, bool *ok = 0) const;
00451 uint toUInt(const QString &s, bool *ok = 0) const;
00452 Q_LONG toLong(const QString &s, bool *ok = 0) const;
00453 Q_ULONG toULong(const QString &s, bool *ok = 0) const;
00454 Q_LLONG toLongLong(const QString &s, bool *ok = 0) const;
00455 Q_ULLONG toULongLong(const QString &s, bool *ok = 0) const;
00456 float toFloat(const QString &s, bool *ok = 0) const;
00457 double toDouble(const QString &s, bool *ok = 0) const;
00458
00459 QString toString(short i) const
00460 { return toString((Q_LLONG)i); }
00461 QString toString(ushort i) const
00462 { return toString((Q_ULLONG)i); }
00463 QString toString(int i) const
00464 { return toString((Q_LLONG)i); }
00465 QString toString(uint i) const
00466 { return toString((Q_ULLONG)i); }
00467 #if !defined(Q_OS_WIN64)
00468 QString toString(Q_LONG i) const
00469 { return toString((Q_LLONG)i); }
00470 QString toString(Q_ULONG i) const
00471 { return toString((Q_ULLONG)i); }
00472 #endif
00473 QString toString(Q_LLONG i) const;
00474 QString toString(Q_ULLONG i) const;
00475 QString toString(float i, char f = 'g', int prec = 6) const
00476 { return toString((double) i, f, prec); }
00477 QString toString(double i, char f = 'g', int prec = 6) const;
00478
00479 static QString languageToString(Language language);
00480 static QString countryToString(Country country);
00481 static void setDefault(const QLocale &locale);
00482
00483 static QLocale c() { return QLocale(C); }
00484 static QLocale system();
00485
00486 private:
00487 const QLocalePrivate *d;
00488 static const QLocalePrivate *default_d;
00489 };
00490
00491 #endif