Move measurement system information out of qlocale_data_p.h
It's only accessed by the internals of QLP::measurementSystem(), so can be local to that function. Change-Id: I389328a34982cd1373c53208238f941348da2dda Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
08ef4d232d
commit
f308024b17
@ -3399,6 +3399,26 @@ Qt::DayOfWeek QLocale::firstDayOfWeek() const
|
||||
|
||||
QLocale::MeasurementSystem QLocalePrivate::measurementSystem() const
|
||||
{
|
||||
/* Unicode CLDR's information about measurement systems doesn't say which to
|
||||
use by default in each locale. Even if it did, adding another entry in
|
||||
every locale's row of locale_data[] would take up much more memory than
|
||||
the small table below.
|
||||
*/
|
||||
struct TerritoryLanguage
|
||||
{
|
||||
quint16 languageId;
|
||||
quint16 territoryId;
|
||||
QLocale::MeasurementSystem system;
|
||||
};
|
||||
// TODO: research how realistic and/or complete this is:
|
||||
constexpr TerritoryLanguage ImperialMeasurementSystems[] = {
|
||||
{ QLocale::English, QLocale::UnitedStates, QLocale::ImperialUSSystem },
|
||||
{ QLocale::English, QLocale::UnitedStatesMinorOutlyingIslands, QLocale::ImperialUSSystem },
|
||||
{ QLocale::Spanish, QLocale::UnitedStates, QLocale::ImperialUSSystem },
|
||||
{ QLocale::Hawaiian, QLocale::UnitedStates, QLocale::ImperialUSSystem },
|
||||
{ QLocale::English, QLocale::UnitedKingdom, QLocale::ImperialUKSystem }
|
||||
};
|
||||
|
||||
for (const auto &system : ImperialMeasurementSystems) {
|
||||
if (system.languageId == m_data->m_language_id
|
||||
&& system.territoryId == m_data->m_territory_id) {
|
||||
|
@ -24,26 +24,6 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/* This part of the file isn't generated, but written by hand. Unicode CLDR's
|
||||
information about measurement systems doesn't say which to use by default in
|
||||
each locale. Even if it did, adding another entry in every locale's row of
|
||||
locale_data[] would take up much more memory than the small table below.
|
||||
*/
|
||||
struct TerritoryLanguage
|
||||
{
|
||||
quint16 languageId;
|
||||
quint16 territoryId;
|
||||
QLocale::MeasurementSystem system;
|
||||
};
|
||||
|
||||
static inline constexpr TerritoryLanguage ImperialMeasurementSystems[] = {
|
||||
{ QLocale::English, QLocale::UnitedStates, QLocale::ImperialUSSystem },
|
||||
{ QLocale::English, QLocale::UnitedStatesMinorOutlyingIslands, QLocale::ImperialUSSystem },
|
||||
{ QLocale::Spanish, QLocale::UnitedStates, QLocale::ImperialUSSystem },
|
||||
{ QLocale::Hawaiian, QLocale::UnitedStates, QLocale::ImperialUSSystem },
|
||||
{ QLocale::English, QLocale::UnitedKingdom, QLocale::ImperialUKSystem }
|
||||
};
|
||||
|
||||
/*
|
||||
Storage for alpha codes with length of up to 4 allowing efficient comparison.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user