7#if (defined(QT_STATIC) || defined(QT_BOOTSTRAPPED)) && defined(Q_CC_GNU_ONLY) && Q_CC_GNU >= 1000
11#if defined(Q_OS_MACOS)
12# include "private/qcore_mac_p.h"
13# include <CoreFoundation/CoreFoundation.h>
16#include "qplatformdefs.h"
25#include <private/qtools_p.h>
26#if QT_CONFIG(datetimeparser)
27#include "private/qdatetimeparser_p.h"
35#if QT_CONFIG(timezone)
38#include "private/qnumeric_p.h"
39#include "private/qtools_p.h"
41#ifndef QT_NO_SYSTEMLOCALE
49#include "private/qcalendarbackend_p.h"
50#include "private/qgregoriancalendar_p.h"
58#ifndef QT_NO_SYSTEMLOCALE
60 QSystemLocale__CurrencyToStringArgument)
66#ifndef QT_NO_SYSTEMLOCALE
94 QLocale::LanguageCodeTypes codeTypes)
noexcept
105 if (uc1 > 0x7F || uc2 > 0x7F || uc3 > 0x7F)
108 const AlphaCode codeBuf = { char(uc1), char(uc2), char(uc3) };
110 auto searchCode = [codeBuf](
auto f) {
146 if (uc1 ==
'n' && uc2 ==
'o')
148 if (uc1 ==
't' && uc2 ==
'l')
150 if (uc1 ==
's' && uc2 ==
'h')
152 if (uc1 ==
'm' && uc2 ==
'o')
155 if (uc1 ==
'i' && uc2 ==
'w')
157 if (uc1 ==
'i' && uc2 ==
'n')
159 if (uc1 ==
'j' && uc2 ==
'i')
179 if (c0 ==
c[0] && c1 ==
c[1] &&
c2 ==
c[2] && c3 ==
c[3])
196 for (; *
c != 0;
c += 3) {
197 if (uc1 ==
c[0] && uc2 ==
c[1] && uc3 ==
c[2])
205 QLocale::LanguageCodeTypes codeTypes)
215 return i.part1.decode();
218 return i.part2B.decode();
221 return i.part2T.decode();
224 return i.part3.decode();
234 return {
reinterpret_cast<const char *
>(
c), 4};
243 return {
reinterpret_cast<const char*
>(
c),
c[2] == 0 ? 2 : 3};
253bool operator<(
const LikelyPair &lhs,
const LikelyPair &rhs)
257 const auto compare = [](
int lhs,
int rhs) {
259 const int huge = 0x10000;
260 return (lhs ? lhs : huge) - (rhs ? rhs : huge);
262 const auto &
left = lhs.key;
263 const auto &
right = rhs.key;
310 auto *pairs =
reinterpret_cast<const LikelyPair *
>(
likely_subtags);
312 LikelyPair sought { *
this };
317 pairs = std::lower_bound(pairs, afterPairs, sought);
320 for (; pairs < afterPairs && pairs->key.language_id ==
language_id; ++pairs) {
337 pairs = std::lower_bound(pairs, afterPairs, sought);
340 for (; pairs < afterPairs && pairs->key.territory_id ==
territory_id; ++pairs) {
356 pairs = std::lower_bound(pairs, afterPairs, sought);
357 if (pairs < afterPairs && pairs->
key.script_id ==
script_id) {
358 Q_ASSERT(!pairs->key.language_id && !pairs->key.territory_id);
369 pairs = std::lower_bound(pairs, afterPairs, sought);
370 if (pairs < afterPairs) {
423 const unsigned char *script =
425 const unsigned char *country =
428 qsizetype len = langLen + (script ? 4 + 1 : 0) + (country ? (country[2] != 0 ? 3 : 2) + 1 : 0);
430 char *uc =
name.data();
432 auto langArray = lang.
decode();
434 *uc++ = langArray[0];
435 *uc++ = langArray[1];
437 *uc++ = langArray[2];
498#define CheckCandidate(id) do { \
499 if (!tried.contains(id)) { \
500 index = findLocaleIndexById(id); \
503 tried.push_back(id); \
537 const std::u16string_view
v(
name.utf16(),
size_t(
name.size()));
538 const auto i =
v.find_first_of(u
"_-.@");
539 if (
i == std::string_view::npos)
548 const char16_t ch = uc.unicode();
552 return tag.size() > 0;
559 static const QString allScripts =
568 enum ParserState { NoState, LangState, ScriptState, CountryState };
569 ParserState
state = LangState;
570 while (
name.size() &&
state != NoState) {
575 const bool sep =
name.size() > 0;
581 if (
tag.size() != 2 &&
tag.size() != 3)
585 state =
sep ? ScriptState : NoState;
591 state =
sep ? CountryState : NoState;
606 return state != LangState;
631 if (
format.at(
i).unicode() ==
'\'') {
639 if (
format.at(
i).unicode() ==
'\'') {
640 if (
format.mid(
i + 1).startsWith(u
'\'')) {
679 while (
j <
s.size() &&
s.at(
j) ==
c)
692#ifndef QT_NO_SYSTEMLOCALE
752 return &globalInstance;
788#ifndef QT_NO_SYSTEMLOCALE
797 systemDataMutex.
lock();
800 systemDataMutex.unlock();
819#ifndef QT_NO_SYSTEMLOCALE
838#ifndef QT_NO_DATASTREAM
885 if (defaultLocalePrivate.exists())
886 numberOptions = defaultLocalePrivate->data()->m_numberOptions;
893static std::optional<QString>
896#ifndef QT_NO_SYSTEMLOCALE
901 if (
v.metaType() != QMetaType::fromType<QString>())
947#ifndef QT_NO_SYSTEMLOCALE
1014 :
d(localePrivateByName(
name))
1033 :
d(*defaultLocalePrivate)
1176#ifndef QT_NO_SYSTEMLOCALE
1211#ifndef QT_NO_SYSTEMLOCALE
1229 return d->
m_data->pairListPattern().getData(
1261 if (defaultLocalePrivate.isDestroyed())
1263 if (!defaultLocalePrivate.exists()) {
1266 Q_ASSERT(defaultLocalePrivate.exists());
1270 *defaultLocalePrivate = locale.d;
1308#if QT_DEPRECATED_SINCE(6, 6)
1356template <
typename T>
static inline
1359 constexpr bool isUnsigned = std::is_unsigned_v<T>;
1360 using Int64 =
typename std::conditional_t<isUnsigned, quint64, qint64>;
1363 if constexpr (isUnsigned)
1364 val =
d->m_data->stringToUnsLongLong(
str, 10,
ok,
d->m_numberOptions);
1366 val =
d->m_data->stringToLongLong(
str, 10,
ok,
d->m_numberOptions);
1441 LanguageCodeTypes codeTypes)
noexcept
1476#if QT_DEPRECATED_SINCE(6, 6)
1487QString QLocale::countryToCode(Country country)
1545 return "Unknown"_L1;
1559 return "Unknown"_L1;
1563#if QT_DEPRECATED_SINCE(6, 6)
1571QString QLocale::countryToString(Country country)
1587 return "Unknown"_L1;
1765 return toIntegral_helper<short>(d,
s,
ok);
1785 return toIntegral_helper<ushort>(d,
s,
ok);
1805 return toIntegral_helper<int>(d,
s,
ok);
1825 return toIntegral_helper<uint>(d,
s,
ok);
1844 return toIntegral_helper<long>(d,
s,
ok);
1864 return toIntegral_helper<ulong>(d,
s,
ok);
1885 return toIntegral_helper<qlonglong>(d,
s,
ok);
1906 return toIntegral_helper<qulonglong>(d,
s,
ok);
2059#ifndef QT_NO_SYSTEMLOCALE
2083#ifndef QT_NO_SYSTEMLOCALE
2102 if (
format.at(
i).unicode() ==
'\'') {
2107 if (
format.at(
i).toLower().unicode() ==
'a')
2167#ifndef QT_NO_SYSTEMLOCALE
2191#ifndef QT_NO_SYSTEMLOCALE
2217#ifndef QT_NO_SYSTEMLOCALE
2246#ifndef QT_NO_SYSTEMLOCALE
2258 ? d->
m_data->longDateFormat()
2259 : d->
m_data->shortDateFormat()
2277#ifndef QT_NO_SYSTEMLOCALE
2289 ? d->
m_data->longTimeFormat()
2290 : d->
m_data->shortTimeFormat()
2308#ifndef QT_NO_SYSTEMLOCALE
2314 if (!
res.isNull()) {
2322#if QT_CONFIG(datestring)
2421#if QT_CONFIG(datetimeparser)
2423 dt.setDefaultLocale(*
this);
2424 if (dt.parseFormat(
format))
2425 dt.fromString(
string,
nullptr, &
time);
2460#if QT_CONFIG(datetimeparser)
2462 dt.setDefaultLocale(*
this);
2463 if (dt.parseFormat(
format))
2464 dt.fromString(
string, &
date,
nullptr);
2505#if QT_CONFIG(datetimeparser)
2509 dt.setDefaultLocale(*
this);
2510 if (dt.parseFormat(
format) && (dt.fromString(
string, &datetime) || !datetime.
isValid()))
2780 if (
filter.acceptScriptTerritory(
id)) {
2790 if (
filter.acceptLanguage(syslocaledata->m_language_id)) {
2791 const QLocaleId id = syslocaledata->id();
2792 if (
filter.acceptScriptTerritory(
id))
2799#if QT_DEPRECATED_SINCE(6, 6)
2814 result.reserve(locales.size());
2815 for (
const auto &locale : locales)
2896 const char16_t *monthsData,
int month,
2902 range = localeData.longMonth();
2905 range = localeData.shortMonth();
2908 range = localeData.narrowMonth();
2913 return range.getListEntry(monthsData, month - 1);
2921 const char16_t *monthsData,
int month,
2927 range = localeData.longMonthStandalone();
2930 range = localeData.shortMonthStandalone();
2933 range = localeData.narrowMonthStandalone();
2979 range =
data->shortDayNamesStandalone();
2982 range =
data->narrowDayNamesStandalone();
3006#ifndef QT_NO_SYSTEMLOCALE
3008 Q_ASSERT(month >= 1 && month <= 12);
3041#ifndef QT_NO_SYSTEMLOCALE
3043 Q_ASSERT(month >= 1 && month <= 12);
3070 if (day < 1 || day > 7)
3073#ifndef QT_NO_SYSTEMLOCALE
3099 if (day < 1 || day > 7)
3102#ifndef QT_NO_SYSTEMLOCALE
3134#ifndef QT_NO_SYSTEMLOCALE
3147 if (system.languageId ==
m_data->m_language_id
3148 && system.territoryId ==
m_data->m_territory_id) {
3149 return system.system;
3162#ifndef QT_NO_SYSTEMLOCALE
3174 if ((weekendEnd >= weekendStart && (day < weekendStart || day > weekendEnd)) ||
3175 (weekendEnd < weekendStart && (day > weekendEnd && day < weekendStart)))
3188#ifndef QT_NO_SYSTEMLOCALE
3301#ifndef QT_NO_SYSTEMLOCALE
3321#ifndef QT_NO_SYSTEMLOCALE
3339 bool formatDate =
false;
3340 bool formatTime =
false;
3346 }
else if (dateOnly.
isValid()) {
3349 }
else if (timeOnly.
isValid()) {
3357 int year = 0, month = 0, day = 0;
3360 if (!parts.isValid())
3363 month = parts.month;
3367 auto appendToResult = [&](
int t,
int repeat) {
3368 auto data = locale.d->m_data;
3375 auto formatType = [](
int repeat) {
3381 if (
format.at(
i).unicode() ==
'\'') {
3388 Q_ASSERT(rep < std::numeric_limits<int>::max());
3389 int repeat = int(rep);
3392 switch (
c.unicode()) {
3397 else if (repeat >= 2)
3402 appendToResult(year, (year < 0) ? 5 : 4);
3405 appendToResult(year % 100, 2);
3416 repeat =
qMin(repeat, 4);
3418 appendToResult(month, repeat);
3425 repeat =
qMin(repeat, 4);
3427 appendToResult(day, repeat);
3437 if (!used && formatTime) {
3438 switch (
c.unicode()) {
3441 repeat =
qMin(repeat, 2);
3449 appendToResult(hour, repeat);
3454 repeat =
qMin(repeat, 2);
3455 appendToResult(
time.
hour(), repeat);
3460 repeat =
qMin(repeat, 2);
3466 repeat =
qMin(repeat, 2);
3477 if (
c.unicode() ==
'A' && (repeat == 1 ||
format.at(
i + 1).unicode() ==
'P'))
3479 else if (
c.unicode() ==
'a' && (repeat == 1 ||
format.at(
i + 1).unicode() ==
'p'))
3488 repeat =
qMin(repeat, 3);
3494 if (
result.endsWith(locale.zeroDigit()))
3496 if (
result.endsWith(locale.zeroDigit()))
3503 repeat =
qMin(repeat, 4);
3508#if QT_CONFIG(timezone)
3510 text = when.timeZone().displayName(when, QTimeZone::LongName);
3562 bufSize += std::numeric_limits<double>::max_digits10;
3570 bool negative =
false;
3587 }
else if (
zero.size() == 2 &&
zero.at(0).isHighSurrogate()) {
3601 char16_t z =
zero.at(0).unicode();
3602 char16_t *
const value =
reinterpret_cast<char16_t *
>(
digits.data());
3612 numStr = exponentForm(std::move(
digits), decpt,
precision, PMDecimalDigits,
3613 mustMarkDecimal, minExponentDigits);
3616 numStr = decimalForm(std::move(
digits), decpt,
precision, PMDecimalDigits,
3617 mustMarkDecimal, groupDigits);
3639 int bias = 2 + minExponentDigits;
3644 if (decpt > 10 && minExponentDigits == 1)
3650 if (!mustMarkDecimal) {
3653 if (digitCount <= decpt && digitCount > 1)
3663 useDecimal = (decpt <= 0 ? 1 - decpt <=
bias
3673 mustMarkDecimal, groupDigits)
3675 mustMarkDecimal, minExponentDigits);
3687 return prefix + (
flags &
CapitalEorX ? std::move(numStr).toUpper() : numStr);
3691 PrecisionMode pm,
bool mustMarkDecimal,
3692 bool groupDigits)
const
3695 const auto digitWidth =
zero.size();
3696 Q_ASSERT(digitWidth == 1 || digitWidth == 2);
3702 for (; decpt < 0; ++decpt)
3710 case PMDecimalDigits:
3714 case PMSignificantDigits:
3718 case PMChopTrailingZeros:
3723 if (mustMarkDecimal || decpt <
digits.size() / digitWidth)
3739 return std::move(
digits);
3743 PrecisionMode pm,
bool mustMarkDecimal,
3744 int minExponentDigits)
const
3747 const auto digitWidth =
zero.size();
3748 Q_ASSERT(digitWidth == 1 || digitWidth == 2);
3752 case PMDecimalDigits:
3756 case PMSignificantDigits:
3760 case PMChopTrailingZeros:
3765 if (mustMarkDecimal ||
digits.size() > digitWidth)
3771 return std::move(
digits);
3774QString QLocaleData::signPrefix(
bool negative,
unsigned flags)
const
3788 bool negative =
n < 0;
3805 return applyIntegerFormatting(l ?
qulltoa(l,
base,
zero) : resultZero,
3813 const auto digitWidth =
zero.size();
3814 const auto digitCount = numStr.size() / digitWidth;
3820 return upper ? u
"0X" : u
"0x";
3822 return upper ? u
"0B" : u
"0b";
3829 const QString prefix = signPrefix(negative,
flags) + basePrefix;
3837 numStr.insert(
i * digitWidth,
group);
3840 numStr.insert(
i * digitWidth,
group);
3847 const bool noPrecision =
precision == -1;
3852 numStr.prepend(
zero);
3860 numStr.prepend(
zero);
3888#ifndef QT_NO_SYSTEMLOCALE
3891 return sys->query(
query).toString();
3895 if (
result.sysDecimal.size())
3899 if (
result.sysGroup.size())
3902 if (
result.sysMinus.size())
3905 if (
result.sysPlus.size())
3918class NumericTokenizer
3922 static constexpr char lettersInfNaN[] =
"afin";
3923 static constexpr auto matchInfNaN = QtPrivate::makeCharacterSetMatch<lettersInfNaN>();
3928 static_assert(
'+' + 1 ==
',' &&
',' + 1 ==
'-' &&
'-' + 1 ==
'.');
3933 : m_text(
text), m_guide(guide), m_mode(
mode),
3938 bool done()
const {
return !(m_index < m_text.
size()); }
3940 inline int asBmpDigit(
char16_t digit)
const;
3944int NumericTokenizer::asBmpDigit(
char16_t digit)
const
3949 return digit - m_guide.
zeroUcs;
3952 if (digit == u
'\u3020')
3955 return digit - u
'\u3020';
3958char NumericTokenizer::nextToken()
3964 const auto asciiLower = [](
unsigned char c) {
return c >=
'A' ?
c | 0x20 :
c; };
3967 if (
ch == u
'\u2212') {
3981 && matchInfNaN.matches(ascii))
3983 && ascii ==
'e'))) {
3989 if (
ch.unicode() < 256) {
3992 if (
isAsciiDigit(ascii) || ascii ==
'-' || ascii ==
'+'
4025 if (!
ch.isSurrogate()) {
4026 const uint gap = asBmpDigit(
ch.unicode());
4034 }
else if (
ch.isHighSurrogate()) {
4037 if (tail.
size() > 1) {
4042 return gap < 10u ?
'0' + gap : 0;
4114 while (!tokens.done()) {
4116 char out = tokens.nextToken();
4123 if (decpt_idx != -1 || exponent_idx != -1)
4126 }
else if (
out ==
'e') {
4131 && exponent_idx != -1 &&
out ==
'0') {
4141 if (idx == exponent_idx && last ==
'0')
4147 if (start_of_digits_idx == -1)
4148 start_of_digits_idx = idx;
4150 }
else if (
out ==
',') {
4152 if (decpt_idx != -1 || exponent_idx != -1)
4155 if (last_separator_idx == -1) {
4167 last_separator_idx = idx;
4170 && last_separator_idx != -1) {
4176 last_separator_idx = -1;
4178 }
else if (
out ==
',') {
4194 && decpt_idx != -1 && exponent_idx == -1) {
4205 int decDigits, QLocale::NumberOptions number_options)
const
4210 enum { Whole, Fractional, Exponent }
state = Whole;
4215 while (!tokens.done()) {
4216 char c = tokens.nextToken();
4225 if (decDigits-- == 0)
4254 if (last !=
'\0' && !(scientific && last ==
'e'))
4270 if (!scientific ||
state == Exponent)
4280 Q_ASSERT(!
c ||
c ==
'a' ||
c ==
'f' ||
c ==
'i' ||
c ==
'n');
4294 QLocale::NumberOptions number_options)
const
4309 QLocale::NumberOptions number_options)
const
4322 QLocale::NumberOptions number_options)
const
4340 if (used <
len &&
num[used] !=
'\0') {
4345 if (used <
len &&
num[used] !=
'\0')
4358 return parsed ?
r.result : 0;
4367 return parsed ?
r.result : 0;
4388#ifndef QT_NO_SYSTEMLOCALE
4401 const char *code = d->
m_data->m_currency_iso_code;
4420#ifndef QT_NO_SYSTEMLOCALE
4447#ifndef QT_NO_SYSTEMLOCALE
4475#ifndef QT_NO_SYSTEMLOCALE
4535 int power,
base = 1000;
4539 power = int(std::log10(
qAbs(bytes)) / 3);
4551 Q_ASSERT(power <= 6 && power >= 0);
4555 ? d->
m_data->byteAmountSI() : d->
m_data->byteAmountIEC();
4561 return number + u
' ' + unit;
4584#ifdef QT_NO_SYSTEMLOCALE
4585 constexpr bool isSystem =
false;
4629 }
else if (
id.language_id ==
C) {
4644 if (
auto name = min.name();
name != prior)
4652 if (
id != min &&
id.withLikelySubtagsAdded() == max) {
4658 if (!
id.territory_id) {
4663 if (
id != max &&
id.withLikelySubtagsAdded() == max) {
4670 if (max != min && max !=
id) {
4691#ifndef QT_NO_SYSTEMLOCALE
4711#ifndef QT_NO_SYSTEMLOCALE
4731#ifndef QT_NO_SYSTEMLOCALE
4741#if QT_DEPRECATED_SINCE(6, 6)
4751QString QLocale::nativeCountryName()
const
4757#ifndef QT_NO_DEBUG_STREAM
4761 dbg.nospace().noquote()
4770#ifndef QT_NO_QOBJECT
4771#include "moc_qlocale.cpp"
T fetchAndAddRelaxed(T valueToAdd) noexcept
void reserve(qsizetype size)
Attempts to allocate memory for at least size bytes.
void clear()
Clears the contents of the byte array and makes it null.
QByteArray & append(char c)
This is an overloaded member function, provided for convenience. It differs from the above function o...
virtual QString standaloneWeekDayName(const QLocale &locale, int day, QLocale::FormatType format) const
Returns the standalone name of the specified day of the week in the chosen locale,...
virtual const char16_t * localeMonthData() const =0
virtual QString standaloneMonthName(const QLocale &locale, int month, int year, QLocale::FormatType format) const
Returns the standalone name of the specified month in the chosen locale, using the specified format t...
virtual QString dateTimeToString(QStringView format, const QDateTime &datetime, QDate dateOnly, QTime timeOnly, const QLocale &locale) const
Returns a string representing a given date, time or date-time.
virtual const QCalendarLocale * localeMonthIndexData() const =0
virtual int dayOfWeek(qint64 jd) const
Returns the day of the week for the given Julian Day Number jd.
virtual QString weekDayName(const QLocale &locale, int day, QLocale::FormatType format) const
Returns the name of the specified day of the week in the chosen locale, using the specified format to...
virtual QCalendar::YearMonthDay julianDayToDate(qint64 jd) const =0
Computes the year, month, and day in this calendar for the given Julian day number jd.
virtual QString monthName(const QLocale &locale, int month, int year, QLocale::FormatType format) const
Returns the name of the specified month in the given year for the chosen locale, using the given form...
virtual int maximumMonthsInYear() const
Returns the maximum number of months possible in any year.
The QCalendar class describes calendar systems.
bool isGregorian() const
Returns true if this calendar object is the Gregorian calendar object used as default calendar by oth...
QString standaloneMonthName(const QLocale &locale, int month, int year=Unspecified, QLocale::FormatType format=QLocale::LongFormat) const
Returns a suitably localised standalone name for a month.
QString dateTimeToString(QStringView format, const QDateTime &datetime, QDate dateOnly, QTime timeOnly, const QLocale &locale) const
Returns a string representing a given date, time or date-time.
QString monthName(const QLocale &locale, int month, int year=Unspecified, QLocale::FormatType format=QLocale::LongFormat) const
Returns a suitably localised name for a month.
QString standaloneWeekDayName(const QLocale &locale, int day, QLocale::FormatType format=QLocale::LongFormat) const
Returns a suitably localised standalone name for a day of the week.
QString weekDayName(const QLocale &locale, int day, QLocale::FormatType format=QLocale::LongFormat) const
Returns a suitably localised name for a day of the week.
static constexpr char32_t surrogateToUcs4(char16_t high, char16_t low) noexcept
Converts a UTF16 surrogate pair with the given high and low values to it's UCS-4-encoded code point.
static constexpr bool requiresSurrogates(char32_t ucs4) noexcept
Returns true if the UCS-4-encoded character specified by ucs4 can be split into the high and low part...
static constexpr char16_t highSurrogate(char32_t ucs4) noexcept
Returns the high surrogate part of a UCS-4-encoded code point.
constexpr bool isLowSurrogate() const noexcept
Returns true if the QChar is the low part of a UTF16 surrogate (for example if its code point is in r...
constexpr bool isSurrogate() const noexcept
constexpr char16_t unicode() const noexcept
Returns the numeric Unicode value of the QChar.
static constexpr char16_t lowSurrogate(char32_t ucs4) noexcept
Returns the low surrogate part of a UCS-4-encoded code point.
constexpr bool isHighSurrogate() const noexcept
Returns true if the QChar is the high part of a UTF16 surrogate (for example if its code point is in ...
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
int offsetFromUtc() const
static QDateTime currentDateTime()
This is an overloaded member function, provided for convenience. It differs from the above function o...
QTime time() const
Returns the time part of the datetime.
QString timeZoneAbbreviation() const
bool isValid() const
Returns true if this datetime represents a definite moment, otherwise false.
QDateTime toOffsetFromUtc(int offsetSeconds) const
QDate date() const
Returns the date part of the datetime.
\inmodule QtCore \reentrant
constexpr bool isValid() const
Returns true if this date is valid; otherwise returns false.
constexpr qint64 toJulianDay() const
Converts the date to a Julian day.
QVariant data(int key) const
Returns this item's custom data for the key key as a QVariant.
QString monthName(const QLocale &locale, int month, int year, QLocale::FormatType format) const override
Returns the name of the specified month in the given year for the chosen locale, using the given form...
QString standaloneMonthName(const QLocale &locale, int month, int year, QLocale::FormatType format) const override
Returns the standalone name of the specified month in the chosen locale, using the specified format t...
qsizetype size() const noexcept
bool isEmpty() const noexcept
const_reference at(qsizetype i) const noexcept
void prepend(rvalue_ref t)
void append(parameter_type t)
static QLatin1StringView scriptToCode(QLocale::Script script)
quint16 languageId() const
static QLocale::Language codeToLanguage(QStringView code, QLocale::LanguageCodeTypes codeTypes=QLocale::AnyLanguageCode) noexcept
const QLocaleData *const m_data
QLocale::MeasurementSystem measurementSystem() const
quint16 territoryId() const
static QLatin1StringView territoryToCode(QLocale::Territory territory)
static QLocale::Territory codeToTerritory(QStringView code) noexcept
static std::array< char, 4 > languageToCode(QLocale::Language language, QLocale::LanguageCodeTypes codeTypes=QLocale::AnyLanguageCode)
static QLocale::Script codeToScript(QStringView code) noexcept
QLocale::NumberOptions m_numberOptions
QLatin1StringView territoryCode() const
std::array< char, 4 > languageCode(QLocale::LanguageCodeTypes codeTypes=QLocale::AnyLanguageCode) const
static QBasicAtomicInt s_generation
QByteArray bcp47Name(char separator='-') const
QString decimalPoint() const
static QString languageToCode(Language language, LanguageCodeTypes codeTypes=AnyLanguageCode)
Returns the two- or three-letter language code for language, as defined in the ISO 639 standards.
QString quoteString(const QString &str, QuotationStyle style=StandardQuotation) const
QString dateTimeFormat(FormatType format=LongFormat) const
Language language() const
Returns the language of this locale.
QString bcp47Name() const
Returns the BCP47 field names joined with dashes.
QString zeroDigit() const
QLocale & operator=(const QLocale &other) noexcept
Assigns other to this QLocale object and returns a reference to this QLocale object.
QStringList uiLanguages() const
List of locale names for use in selecting translations.
double toDouble(const QString &s, bool *ok=nullptr) const
Returns the double represented by the localized string s.
QString dateFormat(FormatType format=LongFormat) const
float toFloat(const QString &s, bool *ok=nullptr) const
Returns the float represented by the localized string s.
static QString scriptToString(Script script)
void setNumberOptions(NumberOptions options)
QString negativeSign() const
Qt::DayOfWeek firstDayOfWeek() const
uint toUInt(const QString &s, bool *ok=nullptr) const
Returns the unsigned int represented by the localized string s.
QString toUpper(const QString &str) const
long toLong(const QString &s, bool *ok=nullptr) const
Qt::LayoutDirection textDirection() const
static Territory codeToTerritory(QStringView territoryCode) noexcept
QString dayName(int, FormatType format=LongFormat) const
@ InscriptionalParthianScript
@ InscriptionalPahlaviScript
static QString territoryToCode(Territory territory)
QString toCurrencyString(qlonglong, const QString &symbol=QString()) const
QString timeFormat(FormatType format=LongFormat) const
QString groupSeparator() const
QString createSeparatedList(const QStringList &strl) const
static void setDefault(const QLocale &locale)
\nonreentrant
QString monthName(int, FormatType format=LongFormat) const
static QString territoryToString(Territory territory)
MeasurementSystem measurementSystem() const
QLocale collation() const
QString nativeTerritoryName() const
static Script codeToScript(QStringView scriptCode) noexcept
Returns the QLocale::Script enum corresponding to the four-letter script scriptCode,...
static QString languageToString(Language language)
Returns a QString containing the name of language.
int toInt(const QString &s, bool *ok=nullptr) const
Returns the int represented by the localized string s.
static QString scriptToCode(Script script)
Returns the four-letter script code for script, as defined in the ISO 15924 standard.
QString exponential() const
QString formattedDataSize(qint64 bytes, int precision=2, DataSizeFormats format=DataSizeIecFormat) const
qulonglong toULongLong(const QString &s, bool *ok=nullptr) const
Returns the unsigned long long int represented by the localized string s.
QList< Qt::DayOfWeek > weekdays() const
QString positiveSign() const
QString toString(qlonglong i) const
Returns a localized string representation of i.
QString name() const
The short name of this locale.
ulong toULong(const QString &s, bool *ok=nullptr) const
QString standaloneMonthName(int, FormatType format=LongFormat) const
NumberOptions numberOptions() const
short toShort(const QString &s, bool *ok=nullptr) const
Returns the short int represented by the localized string s.
Territory territory() const
qlonglong toLongLong(const QString &s, bool *ok=nullptr) const
Returns the long long int represented by the localized string s.
QLocale()
Constructs a QLocale object initialized with the default locale.
ushort toUShort(const QString &s, bool *ok=nullptr) const
Returns the unsigned short int represented by the localized string s.
QString nativeLanguageName() const
static Language codeToLanguage(QStringView languageCode, LanguageCodeTypes codeTypes=AnyLanguageCode) noexcept
Returns the QLocale::Language enum corresponding to the two- or three-letter languageCode,...
QString toLower(const QString &str) const
QString standaloneDayName(int, FormatType format=LongFormat) const
QString currencySymbol(CurrencySymbolFormat=CurrencySymbol) const
friend class QLocalePrivate
@ RejectTrailingZeroesAfterDot
@ RejectLeadingZeroInExponent
@ IncludeTrailingZeroesAfterDot
@ OmitLeadingZeroInExponent
static QList< QLocale > matchingLocales(QLocale::Language language, QLocale::Script script, QLocale::Territory territory)
Returns a list of valid locale objects that match the given language, script and territory.
static QLocale system()
Returns a QLocale object initialized to the system locale.
void lock() noexcept
Locks the mutex.
bool startsWith(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
constexpr bool isEmpty() const noexcept
Returns whether this string view is empty - that is, whether {size() == 0}.
QString arg(Args &&...args) const
constexpr qsizetype size() const noexcept
Returns the size of this string view, in UTF-16 code units (that is, surrogate pairs count as two for...
QString toString() const
Returns a deep copy of this string view's data as a QString.
constexpr QChar at(qsizetype n) const noexcept
Returns the character at position n in this string view.
constexpr QChar front() const
\macro QT_RESTRICTED_CAST_FROM_ASCII
QByteArray toLatin1() const &
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
void reserve(qsizetype size)
Ensures the string has space for at least size characters.
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isNull() const
Returns true if this string is null; otherwise returns false.
qsizetype size() const
Returns the number of characters in this string.
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QString toLower() const &
QChar * data()
Returns a pointer to the data stored in the QString.
QString sliced(qsizetype pos) const
QString & append(QChar c)
static QString static QString qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString & remove(qsizetype i, qsizetype len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
QString & prepend(QChar c)
QString toUpper() const &
const QChar * unicode() const
Returns a Unicode representation of the string.
void resize(qsizetype size)
Sets the size of the string to size characters.
qsizetype fallbackLocaleIndex() const
@ StringToAlternateQuotation
@ StandaloneMonthNameLong
@ StandaloneDayNameNarrow
@ StandaloneMonthNameNarrow
@ StringToStandardQuotation
@ StandaloneMonthNameShort
virtual QVariant query(QueryType type, QVariant in=QVariant()) const
virtual QLocale fallbackLocale() const
\inmodule QtCore \reentrant
int hour() const
Returns the hour part (0 to 23) of the time.
int minute() const
Returns the minute part (0 to 59) of the time.
bool isValid() const
Returns true if the time is valid; otherwise returns false.
int msec() const
Returns the millisecond part (0 to 999) of the time.
int second() const
Returns the second part (0 to 59) of the time.
constexpr size_type size() const noexcept
const T * constData() const
void push_back(const T &t)
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
QStringList toStringList() const
Returns the variant as a QStringList if the variant has userType() \l QMetaType::QStringList,...
list append(new Employee("Blackpool", "Stephen"))
Combined button and popup list for selecting options.
constexpr bool isAsciiDigit(char32_t c) noexcept
constexpr bool isAsciiLetterOrNumber(char32_t c) noexcept
constexpr bool isAsciiUpper(char32_t c) noexcept
constexpr char toAsciiLower(char ch) noexcept
static constexpr bool q_points_into_range(const T *p, const T *b, const T *e, Cmp less={}) noexcept
constexpr Initialization Uninitialized
constexpr auto ssize(const C &c) -> std::common_type_t< std::ptrdiff_t, std::make_signed_t< decltype(c.size())> >
QT_POPCOUNT_RELAXED_CONSTEXPR uint qCountLeadingZeroBits(quint32 v) noexcept
#define Q_BASIC_ATOMIC_INITIALIZER(a)
static constexpr uchar asciiLower(uchar c)
#define QByteArrayLiteral(str)
int qstrncmp(const char *str1, const char *str2, size_t len)
size_t qstrnlen(const char *str, size_t maxlen)
#define QT_WARNING_DISABLE_GCC(text)
AudioChannelLayoutTag tag
static qsizetype digitCount(QStringView str)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
size_t qHash(const QFileSystemWatcherPathKey &key, size_t seed=0)
bool qIsFinite(qfloat16 f) noexcept
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
constexpr QtPrivate::QHashMultiReturnType< T... > qHashMulti(size_t seed, const T &... args) noexcept(std::conjunction_v< QtPrivate::QNothrowHashable< T >... >)
static Q_CONSTINIT QSystemLocale * _systemLocale
QDataStream & operator<<(QDataStream &ds, const QLocale &l)
static constexpr qsizetype locale_data_size
static QLocalePrivate * findLocalePrivate(QLocale::Language language, QLocale::Script script, QLocale::Territory territory)
static std::optional< QString > systemLocaleString(const QLocaleData *that, QSystemLocale::QueryType type)
static const QSystemLocale * systemLocale()
static bool checkParsed(QByteArrayView num, qsizetype used)
static QString rawWeekDayName(const QLocaleData *data, const int day, QLocale::FormatType type)
QDataStream & operator>>(QDataStream &ds, QLocale &l)
static Q_CONSTINIT const QLocaleData * default_data
static Q_CONSTINIT QLocaleData systemLocaleData
#define CheckCandidate(id)
static QString rawStandaloneWeekDayName(const QLocaleData *data, const int day, QLocale::FormatType type)
static QStringView findTag(QStringView name) noexcept
static bool validTag(QStringView tag)
static QLocalePrivate * c_private()
static bool isScript(QStringView tag)
static T toIntegral_helper(const QLocalePrivate *d, QStringView str, bool *ok)
static bool timeFormatContainsAP(QStringView format)
qsizetype qt_repeatCount(QStringView s)
bool qt_splitLocaleName(QStringView name, QStringView *lang, QStringView *script, QStringView *land)
static void updateSystemPrivate()
static QString rawMonthName(const QCalendarLocale &localeData, const char16_t *monthsData, int month, QLocale::FormatType type)
QString qt_readEscapedFormatString(QStringView format, qsizetype *idx)
static qsizetype findLocaleIndexById(const QLocaleId &localeId)
static const QLocaleData * defaultData()
static QString rawStandaloneMonthName(const QCalendarLocale &localeData, const char16_t *monthsData, int month, QLocale::FormatType type)
static QString localeString(const QLocaleData *that, QSystemLocale::QueryType type, QLocaleData::DataRange range)
static const QLocaleData * systemData()
static qsizetype defaultIndex()
static constexpr char16_t single_character_data[]
static constexpr char16_t days_data[]
static constexpr quint16 locale_index[]
static constexpr char16_t pm_data[]
static constexpr TerritoryLanguage ImperialMeasurementSystems[]
static constexpr QLocaleData locale_data[]
static constexpr char16_t endonyms_data[]
static constexpr QLocaleId likely_subtags[]
constexpr std::array< LanguageCodeEntry, 337 > languageCodeList
static constexpr char territory_name_list[]
static constexpr char16_t am_data[]
static constexpr char16_t currency_format_data[]
static constexpr unsigned char territory_code_list[]
static constexpr quint16 territory_name_index[]
static constexpr char language_name_list[]
static constexpr quint16 script_name_index[]
static constexpr char16_t byte_unit_data[]
static constexpr quint16 language_name_index[]
static constexpr char16_t list_pattern_part_data[]
static constexpr char16_t date_format_data[]
static constexpr char16_t currency_display_name_data[]
static constexpr char16_t time_format_data[]
static constexpr char script_name_list[]
static constexpr char16_t currency_symbol_data[]
static constexpr unsigned char script_code_list[]
bool qt_splitLocaleName(QStringView name, QStringView *lang=nullptr, QStringView *script=nullptr, QStringView *cntry=nullptr)
constexpr bool ascii_isspace(uchar c)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
constexpr T qAbs(const T &t)
GLsizei const GLfloat * v
[13]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat z
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei length
GLenum GLuint GLenum GLsizei const GLchar * buf
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei GLsizei GLenum format
GLenum GLint GLint * precision
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
static bool operator<(const QSettingsIniKey &k1, const QSettingsIniKey &k2)
static constexpr QChar sep
static ISC_DATE toDate(QDate t)
static ISC_TIME toTime(QTime t)
#define QStringLiteral(str)
QStringView qToStringViewIgnoringNull(const QStringLike &s) noexcept
#define QT_BEGIN_INCLUDE_NAMESPACE
#define QT_END_INCLUDE_NAMESPACE
static int compare(quint64 a, quint64 b)
unsigned long long quint64
QT_END_NAMESPACE typedef QT_PREPEND_NAMESPACE(quintptr) WId
static QByteArray getData(int cf, IDataObject *pDataObj, int lindex=-1)
static QString getString(IMFActivate *device, const IID &id)
QTextStream out(stdout)
[7]
std::array< char, 4 > decode() const
bool isValid(NumberMode mode) const
static quint64 bytearrayToUnsLongLong(QByteArrayView num, int base, bool *ok)
QString positiveSign() const
static float convertDoubleToFloat(double d, bool *ok)
QString groupSeparator() const
QString zeroDigit() const
bool numberToCLocale(QStringView s, QLocale::NumberOptions number_options, NumberMode mode, CharBuff *result) const
QString decimalPoint() const
QString doubleToString(double d, int precision=-1, DoubleForm form=DFSignificantDigits, int width=-1, unsigned flags=NoFlags) const
static const QLocaleData * c()
QString listSeparator() const
static qsizetype findLocaleIndex(QLocaleId localeId)
quint64 stringToUnsLongLong(QStringView str, int base, bool *ok, QLocale::NumberOptions options) const
qint64 stringToLongLong(QStringView str, int base, bool *ok, QLocale::NumberOptions options) const
QString percentSign() const
Q_CORE_EXPORT bool validateChars(QStringView str, NumberMode numMode, QByteArray *buff, int decDigits=-1, QLocale::NumberOptions number_options=QLocale::DefaultNumberOptions) const
double stringToDouble(QStringView str, bool *ok, QLocale::NumberOptions options) const
QString longLongToString(qint64 l, int precision=-1, int base=10, int width=-1, unsigned flags=NoFlags) const
quint8 m_first_day_of_week
NumericData numericData(NumberMode mode) const
QString exponentSeparator() const
QString negativeSign() const
static Q_CORE_EXPORT qint64 bytearrayToLongLong(QByteArrayView num, int base, bool *ok)
QString unsLongLongToString(quint64 l, int precision=-1, int base=10, int width=-1, unsigned flags=NoFlags) const
QLocaleId withLikelySubtagsRemoved() const
bool acceptLanguage(quint16 lang) const
bool acceptScriptTerritory(QLocaleId other) const
QLocaleId withLikelySubtagsAdded() const
Fill in blank fields of a locale ID.
QByteArray name(char separator='-') const
static Q_AUTOTEST_EXPORT QLocaleId fromName(QStringView name)