4#ifndef QLOCALE_TOOLS_P_H
5#define QLOCALE_TOOLS_P_H
21#if !defined(QT_SUPPORTS_INT128) && (defined(Q_CC_MSVC) && (_MSC_VER >= 1930
) && __has_include(<__msvc_int128.hpp>))
22#include <__msvc_int128.hpp>
23#define QT_USE_MSVC_INT128
28#if defined(QT_SUPPORTS_INT128)
29using qinternalint128 = qint128;
30using qinternaluint128 = quint128;
31#elif defined(QT_USE_MSVC_INT128)
32using qinternalint128 = std::_Signed128;
33using qinternaluint128 = std::_Unsigned128;
47 char *buf, qsizetype bufSize,
48 bool &sign,
int &length,
int &decpt);
50[[nodiscard]] QString
qulltoBasicLatin(qulonglong l,
int base,
bool negative);
51[[nodiscard]] QString
qulltoa(qulonglong l,
int base,
const QStringView zero);
52[[nodiscard]]
char *
qulltoa2(
char *p, qulonglong n,
int base);
53[[nodiscard]] Q_CORE_EXPORT
QString qdtoa(qreal d,
int *decpt,
int *sign);
55 int precision,
bool uppercase);
57 int precision,
bool uppercase);
59#if defined(QT_SUPPORTS_INT128) || defined(QT_USE_MSVC_INT128)
60[[nodiscard]] Q_CORE_EXPORT QString quint128toBasicLatin(qinternaluint128 number,
62[[nodiscard]] Q_CORE_EXPORT QString qint128toBasicLatin(qinternalint128 number,
66#if QT_VERSION < QT_VERSION_CHECK(6
, 12
, 0
)
67[[deprecated(
"Use qIsNull(double) instead.")]]
68[[nodiscard]]
constexpr inline bool isZero(
double d)
80 return d > (1 << 19) ?
std::numeric_limits<
double>::max_exponent10 + 1 : 6;
84template <
typename UcsInt>
93 if (zero == u'\u3007')
94 return u'\u3020' + digit;
101[[nodiscard]] Q_CORE_EXPORT
double qstrntod(
const char *s00, qsizetype len,
102 char const **se,
bool *ok);
103[[nodiscard]]
inline double qstrtod(
const char *s00,
char const **se,
bool *ok)
105 qsizetype len = qsizetype(strlen(s00));
106 return qstrntod(s00, len, se, ok);
109[[nodiscard]] Q_AUTOTEST_EXPORT
110QSimpleParsedNumber<qlonglong> qstrntoll(
const char *nptr, qsizetype size,
int base);
QDataStream & operator>>(QDataStream &in, QByteArray &ba)
Reads a byte array into ba from the stream in and returns a reference to the stream.
quint16 qChecksum(QByteArrayView data, Qt::ChecksumType standard)
static QLatin1StringView scriptToCode(QLocale::Script script)
QString toUpper(const QString &str, bool *ok) const
static const QLocalePrivate * get(const QLocale &l)
QString toLower(const QString &str, bool *ok) const
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
qsizetype fallbackLocaleIndex() const
@ StringToAlternateQuotation
@ StandaloneMonthNameLong
@ StandaloneDayNameNarrow
@ StandaloneMonthNameNarrow
@ StringToStandardQuotation
@ StandaloneMonthNameShort
virtual QLocale fallbackLocale() const
virtual QVariant query(QueryType type, QVariant &&in=QVariant()) const
Combined button and popup list for selecting options.
constexpr char ascii_space_chars[]
constexpr auto makeCharacterSetMatch() noexcept
static constexpr bool isLowerCaseAscii(char c)
static const quint16 crc_tbl[16]
QByteArray qCompress(const uchar *data, qsizetype nbytes, int compressionLevel)
static Q_DECL_COLD_FUNCTION const char * zlibOpAsString(ZLibOp op)
static QByteArray toCase_template(T &input, uchar(*lookup)(uchar))
static void q_fromPercentEncoding(QByteArray *ba, char percent)
int qstrnicmp(const char *str1, qsizetype len1, const char *str2, qsizetype len2)
static qsizetype lastIndexOfHelper(const char *haystack, qsizetype l, const char *needle, qsizetype ol, qsizetype from)
static constexpr bool isUpperCaseAscii(char c)
static QByteArray xxflate(ZLibOp op, QArrayDataPointer< char > out, QByteArrayView input, qxp::function_ref< int(z_stream *) const > init, qxp::function_ref< int(z_stream *, size_t) const > processChunk, qxp::function_ref< void(z_stream *) const > deinit)
static constexpr uchar asciiLower(uchar c)
static qsizetype countCharHelper(QByteArrayView haystack, char needle) noexcept
static constexpr uchar asciiUpper(uchar c)
Q_CORE_EXPORT char * qstrncpy(char *dst, const char *src, size_t len)
Q_CORE_EXPORT int qstrnicmp(const char *, const char *, size_t len)
Q_CORE_EXPORT int qstricmp(const char *, const char *)
Q_CORE_EXPORT char * qstrdup(const char *)
Q_CORE_EXPORT char * qstrcpy(char *dst, const char *src)
Q_DECL_PURE_FUNCTION Q_CORE_EXPORT const void * qmemrchr(const void *s, int needle, size_t n) noexcept
Q_CORE_EXPORT int qstrcmp(const char *str1, const char *str2)
bool qt_splitLocaleName(QStringView name, QStringView *lang=nullptr, QStringView *script=nullptr, QStringView *cntry=nullptr) noexcept
Q_DECLARE_TYPEINFO(QLocaleData::GroupSizes, Q_PRIMITIVE_TYPE)
Q_DECLARE_TYPEINFO(QLocaleId, Q_PRIMITIVE_TYPE)
qsizetype qt_repeatCount(QStringView s) noexcept
constexpr bool ascii_isspace(uchar c) noexcept
#define ForEachQLocaleRange(X)
QString qt_readEscapedFormatString(QStringView format, qsizetype *idx)
constexpr size_t qHash(const QSize &s, size_t seed=0) noexcept
static constexpr int MaxRange
constexpr bool matches(uchar c) const noexcept
constexpr QCharacterSetMatch(std::string_view set) noexcept
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
QString positiveSign() const
static float convertDoubleToFloat(double d, bool *ok)
QString groupSeparator() const
QSimpleParsedNumber< qint64 > stringToLongLong(QStringView str, int base, QLocale::NumberOptions options) 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 Q_AUTOTEST_EXPORT bool allLocaleDataRows(bool(*check)(qsizetype, const QLocaleData &))
QString listSeparator() const
static QSimpleParsedNumber< quint64 > bytearrayToUnsLongLong(QByteArrayView num, int base)
QString percentSign() 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
quint8 m_currency_rounding
QString exponentSeparator() const
static qsizetype findLocaleIndex(QLocaleId localeId) noexcept
QString negativeSign() const
static const QLocaleData * c() noexcept
QSimpleParsedNumber< quint64 > stringToUnsLongLong(QStringView str, int base, QLocale::NumberOptions options) const
QString unsLongLongToString(quint64 l, int precision=-1, int base=10, int width=-1, unsigned flags=NoFlags) const
QLocaleId withLikelySubtagsAdded() const noexcept
Fill in blank fields of a locale ID.
QLocaleId withLikelySubtagsRemoved() const noexcept
bool operator==(QLocaleId other) const noexcept
bool matchesAll() const noexcept
bool isValid() const noexcept
bool operator!=(QLocaleId other) const noexcept
bool acceptScriptTerritory(QLocaleId other) const noexcept
bool acceptLanguage(quint16 lang) const noexcept
QByteArray name(char separator='-') const
CurrencyToStringArgument(const QVariant &v, const QString &s)
CurrencyToStringArgument()