Qt 4.8
Classes | Public Types | Public Functions | Private Functions | Friends | List of all members
QSystemLocale Class Reference

#include <qlocale.h>

Classes

struct  CurrencyToStringArgument
 

Public Types

enum  QueryType {
  LanguageId, CountryId, DecimalPoint, GroupSeparator,
  ZeroDigit, NegativeSign, DateFormatLong, DateFormatShort,
  TimeFormatLong, TimeFormatShort, DayNameLong, DayNameShort,
  MonthNameLong, MonthNameShort, DateToStringLong, DateToStringShort,
  TimeToStringLong, TimeToStringShort, DateTimeFormatLong, DateTimeFormatShort,
  DateTimeToStringLong, DateTimeToStringShort, MeasurementSystem, PositiveSign,
  AMText, PMText, FirstDayOfWeek, Weekdays,
  CurrencySymbol, CurrencyToString, UILanguages, StringToStandardQuotation,
  StringToAlternateQuotation, ScriptId, ListToSeparatedString, LocaleChanged,
  NativeLanguageName, NativeCountryName, StandaloneMonthNameLong, StandaloneMonthNameShort
}
 

Public Functions

virtual QLocale fallbackLocale () const
 
 QSystemLocale ()
 Constructs a QSystemLocale object. More...
 
virtual QVariant query (QueryType type, QVariant in) const
 
virtual ~QSystemLocale ()
 Deletes the object. More...
 

Private Functions

 QSystemLocale (bool)
 

Friends

QSystemLocaleQSystemLocale_globalSystemLocale ()
 

Detailed Description

Definition at line 66 of file qlocale.h.

Enumerations

◆ QueryType

Enumerator
LanguageId 
CountryId 
DecimalPoint 
GroupSeparator 
ZeroDigit 
NegativeSign 
DateFormatLong 
DateFormatShort 
TimeFormatLong 
TimeFormatShort 
DayNameLong 
DayNameShort 
MonthNameLong 
MonthNameShort 
DateToStringLong 
DateToStringShort 
TimeToStringLong 
TimeToStringShort 
DateTimeFormatLong 
DateTimeFormatShort 
DateTimeToStringLong 
DateTimeToStringShort 
MeasurementSystem 
PositiveSign 
AMText 
PMText 
FirstDayOfWeek 
Weekdays 
CurrencySymbol 
CurrencyToString 
UILanguages 
StringToStandardQuotation 
StringToAlternateQuotation 
ScriptId 
ListToSeparatedString 
LocaleChanged 
NativeLanguageName 
NativeCountryName 
StandaloneMonthNameLong 
StandaloneMonthNameShort 

Definition at line 81 of file qlocale.h.

81  {
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
101  DateTimeFormatShort, // QString
102  DateTimeToStringLong, // QString in: QDateTime
103  DateTimeToStringShort, // QString in: QDateTime
104  MeasurementSystem, // uint
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
116  ListToSeparatedString, // QString
117  LocaleChanged, // system locale changed
118  NativeLanguageName, // QString
119  NativeCountryName, // QString
120  StandaloneMonthNameLong, // QString, in: int
121  StandaloneMonthNameShort // QString, in: int
122  };

Constructors and Destructors

◆ QSystemLocale() [1/2]

QSystemLocale::QSystemLocale ( )

Constructs a QSystemLocale object.

The constructor will automatically install this object as the system locale and remove any earlier installed system locales.

Definition at line 445 of file qlocale.cpp.

446 {
447  delete _systemLocale;
448  _systemLocale = this;
449 
450  if (system_lp)
452 }
quint16 m_language_id
Definition: qlocale_p.h:180
static QSystemLocale * _systemLocale
Definition: qlocale.cpp:83
static QLocalePrivate * system_lp
Definition: qlocale.cpp:85

◆ ~QSystemLocale()

QSystemLocale::~QSystemLocale ( )
virtual

Deletes the object.

Definition at line 461 of file qlocale.cpp.

462 {
463  if (_systemLocale == this) {
464  _systemLocale = 0;
465 
466  if (system_lp)
468  }
469 }
quint16 m_language_id
Definition: qlocale_p.h:180
static QSystemLocale * _systemLocale
Definition: qlocale.cpp:83
static QLocalePrivate * system_lp
Definition: qlocale.cpp:85

◆ QSystemLocale() [2/2]

QSystemLocale::QSystemLocale ( bool  )
private
Warning
This function is not part of the public interface.

Definition at line 455 of file qlocale.cpp.

456 { }

Functions

◆ fallbackLocale()

QLocale QSystemLocale::fallbackLocale ( ) const
virtual

Definition at line 263 of file qlocale_blackberry.cpp.

Referenced by macQuoteString(), QLocalePrivate::updateSystemPrivate(), and QSystemLocalePrivate::winToQtFormat().

264 {
265  return bbSysLocaleData()->languageLocale();
266 }

◆ query()

QVariant QSystemLocale::query ( QueryType  type,
QVariant  in = QVariant() 
) const
virtual

Definition at line 268 of file qlocale_blackberry.cpp.

Referenced by QLocale::amText(), QLocale::createSeparatedList(), QLocale::currencySymbol(), QLocale::dateFormat(), QLocale::dateTimeFormat(), QLocale::dayName(), QLocale::firstDayOfWeek(), macQuoteString(), QLocale::measurementSystem(), QLocale::monthName(), QLocale::nativeCountryName(), QLocale::nativeLanguageName(), QLocale::pmText(), QLocale::quoteString(), QLocale::standaloneDayName(), QLocale::standaloneMonthName(), QLocale::timeFormat(), QLocale::toCurrencyString(), QLocale::toString(), QLocale::uiLanguages(), QLocalePrivate::updateSystemPrivate(), QLocale::weekdays(), and QSystemLocalePrivate::winToQtFormat().

269 {
270  QBBSystemLocaleData *d = bbSysLocaleData();
271 
272  QReadLocker locker(&d->lock);
273 
274  const QLocale &lc_language = d->languageLocale();
275  const QLocale &lc_region = d->regionLocale();
276 
277  switch (type) {
278  case DecimalPoint:
279  return lc_region.decimalPoint();
280  case GroupSeparator:
281  return lc_region.groupSeparator();
282  case NegativeSign:
283  return lc_region.negativeSign();
284  case PositiveSign:
285  return lc_region.positiveSign();
286  case DateFormatLong:
287  return lc_region.dateFormat(QLocale::LongFormat);
288  case DateFormatShort:
289  return lc_region.dateFormat(QLocale::ShortFormat);
290  case TimeFormatLong:
291  return d->timeFormat(QLocale::LongFormat);
292  case TimeFormatShort:
293  return d->timeFormat(QLocale::ShortFormat);
294  case DateTimeFormatLong:
296  case DateTimeFormatShort:
298  case DayNameLong:
299  return lc_language.dayName(in.toInt(), QLocale::LongFormat);
300  case DayNameShort:
301  return lc_language.dayName(in.toInt(), QLocale::ShortFormat);
302  case MonthNameLong:
303  return lc_language.monthName(in.toInt(), QLocale::LongFormat);
304  case MonthNameShort:
305  return lc_language.monthName(in.toInt(), QLocale::ShortFormat);
307  return lc_language.standaloneMonthName(in.toInt(), QLocale::LongFormat);
309  return lc_language.standaloneMonthName(in.toInt(), QLocale::ShortFormat);
310  case DateToStringLong:
311  return lc_region.toString(in.toDate(), QLocale::LongFormat);
312  case DateToStringShort:
313  return lc_region.toString(in.toDate(), QLocale::ShortFormat);
314  case TimeToStringLong:
315  return lc_region.toString(in.toTime(), d->timeFormat(QLocale::LongFormat).toString());
316  case TimeToStringShort:
317  return lc_region.toString(in.toTime(), d->timeFormat(QLocale::ShortFormat).toString());
319  return lc_region.toString(in.toDateTime(), d->dateTimeFormat(QLocale::ShortFormat).toString());
321  return lc_region.toString(in.toDateTime(), d->dateTimeFormat(QLocale::LongFormat).toString());
322  case MeasurementSystem:
323  return d->measurementSystem();
324  case ZeroDigit:
325  return lc_region.zeroDigit();
326  case CountryId:
327  return lc_region.country();
328  case LanguageId:
329  return lc_language.language();
330  case AMText:
331  return lc_language.amText();
332  case PMText:
333  return lc_language.pmText();
334  default:
335  break;
336  }
337  return QVariant();
338 }
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
QChar positiveSign() const
Returns the positive sign character of this locale.
Definition: qlocale.cpp:1830
int type
Definition: qmetatype.cpp:239
Language language() const
Returns the language of this locale.
Definition: qlocale.cpp:920
QString monthName(int, FormatType format=LongFormat) const
Returns the localized name of month, in the format specified by type.
Definition: qlocale.cpp:2007
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
Definition: qvariant.cpp:2270
QDateTime toDateTime() const
Returns the variant as a QDateTime if the variant has type() DateTime , Date , or String ; otherwise ...
Definition: qvariant.cpp:2349
QChar zeroDigit() const
Returns the zero digit character of this locale.
Definition: qlocale.cpp:1804
QString toString(qlonglong i) const
Returns a localized string representation of i.
Definition: qlocale.cpp:1295
int toInt(bool *ok=0) const
Returns the variant as an int if the variant has type() Int , Bool , ByteArray , Char ...
Definition: qvariant.cpp:2625
QChar decimalPoint() const
Returns the decimal point character of this locale.
Definition: qlocale.cpp:1765
QChar groupSeparator() const
Returns the group separator character of this locale.
Definition: qlocale.cpp:1778
QString pmText() const
Returns the localized name of the "PM" suffix for times specified using the conventions of the 12-hou...
Definition: qlocale.cpp:2376
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
QChar negativeSign() const
Returns the negative sign character of this locale.
Definition: qlocale.cpp:1817
QString amText() const
Returns the localized name of the "AM" suffix for times specified using the conventions of the 12-hou...
Definition: qlocale.cpp:2353
QDate toDate() const
Returns the variant as a QDate if the variant has type() Date , DateTime , or String ; otherwise retu...
Definition: qvariant.cpp:2311
QVariant timeFormat(QLocale::FormatType)
QString standaloneMonthName(int, FormatType format=LongFormat) const
Returns the localized name of month that is used as a standalone text, in the format specified by typ...
Definition: qlocale.cpp:2056
QVariant dateTimeFormat(QLocale::FormatType)
QString dayName(int, FormatType format=LongFormat) const
Returns the localized name of the day (where 1 represents Monday, 2 represents Tuesday and so on)...
Definition: qlocale.cpp:2106
QTime toTime() const
Returns the variant as a QTime if the variant has type() Time , DateTime , or String ; otherwise retu...
Definition: qvariant.cpp:2330
Country country() const
Returns the country of this locale.
Definition: qlocale.cpp:945
QString dateFormat(FormatType format=LongFormat) const
Returns the date format used for the current locale.
Definition: qlocale.cpp:1495

Friends and Related Functions

◆ QSystemLocale_globalSystemLocale

QSystemLocale* QSystemLocale_globalSystemLocale ( )
friend

The documentation for this class was generated from the following files: