21#include <QtCore/private/qglobal_p.h>
22#include <QtCore/qcalendar.h>
23#include <QtCore/qlist.h>
24#include <QtCore/qnumeric.h>
25#include <QtCore/qstring.h>
26#include <QtCore/qvariant.h>
27#include <QtCore/qvarlengtharray.h>
37 static constexpr int MaxRange = std::numeric_limits<MaskType>::digits;
44 int idx =
uchar(
c) - Lowest;
45 mask |= MaskType(1) << idx;
51 unsigned idx =
c - Lowest;
54 return (
mask >> idx) & 1;
67template <
const char *Set,
int ForcedLowest = -1>
70 constexpr auto view = std::string_view(Set);
71 constexpr uchar MinElement = *std::min_element(
view.begin(),
view.end());
72 constexpr uchar MaxElement = *std::max_element(
view.begin(),
view.end());
73 constexpr int Range = MaxElement - MinElement;
74 static_assert(Range < 64,
"Characters in the set are 64 or more values apart");
76 if constexpr (ForcedLowest >= 0) {
78 static_assert(ForcedLowest <= int(MinElement),
"The force is not with you");
79 using MaskType = std::conditional_t<MaxElement - ForcedLowest < 32, quint32, quint64>;
81 }
else if constexpr (MaxElement < std::numeric_limits<qregisteruint>::digits) {
84 using MaskType = std::conditional_t<(MaxElement < 32), quint32, qregisteruint>;
87 using MaskType = std::conditional_t<(Range < 32), quint32, quint64>;
158 StandaloneDayNameNarrow
162 virtual QLocale fallbackLocale()
const;
163 inline qsizetype fallbackLocaleIndex()
const;
252 PMDecimalDigits = 0x01,
253 PMSignificantDigits = 0x02,
254 PMChopTrailingZeros = 0x03
258 PrecisionMode pm,
bool mustMarkDecimal,
259 bool groupDigits)
const;
261 PrecisionMode pm,
bool mustMarkDecimal,
262 int minExponentDigits)
const;
263 [[nodiscard]]
QString signPrefix(
bool negative,
unsigned flags)
const;
287 if (std::fabs(
d) > (std::numeric_limits<float>::max)()) {
290 const float huge = std::numeric_limits<float>::infinity();
291 return d < 0 ? -huge : huge;
293 if (
d != 0 &&
float(
d) == 0) {
303 QLocale::NumberOptions options)
const;
305 QLocale::NumberOptions options)
const;
307 QLocale::NumberOptions options)
const;
319#ifndef QT_NO_SYSTEMLOCALE
332 switch (
zero.size()) {
370 {
return QLocaleId { m_language_id, m_script_id, m_territory_id }; }
377 [[nodiscard]]
char32_t zeroUcs()
const;
415 const char16_t separator =
';';
429#define ForEachQLocaleRange(X) \
430 X(startListPattern) X(midListPattern) X(endListPattern) X(pairListPattern) X(listDelimit) \
431 X(decimalSeparator) X(groupDelim) X(percent) X(zero) X(minus) X(plus) X(exponential) \
432 X(quoteStart) X(quoteEnd) X(quoteStartAlternate) X(quoteEndAlternate) \
433 X(longDateFormat) X(shortDateFormat) X(longTimeFormat) X(shortTimeFormat) \
434 X(longDayNamesStandalone) X(longDayNames) \
435 X(shortDayNamesStandalone) X(shortDayNames) \
436 X(narrowDayNamesStandalone) X(narrowDayNames) \
437 X(anteMeridiem) X(postMeridiem) \
438 X(byteCount) X(byteAmountSI) X(byteAmountIEC) \
439 X(currencySymbol) X(currencyDisplayName) \
440 X(currencyFormat) X(currencyFormatNegative) \
441 X(endonymLanguage) X(endonymTerritory)
443#define rangeGetter(name) \
444 [[nodiscard]] DataRange name() const { return { m_ ## name ## _idx, m_ ## name ## _size }; }
449 quint16 m_language_id, m_script_id, m_territory_id;
452#define rangeIndex(name) quint16 m_ ## name ## _idx;
455#define Size(name) quint8 m_ ## name ## _size;
459#undef ForEachQLocaleRange
462 char m_currency_iso_code[3];
487 [[nodiscard]]
inline std::array<char, 4>
498 [[nodiscard]]
static std::array<char, 4>
520#ifndef QT_NO_SYSTEMLOCALE
541 constexpr auto matcher = QtPrivate::makeCharacterSetMatch<QtPrivate::ascii_space_chars>();
549#ifndef QT_NO_SYSTEMLOCALE
551 QSystemLocale__CurrencyToStringArgument, Q_CORE_EXPORT)
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.
constexpr bool isSurrogate() const noexcept
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 ...
static QLatin1StringView scriptToCode(QLocale::Script script)
static const QLocalePrivate * get(const QLocale &l)
quint16 languageId() const
static QLocale::Language codeToLanguage(QStringView code, QLocale::LanguageCodeTypes codeTypes=QLocale::AnyLanguageCode) noexcept
const QLocaleData *const m_data
QLatin1StringView scriptCode() const
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
constexpr QLocalePrivate(const QLocaleData *data, qsizetype index, QLocale::NumberOptions numberOptions=QLocale::DefaultNumberOptions, int refs=0)
std::array< char, 4 > languageCode(QLocale::LanguageCodeTypes codeTypes=QLocale::AnyLanguageCode) const
static QBasicAtomicInt s_generation
QByteArray bcp47Name(char separator='-') const
constexpr bool isEmpty() const noexcept
Returns whether this string view is empty - that is, whether {size() == 0}.
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromRawData(const QChar *, qsizetype size)
Constructs a QString that uses the first size Unicode characters in the array unicode.
qsizetype fallbackLocaleIndex() const
@ StringToAlternateQuotation
@ StandaloneMonthNameLong
@ StandaloneMonthNameNarrow
@ StringToStandardQuotation
@ StandaloneMonthNameShort
virtual QLocale fallbackLocale() const
Combined button and popup list for selecting options.
constexpr char ascii_space_chars[]
constexpr auto makeCharacterSetMatch()
#define Q_BASIC_ATOMIC_INITIALIZER(a)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qIsInf(qfloat16 f) noexcept
bool qt_splitLocaleName(QStringView name, QStringView *lang=nullptr, QStringView *script=nullptr, QStringView *cntry=nullptr)
#define rangeGetter(name)
qsizetype qt_repeatCount(QStringView s)
#define ForEachQLocaleRange(X)
QString qt_readEscapedFormatString(QStringView format, qsizetype *idx)
constexpr bool ascii_isspace(uchar c)
GLsizei const GLfloat * v
[13]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLint GLsizei GLsizei GLenum format
GLenum GLenum GLsizei void * table
GLenum GLint GLint * precision
#define Q_AUTOTEST_EXPORT
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
unsigned long long quint64
QT_BEGIN_NAMESPACE typedef signed char qint8
QFuture< QSet< QChar > > set
[10]
static const auto matcher
[0]
constexpr bool matches(uchar c) const
static constexpr int MaxRange
constexpr QCharacterSetMatch(std::string_view set)
QStringView viewListEntry(const char16_t *table, qsizetype index) const
char32_t ucsFirst(const char16_t *table) const
QString getData(const char16_t *table) const
QString getListEntry(const char16_t *table, qsizetype index) const
QStringView viewData(const char16_t *table) const
void setZero(QStringView zero)
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
ForEachQLocaleRange(rangeIndex) ForEachQLocaleRange(Size) char m_currency_iso_code[3]
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
quint8 m_currency_rounding
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
bool operator==(QLocaleId other) const
QLocaleId withLikelySubtagsRemoved() const
bool operator!=(QLocaleId other) const
bool acceptLanguage(quint16 lang) const
bool acceptScriptTerritory(QLocaleId other) const
QLocaleId withLikelySubtagsAdded() const
Fill in blank fields of a locale ID.
static Q_AUTOTEST_EXPORT QLocaleId fromName(QStringView name)
CurrencyToStringArgument(const QVariant &v, const QString &s)
CurrencyToStringArgument()