#include </home/clem/local/src/opie/qmake/include/qlocale.h>
Collaboration diagram for QLocale:

It is initialized with a country/language pair in its constructor and offers number-to-string and string-to-number conversion functions simmilar to those in QString.
QLocale egyptian(QLocale::Arabic, QLocale::Egypt); QString s1 = egyptian.toString(1.571429E+07, 'e'); QString s2 = egyptian.toString(10); double d = egyptian.toDouble(s1); int s2 = egyptian.toInt(s2);
QLocale supports the concept of a default locale, which is determined from the system's locale settings at application startup. The default locale can be changed by calling the static member setDefault(). The default locale has the following effects:
If a QLocale object is constructed with the default constructor, it will use the default locale's settings. QString::toDouble() interprets the string according to the default locale. If this fails, it falls back on the "C" locale. QString::arg() uses the default locale to format a number when its position specifier in the format string contains an 'L', e.g. "%L1".
QLocale::setDefault(QLocale::Hebrew, QLocale::Israel); QLocale hebrew; // Constructs a default QLocale QString s1 = hebrew.toString(15714.3, 'e'); bool ok; double d; QLocale::setDefault(QLocale::C); d = QString( "1234,56" ).toDouble(&ok); // ok == false d = QString( "1234.56" ).toDouble(&ok); // ok == true, d == 1234.56 QLocale::setDefault(QLocale::German); d = QString( "1234,56" ).toDouble(&ok); // ok == true, d == 1234.56 d = QString( "1234.56" ).toDouble(&ok); // ok == true, d == 1234.56 QLocale::setDefault(QLocale::English, QLocale::UnitedStates); str = QString( "%1 %L2 %L3" ) .arg( 12345 ) .arg( 12345 ) .arg( 12345, 0, 16 ); // str == "12345 12,345 3039"
When a language/country pair is specified in the constructor, one of three things can happen:
If the language/country pair is found in the database, it is used. If the language is found but the country is not, or if the country is AnyCountry, the language is used with the most appropriate available country (for example, Germany for German), If neither the language nor the country are found, QLocale defaults to the default locale (see setDefault()).
The "C" locale is identical to English/UnitedStates.
Use language() and country() to determine the actual language and country values used.
An alternative method for constructing a QLocale object is by specifying the locale name.
This constructor converts the locale name to a language/country pair; it does not use the system locale database.
All the methods in QLocale, with the exception of setDefault(), are reentrant.
Copyright (c) 1991 by AT&T.
Permission to use, copy, modify, and distribute this software for any purpose without fee is hereby granted, provided that this entire notice is included in all copies of any software which is or includes a copy or modification of this software and in all copies of the supporting documentation for such software.
THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR AT&T MAKES ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
This product includes software developed by the University of California, Berkeley and its contributors.
Definition at line 43 of file qlocale.h.
|
|
|
This enumerated type is used to specify a language. C Identical to English/UnitedStates Abkhazian Afan Afar Afrikaans Albanian Amharic Arabic Armenian Assamese Aymara Azerbaijani Bashkir Basque Bengali Bhutani Bihari Bislama Breton Bulgarian Burmese Byelorussian Cambodian Catalan Chinese Corsican Croatian Czech Danish Dutch English Esperanto Estonian Faroese FijiLanguage Finnish French Frisian Gaelic Galician Georgian German Greek Greenlandic Guarani Gujarati Hausa Hebrew Hindi Hungarian Icelandic Indonesian Interlingua Interlingue Inuktitut Inupiak Irish Italian Japanese Javanese Kannada Kashmiri Kazakh Kinyarwanda Kirghiz Korean Kurdish Kurundi Laothian Latin Latvian Lingala Lithuanian Macedonian Malagasy Malay Malayalam Maltese Maori Marathi Moldavian Mongolian NauruLanguage Nepali Norwegian Occitan Oriya Pashto Persian Polish Portuguese Punjabi Quechua RhaetoRomance Romanian Russian Samoan Sangho Sanskrit Serbian SerboCroatian Sesotho Setswana Shona Sindhi Singhalese Siswati Slovak Slovenian Somali Spanish Sundanese Swahili Swedish Tagalog Tajik Tamil Tatar Telugu Thai Tibetan Tigrinya TongaLanguage Tsonga Turkish Turkmen Twi Uigur Ukrainian Urdu Uzbek Vietnamese Volapuk Welsh Wolof Xhosa Yiddish Yoruba Zhuang Zulu
|
|
|
Constructs a QLocale object initialized with the default locale.
Definition at line 2303 of file qlocale.cpp. References d, default_d, and system(). Referenced by system(). |
|
|
Constructs a QLocale object with the specified name, which has the format "language[_country][.codeset][@modifier]" or "C", where: language is a lowercase, two-letter, ISO 639 language code, territory is an uppercase, two-letter, ISO 3166 country code, and codeset and modifier are ignored. If the string violates the locale format, or language is not a valid ISO 369 code, the "C" locale is used instead. If country is not present, or is not a valid ISO 3166 code, the most appropriate country is chosen for the specified language.
The language and country codes are converted to their respective This constructor is much slower than QLocale(Country, Language).
Definition at line 2259 of file qlocale.cpp. References AnyCountry, C, codeToCountry(), codeToLanguage(), d, findLocale(), and l. |
|
||||||||||||
|
Constructs a QLocale object with the specified language and country.
If the language/country pair is found in the database, it is used. If the language is found but the country is not, or if the country is The language and country that are actually used can be queried using language() and country().
Definition at line 2330 of file qlocale.cpp. References C, d, default_d, findLocale(), QLocalePrivate::languageId(), and system(). |
|
|
Constructs a QLocale object as a copy of other. Definition at line 2347 of file qlocale.cpp. References d. |
|
|
Returns a QLocale object initialized to the "C" locale.
Definition at line 483 of file qlocale.h. Referenced by name(). |
|
|
Returns the country of this locale.
Definition at line 2398 of file qlocale.cpp. References QLocalePrivate::countryId(), and d. Referenced by name(). |
|
|
Returns a QString containing the name of country. Definition at line 2446 of file qlocale.cpp. References country_name_index, country_name_list, and LastCountry. |
|
|
Returns the language of this locale.
Definition at line 2388 of file qlocale.cpp. References d, and QLocalePrivate::languageId(). Referenced by name(). |
|
|
Returns a QString containing the name of language. Definition at line 2435 of file qlocale.cpp. References language_name_index, language_name_list, and LastLanguage. |
|
|
Returns the language and country of this locale as a string of the form "language_country", where language is a lowercase, two-letter ISO 639 language code, and country is an uppercase, two-letter ISO 3166 country code.
Definition at line 2412 of file qlocale.cpp. References AnyCountry, QString::append(), c(), C, country(), countryToCode(), l, language(), and languageToCode(). |
|
|
Assigns other to this QLocale object and returns a reference to this QLocale object. Definition at line 2357 of file qlocale.cpp. References d. |
|
|
Sets the global default locale to locale. These values are used when a QLocale object is constructed with no arguments. If this function is not called, the system's locale is used.
Definition at line 2378 of file qlocale.cpp. |
|
|
Returns a QLocale object initialized to the system locale. Definition at line 2767 of file qlocale.cpp. References QLocale(), s, and QLocalePrivate::systemLocaleName(). Referenced by QLocale(). |
|
||||||||||||
|
Returns the double represented by the localized string s, or 0.0 if the conversion failed. If ok is not 0, reports failure by setting ok to false and success by setting *ok to true. Unlike QString::toDouble(), this function does not fall back to the "C" locale if the string cannot be interpreted in this locale.
bool ok; double d; QLocale c(QLocale::C); d = c.toDouble( "1234.56", &ok ); // ok == true, d == 1234.56 d = c.toDouble( "1,234.56", &ok ); // ok == true, d == 1234.56 d = c.toDouble( "1234,56", &ok ); // ok == false QLocale german(QLocale::German); d = german.toDouble( "1234,56", &ok ); // ok == true, d == 1234.56 d = german.toDouble( "1.234,56", &ok ); // ok == true, d == 1234.56 d = german.toDouble( "1234.56", &ok ); // ok == false d = german.toDouble( "1.234", &ok ); // ok == true, d == 1234.0 Notice that the last conversion returns 1234.0, because '.' is the thousands group separator in the German locale. This function ignores leading and trailing whitespace.
Definition at line 2680 of file qlocale.cpp. References d, QLocalePrivate::ParseGroupSeparators, and QLocalePrivate::stringToDouble(). Referenced by toFloat(). |
|
||||||||||||
|
Returns the float represented by the localized string s, or 0.0 if the conversion failed. If ok is not 0, reports failure by setting ok to false and success by setting *ok to true. This function ignores leading and trailing whitespace.
Definition at line 2639 of file qlocale.cpp. References toDouble(). |
|
||||||||||||
|
Returns the int represented by the localized string s, or 0 if the conversion failed. If ok is not 0, reports failure by setting *ok to false and success by setting *ok to true. This function ignores leading and trailing whitespace.
Definition at line 2511 of file qlocale.cpp. References i, and toLongLong(). |
|
||||||||||||
|
Returns the long int represented by the localized string s, or 0 if the conversion failed. If ok is not 0, reports failure by setting ok to false and success by setting *ok to true. This function ignores leading and trailing whitespace.
Definition at line 2557 of file qlocale.cpp. References i, and toLongLong(). |
|
||||||||||||
|
Returns the long long int represented by the localized string s, or 0 if the conversion failed. If ok is not 0, reports failure by setting ok to false and success by setting *ok to true. This function ignores leading and trailing whitespace.
Definition at line 2604 of file qlocale.cpp. References d, QLocalePrivate::ParseGroupSeparators, and QLocalePrivate::stringToLongLong(). |
|
||||||||||||
|
Returns the short int represented by the localized string s, or 0 if the conversion failed. If ok is not 0, reports failure by setting ok to false and success by setting *ok to true. This function ignores leading and trailing whitespace.
Definition at line 2465 of file qlocale.cpp. References i, and toLongLong(). |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. f and prec have the same meaning as in QString::number(double, char, int).
Definition at line 2728 of file qlocale.cpp. References QLocalePrivate::CapitalEorX, d, QLocalePrivate::DFDecimal, QLocalePrivate::DFExponent, QLocalePrivate::DFSignificantDigits, QLocalePrivate::doubleToString(), flags, qIsUpper(), qToLower(), and QLocalePrivate::ThousandsGroup. |
|
||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. f and prec have the same meaning as in QString::number(double, char, int).
Definition at line 475 of file qlocale.h. References f. |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 2702 of file qlocale.cpp. References d, QLocalePrivate::ThousandsGroup, and QLocalePrivate::unsLongLongToString(). |
|
|
Returns a localized string representation of i.
Definition at line 2691 of file qlocale.cpp. References d, QLocalePrivate::longLongToString(), and QLocalePrivate::ThousandsGroup. |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
||||||||||||
|
Returns the unsigned int represented by the localized string s, or 0 if the conversion failed. If ok is not 0, reports failure by setting ok to false and success by setting *ok to true. This function ignores leading and trailing whitespace.
Definition at line 2534 of file qlocale.cpp. References i, and toULongLong(). |
|
||||||||||||
|
Returns the unsigned long int represented by the localized string s, or 0 if the conversion failed. If ok is not 0, reports failure by setting ok to false and success by setting *ok to true. This function ignores leading and trailing whitespace.
Definition at line 2580 of file qlocale.cpp. References i, and toULongLong(). |
|
||||||||||||
|
Returns the unsigned long long int represented by the localized string s, or 0 if the conversion failed. If ok is not 0, reports failure by setting ok to false and success by setting *ok to true. This function ignores leading and trailing whitespace.
Definition at line 2622 of file qlocale.cpp. References d, QLocalePrivate::ParseGroupSeparators, and QLocalePrivate::stringToUnsLongLong(). Referenced by toUInt(), toULong(), and toUShort(). |
|
||||||||||||
|
Returns the unsigned short int represented by the localized string s, or 0 if the conversion failed. If ok is not 0, reports failure by setting ok to false and success by setting *ok to true. This function ignores leading and trailing whitespace.
Definition at line 2488 of file qlocale.cpp. References i, and toULongLong(). |
|
|
|
|
|
Definition at line 487 of file qlocale.h. Referenced by country(), language(), operator=(), QLocale(), setDefault(), toDouble(), toLongLong(), toString(), and toULongLong(). |
|
|
Definition at line 1633 of file qlocale.cpp. Referenced by QLocale(), and setDefault(). |
1.4.2