QtBase  v6.3.1
qlocale_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2021 The Qt Company Ltd.
4 ** Copyright (C) 2016 Intel Corporation.
5 ** Contact: https://www.qt.io/licensing/
6 **
7 ** This file is part of the QtCore module of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** Commercial License Usage
11 ** Licensees holding valid commercial Qt licenses may use this file in
12 ** accordance with the commercial license agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and The Qt Company. For licensing terms
15 ** and conditions see https://www.qt.io/terms-conditions. For further
16 ** information use the contact form at https://www.qt.io/contact-us.
17 **
18 ** GNU Lesser General Public License Usage
19 ** Alternatively, this file may be used under the terms of the GNU Lesser
20 ** General Public License version 3 as published by the Free Software
21 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
22 ** packaging of this file. Please review the following information to
23 ** ensure the GNU Lesser General Public License version 3 requirements
24 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
25 **
26 ** GNU General Public License Usage
27 ** Alternatively, this file may be used under the terms of the GNU
28 ** General Public License version 2.0 or (at your option) the GNU General
29 ** Public license version 3 or any later version approved by the KDE Free
30 ** Qt Foundation. The licenses are as published by the Free Software
31 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
32 ** included in the packaging of this file. Please review the following
33 ** information to ensure the GNU General Public License requirements will
34 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
35 ** https://www.gnu.org/licenses/gpl-3.0.html.
36 **
37 ** $QT_END_LICENSE$
38 **
39 ****************************************************************************/
40 
41 #ifndef QLOCALE_P_H
42 #define QLOCALE_P_H
43 
44 //
45 // W A R N I N G
46 // -------------
47 //
48 // This file is not part of the Qt API. It exists for the convenience
49 // of internal files. This header file may change from version to version
50 // without notice, or even be removed.
51 //
52 // We mean it.
53 //
54 
55 #include <QtCore/private/qglobal_p.h>
56 #include "QtCore/qstring.h"
57 #include "QtCore/qvarlengtharray.h"
58 #include "QtCore/qvariant.h"
59 #include "QtCore/qnumeric.h"
60 #include <QtCore/qcalendar.h>
61 
62 #include "qlocale.h"
63 
64 #include <limits>
65 #include <cmath>
66 
68 
69 #ifndef QT_NO_SYSTEMLOCALE
70 struct QLocaleData;
71 // Subclassed by Android platform plugin:
72 class Q_CORE_EXPORT QSystemLocale
73 {
74 public:
75  QSystemLocale();
76  virtual ~QSystemLocale();
77 
79  {
82  : value(v), symbol(s) { }
85  };
86 
87  enum QueryType {
88  LanguageId, // uint
89  TerritoryId, // uint
90  DecimalPoint, // QString
91  GroupSeparator, // QString (empty QString means: don't group digits)
92  ZeroDigit, // QString
93  NegativeSign, // QString
94  DateFormatLong, // QString
95  DateFormatShort, // QString
96  TimeFormatLong, // QString
97  TimeFormatShort, // QString
98  DayNameLong, // QString, in: int
99  DayNameShort, // QString, in: int
100  DayNameNarrow, // QString, in: int
101  MonthNameLong, // QString, in: int
102  MonthNameShort, // QString, in: int
103  MonthNameNarrow, // QString, in: int
104  DateToStringLong, // QString, in: QDate
105  DateToStringShort, // QString in: QDate
106  TimeToStringLong, // QString in: QTime
107  TimeToStringShort, // QString in: QTime
108  DateTimeFormatLong, // QString
110  DateTimeToStringLong, // QString in: QDateTime
111  DateTimeToStringShort, // QString in: QDateTime
113  PositiveSign, // QString
114  AMText, // QString
115  PMText, // QString
116  FirstDayOfWeek, // Qt::DayOfWeek
117  Weekdays, // QList<Qt::DayOfWeek>
118  CurrencySymbol, // QString in: CurrencyToStringArgument
119  CurrencyToString, // QString in: qlonglong, qulonglong or double
120  Collation, // QString
121  UILanguages, // QStringList
122  StringToStandardQuotation, // QString in: QStringView to quote
123  StringToAlternateQuotation, // QString in: QStringView to quote
124  ScriptId, // uint
126  LocaleChanged, // system locale changed
127  NativeLanguageName, // QString
129  StandaloneMonthNameLong, // QString, in: int
130  StandaloneMonthNameShort, // QString, in: int
131  StandaloneMonthNameNarrow, // QString, in: int
132  StandaloneDayNameLong, // QString, in: int
133  StandaloneDayNameShort, // QString, in: int
134  StandaloneDayNameNarrow // QString, in: int
135  };
136  virtual QVariant query(QueryType type, QVariant in = QVariant()) const;
137 
138  virtual QLocale fallbackLocale() const;
139  inline uint fallbackLocaleIndex() const;
140 private:
141  QSystemLocale(bool);
143 };
146 #endif
147 
148 #if QT_CONFIG(icu)
149 namespace QIcu {
150  QString toUpper(const QByteArray &localeId, const QString &str, bool *ok);
151  QString toLower(const QByteArray &localeId, const QString &str, bool *ok);
152 }
153 #endif
154 
155 
156 struct QLocaleId
157 {
158  [[nodiscard]] static QLocaleId fromName(QStringView name);
159  [[nodiscard]] inline bool operator==(QLocaleId other) const
160  { return language_id == other.language_id && script_id == other.script_id && territory_id == other.territory_id; }
161  [[nodiscard]] inline bool operator!=(QLocaleId other) const
162  { return !operator==(other); }
163  [[nodiscard]] inline bool isValid() const
164  {
167  }
168  [[nodiscard]] inline bool matchesAll() const
169  {
170  return !language_id && !script_id && !territory_id;
171  }
172  // Use as: filter.accept...(candidate)
173  [[nodiscard]] inline bool acceptLanguage(quint16 lang) const
174  {
175  // Always reject AnyLanguage (only used for last entry in locale_data array).
176  // So, when searching for AnyLanguage, accept everything *but* AnyLanguage.
177  return language_id ? lang == language_id : lang;
178  }
179  [[nodiscard]] inline bool acceptScriptTerritory(QLocaleId other) const
180  {
181  return (!territory_id || other.territory_id == territory_id)
182  && (!script_id || other.script_id == script_id);
183  }
184 
185  [[nodiscard]] QLocaleId withLikelySubtagsAdded() const;
186  [[nodiscard]] QLocaleId withLikelySubtagsRemoved() const;
187 
188  [[nodiscard]] QByteArray name(char separator = '-') const;
189 
191 };
193 
195 {
196 public:
197  // Having an index for each locale enables us to have diverse sources of
198  // data, e.g. calendar locales, as well as the main CLDR-derived data.
199  [[nodiscard]] static int findLocaleIndex(QLocaleId localeId);
200  [[nodiscard]] static const QLocaleData *c();
201 
202  enum DoubleForm {
207  };
208 
209  enum Flags {
210  NoFlags = 0,
212  ZeroPadded = 0x02,
213  LeftAdjusted = 0x04,
216  GroupDigits = 0x20,
217  CapitalEorX = 0x40,
218 
219  ShowBase = 0x80,
220  UppercaseBase = 0x100,
222  ForcePoint = 0x400
223  };
224 
226 
228 
229 private:
230  enum PrecisionMode {
231  PMDecimalDigits = 0x01,
232  PMSignificantDigits = 0x02,
233  PMChopTrailingZeros = 0x03
234  };
235 
236  [[nodiscard]] QString decimalForm(QString &&digits, int decpt, int precision,
237  PrecisionMode pm, bool mustMarkDecimal,
238  bool groupDigits) const;
239  [[nodiscard]] QString exponentForm(QString &&digits, int decpt, int precision,
240  PrecisionMode pm, bool mustMarkDecimal,
241  int minExponentDigits) const;
242  [[nodiscard]] QString signPrefix(bool negative, unsigned flags) const;
243  [[nodiscard]] QString applyIntegerFormatting(QString &&numStr, bool negative, int precision,
244  int base, int width, unsigned flags) const;
245 
246 public:
247  [[nodiscard]] QString doubleToString(double d,
248  int precision = -1,
250  int width = -1,
251  unsigned flags = NoFlags) const;
252  [[nodiscard]] QString longLongToString(qint64 l, int precision = -1,
253  int base = 10,
254  int width = -1,
255  unsigned flags = NoFlags) const;
256  [[nodiscard]] QString unsLongLongToString(quint64 l, int precision = -1,
257  int base = 10,
258  int width = -1,
259  unsigned flags = NoFlags) const;
260 
261  // this function is meant to be called with the result of stringToDouble or bytearrayToDouble
262  [[nodiscard]] static float convertDoubleToFloat(double d, bool *ok)
263  {
264  if (qIsInf(d))
265  return float(d);
266  if (std::fabs(d) > (std::numeric_limits<float>::max)()) {
267  if (ok)
268  *ok = false;
269  const float huge = std::numeric_limits<float>::infinity();
270  return d < 0 ? -huge : huge;
271  }
272  if (d != 0 && float(d) == 0) {
273  // Values that underflow double already failed. Match them:
274  if (ok)
275  *ok = false;
276  return 0;
277  }
278  return float(d);
279  }
280 
281  [[nodiscard]] double stringToDouble(QStringView str, bool *ok,
282  QLocale::NumberOptions options) const;
283  [[nodiscard]] qint64 stringToLongLong(QStringView str, int base, bool *ok,
284  QLocale::NumberOptions options) const;
285  [[nodiscard]] quint64 stringToUnsLongLong(QStringView str, int base, bool *ok,
286  QLocale::NumberOptions options) const;
287 
288  // this function is used in QIntValidator (QtGui)
289  [[nodiscard]] Q_CORE_EXPORT static qint64 bytearrayToLongLong(QByteArrayView num, int base,
290  bool *ok);
291  [[nodiscard]] static quint64 bytearrayToUnsLongLong(QByteArrayView num, int base, bool *ok);
292 
293  [[nodiscard]] bool numberToCLocale(QStringView s, QLocale::NumberOptions number_options,
294  CharBuff *result) const;
295  [[nodiscard]] inline char numericToCLocale(QStringView in) const;
296 
297  // this function is used in QIntValidator (QtGui)
298  [[nodiscard]] Q_CORE_EXPORT bool validateChars(
299  QStringView str, NumberMode numMode, QByteArray *buff, int decDigits = -1,
300  QLocale::NumberOptions number_options = QLocale::DefaultNumberOptions) const;
301 
302  // Access to assorted data members:
303  [[nodiscard]] QLocaleId id() const
304  { return QLocaleId { m_language_id, m_script_id, m_territory_id }; }
305 
306  [[nodiscard]] QString decimalPoint() const;
307  [[nodiscard]] QString groupSeparator() const;
308  [[nodiscard]] QString listSeparator() const;
309  [[nodiscard]] QString percentSign() const;
310  [[nodiscard]] QString zeroDigit() const;
311  [[nodiscard]] char32_t zeroUcs() const;
312  [[nodiscard]] QString positiveSign() const;
313  [[nodiscard]] QString negativeSign() const;
314  [[nodiscard]] QString exponentSeparator() const;
315 
316  struct DataRange
317  {
320  [[nodiscard]] QString getData(const char16_t *table) const
321  {
322  return size > 0
323  ? QString::fromRawData(reinterpret_cast<const QChar *>(table + offset), size)
324  : QString();
325  }
326  [[nodiscard]] QStringView viewData(const char16_t *table) const
327  {
328  return { reinterpret_cast<const QChar *>(table + offset), size };
329  }
330  [[nodiscard]] QString getListEntry(const char16_t *table, int index) const
331  {
332  return listEntry(table, index).getData(table);
333  }
334  [[nodiscard]] QStringView viewListEntry(const char16_t *table, int index) const
335  {
336  return listEntry(table, index).viewData(table);
337  }
338  [[nodiscard]] char32_t ucsFirst(const char16_t *table) const
339  {
341  return table[offset];
344  return 0;
345  }
346  private:
347  [[nodiscard]] DataRange listEntry(const char16_t *table, int index) const
348  {
349  const char16_t separator = ';';
350  quint16 i = 0;
351  while (index > 0 && i < size) {
352  if (table[offset + i] == separator)
353  index--;
354  i++;
355  }
356  quint16 end = i;
357  while (end < size && table[offset + end] != separator)
358  end++;
359  return { quint16(offset + i), quint16(end - i) };
360  }
361  };
362 
363 #define ForEachQLocaleRange(X) \
364  X(startListPattern) X(midListPattern) X(endListPattern) X(pairListPattern) X(listDelimit) \
365  X(decimalSeparator) X(groupDelim) X(percent) X(zero) X(minus) X(plus) X(exponential) \
366  X(quoteStart) X(quoteEnd) X(quoteStartAlternate) X(quoteEndAlternate) \
367  X(longDateFormat) X(shortDateFormat) X(longTimeFormat) X(shortTimeFormat) \
368  X(longDayNamesStandalone) X(longDayNames) \
369  X(shortDayNamesStandalone) X(shortDayNames) \
370  X(narrowDayNamesStandalone) X(narrowDayNames) \
371  X(anteMeridiem) X(postMeridiem) \
372  X(byteCount) X(byteAmountSI) X(byteAmountIEC) \
373  X(currencySymbol) X(currencyDisplayName) \
374  X(currencyFormat) X(currencyFormatNegative) \
375  X(endonymLanguage) X(endonymTerritory)
376 
377 #define rangeGetter(name) \
378  [[nodiscard]] DataRange name() const { return { m_ ## name ## _idx, m_ ## name ## _size }; }
380 #undef rangeGetter
381 
382 public:
383  quint16 m_language_id, m_script_id, m_territory_id;
384 
385  // Offsets, then sizes, for each range:
386 #define rangeIndex(name) quint16 m_ ## name ## _idx;
388 #undef rangeIndex
389 #define Size(name) quint8 m_ ## name ## _size;
391 #undef Size
392 
393 #undef ForEachQLocaleRange
394 
395  // Strays:
396  char m_currency_iso_code[3];
398  quint8 m_currency_rounding : 3; // (not yet used !)
402  quint8 m_grouping_top : 2; // Must have this many before the first grouping separator
403  quint8 m_grouping_higher : 3; // Number of digits between grouping separators
404  quint8 m_grouping_least : 3; // Number of digits after last grouping separator (before decimal).
405 };
406 
408 {
409 public:
410  constexpr QLocalePrivate(const QLocaleData *data, const uint index,
411  QLocale::NumberOptions numberOptions = QLocale::DefaultNumberOptions,
412  int refs = 0)
414  m_index(index), m_numberOptions(numberOptions) {}
415 
416  [[nodiscard]] quint16 languageId() const { return m_data->m_language_id; }
417  [[nodiscard]] quint16 territoryId() const { return m_data->m_territory_id; }
418 
419  [[nodiscard]] QByteArray bcp47Name(char separator = '-') const;
420 
421  [[nodiscard]] inline QLatin1String
422  languageCode(QLocale::LanguageCodeTypes codeTypes = QLocale::AnyLanguageCode) const
423  {
424  return languageToCode(QLocale::Language(m_data->m_language_id), codeTypes);
425  }
426  [[nodiscard]] inline QLatin1String scriptCode() const
427  { return scriptToCode(QLocale::Script(m_data->m_script_id)); }
428  [[nodiscard]] inline QLatin1String territoryCode() const
429  { return territoryToCode(QLocale::Territory(m_data->m_territory_id)); }
430 
431  [[nodiscard]] static const QLocalePrivate *get(const QLocale &l) { return l.d; }
432  [[nodiscard]] static QLatin1String
434  QLocale::LanguageCodeTypes codeTypes = QLocale::AnyLanguageCode);
435  [[nodiscard]] static QLatin1String scriptToCode(QLocale::Script script);
436  [[nodiscard]] static QLatin1String territoryToCode(QLocale::Territory territory);
437  [[nodiscard]] static QLocale::Language
439  QLocale::LanguageCodeTypes codeTypes = QLocale::AnyLanguageCode) noexcept;
440  [[nodiscard]] static QLocale::Script codeToScript(QStringView code) noexcept;
441  [[nodiscard]] static QLocale::Territory codeToTerritory(QStringView code) noexcept;
442 
443  [[nodiscard]] QLocale::MeasurementSystem measurementSystem() const;
444 
445  // System locale has an m_data all its own; all others have m_data = locale_data + m_index
446  const QLocaleData *const m_data;
448  const uint m_index;
449  QLocale::NumberOptions m_numberOptions;
450 
452 };
453 
454 #ifndef QT_NO_SYSTEMLOCALE
456 #endif
457 
458 template <>
460 {
461  // cannot use QLocalePrivate's copy constructor
462  // since it is deleted in C++11
463  return new QLocalePrivate(d->m_data, d->m_index, d->m_numberOptions);
464 }
465 
467 {
468  Q_ASSERT(in.size() == 1 || (in.size() == 2 && in.at(0).isHighSurrogate()));
469 
470  if (in == positiveSign() || in == u"+")
471  return '+';
472 
473  if (in == negativeSign() || in == u"-" || in == u"\x2212")
474  return '-';
475 
476  if (in == decimalPoint())
477  return '.';
478 
479  if (in.compare(exponentSeparator(), Qt::CaseInsensitive) == 0)
480  return 'e';
481 
482  const QString group = groupSeparator();
483  if (in == group)
484  return ',';
485 
486  // In several languages group() is a non-breaking space (U+00A0) or its thin
487  // version (U+202f), which look like spaces. People (and thus some of our
488  // tests) use a regular space instead and complain if it doesn't work.
489  // Should this be extended generally to any case where group is a space ?
490  if ((group == u"\xa0" || group == u"\x202f") && in == u" ")
491  return ',';
492 
493  const char32_t inUcs4 = in.size() == 2
494  ? QChar::surrogateToUcs4(in.at(0), in.at(1)) : in.at(0).unicode();
495  const char32_t zeroUcs4 = zeroUcs();
496  // Must match qlocale_tools.h's unicodeForDigit()
497  if (zeroUcs4 == u'\u3007') {
498  // QTBUG-85409: Suzhou's digits aren't contiguous !
499  if (inUcs4 == zeroUcs4)
500  return '0';
501  if (inUcs4 > u'\u3020' && inUcs4 <= u'\u3029')
502  return inUcs4 - u'\u3020';
503  } else if (zeroUcs4 <= inUcs4 && inUcs4 < zeroUcs4 + 10) {
504  return '0' + inUcs4 - zeroUcs4;
505  }
506  if ('0' <= inUcs4 && inUcs4 <= '9')
507  return inUcs4;
508 
509  return 0;
510 }
511 
512 // Also used to merely skip over an escape in a format string, advancint idx to
513 // point after it (so not [[nodiscard]]):
515 [[nodiscard]] bool qt_splitLocaleName(QStringView name, QStringView *lang = nullptr,
516  QStringView *script = nullptr, QStringView *cntry = nullptr);
517 [[nodiscard]] int qt_repeatCount(QStringView s);
518 
519 enum { AsciiSpaceMask = (1u << (' ' - 1)) |
520  (1u << ('\t' - 1)) | // 9: HT - horizontal tab
521  (1u << ('\n' - 1)) | // 10: LF - line feed
522  (1u << ('\v' - 1)) | // 11: VT - vertical tab
523  (1u << ('\f' - 1)) | // 12: FF - form feed
524  (1u << ('\r' - 1)) }; // 13: CR - carriage return
525 [[nodiscard]] constexpr inline bool ascii_isspace(uchar c)
526 {
527  return c >= 1u && c <= 32u && (AsciiSpaceMask >> uint(c - 1)) & 1u;
528 }
529 
530 static_assert(ascii_isspace(' '));
531 static_assert(ascii_isspace('\t'));
532 static_assert(ascii_isspace('\n'));
533 static_assert(ascii_isspace('\v'));
534 static_assert(ascii_isspace('\f'));
535 static_assert(ascii_isspace('\r'));
536 static_assert(!ascii_isspace('\0'));
537 static_assert(!ascii_isspace('\a'));
538 static_assert(!ascii_isspace('a'));
539 static_assert(!ascii_isspace('\177'));
540 static_assert(!ascii_isspace(uchar('\200')));
541 static_assert(!ascii_isspace(uchar('\xA0')));
542 static_assert(!ascii_isspace(uchar('\377')));
543 
545 
548 #ifndef QT_NO_SYSTEMLOCALE
550 #endif
551 
552 #endif // QLOCALE_P_H
small capitals from c petite p scientific f u
Definition: afcover.h:88
small capitals from c petite p scientific i
[1]
Definition: afcover.h:80
xD9 x84 xD8 xAD xD9 x80 xF0 x90 xAC x9A xE0 xA7 xA6 xE0 xA7 xAA xF0 x91 x84 xA4 xF0 x91 x84 x89 xF0 x91 x84 x9B xF0 x90 x8A xAB xF0 x90 x8B x89 xE2 xB2 x9E xE2 xB2 x9F xD0 xBE xD0 x9E xF0 x90 x90 x84 xF0 x90 x90 xAC xE1 x83 x98 xE1 x83 x94 xE1 x83 x90 xE1 xB2 xBF xE2 xB0 x95 xE2 xB1 x85 xCE xBF xCE x9F xE0 xA8 xA0 xE0 xA8 xB0 xE0 xA9 xA6 Kayah xEA xA4 x8D xEA xA4 x80 Khmer xE1 xA7 xA1 xE1 xA7 xAA xE0 xBB x90 Latin Subscript xE2 x82 x92 xE2 x82 x80 xEA x93 xB3 xF0 x96 xB9 xA1 xF0 x96 xB9 x9B xF0 x96 xB9 xAF xE1 x80 x9D xE1 x80 x84 xE1 x80 x82 no script
Definition: afscript.h:271
FT_UInt idx
Definition: cffcmap.c:135
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:85
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:84
static constexpr char32_t surrogateToUcs4(char16_t high, char16_t low) noexcept
Definition: qchar.h:539
constexpr bool isSurrogate() const noexcept
Definition: qchar.h:512
constexpr bool isHighSurrogate() const noexcept
Definition: qchar.h:510
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
Definition: qstring.h:84
Definition: qlist.h:108
@ LastScript
Definition: qlocale.h:582
MeasurementSystem
Definition: qlocale.h:886
@ AnyLanguageCode
Definition: qlocale.h:1103
@ LastTerritory
Definition: qlocale.h:875
@ DefaultNumberOptions
Definition: qlocale.h:896
Language
Definition: qlocale.h:77
@ LastLanguage
Definition: qlocale.h:429
QLatin1String languageCode(QLocale::LanguageCodeTypes codeTypes=QLocale::AnyLanguageCode) const
Definition: qlocale_p.h:422
quint16 languageId() const
Definition: qlocale_p.h:416
static QLocale::Language codeToLanguage(QStringView code, QLocale::LanguageCodeTypes codeTypes=QLocale::AnyLanguageCode) noexcept
Definition: qlocale.cpp:106
QLatin1String scriptCode() const
Definition: qlocale_p.h:426
const QLocaleData *const m_data
Definition: qlocale_p.h:446
QLocale::MeasurementSystem measurementSystem() const
Definition: qlocale.cpp:3130
static QBasicAtomicInt s_generation
Definition: qlocale_p.h:451
quint16 territoryId() const
Definition: qlocale_p.h:417
static QLatin1String territoryToCode(QLocale::Territory territory)
Definition: qlocale.cpp:250
static QLocale::Territory codeToTerritory(QStringView code) noexcept
Definition: qlocale.cpp:198
static const QLocalePrivate * get(const QLocale &l)
Definition: qlocale_p.h:431
static QLocale::Script codeToScript(QStringView code) noexcept
Definition: qlocale.cpp:178
QLocale::NumberOptions m_numberOptions
Definition: qlocale_p.h:449
QLatin1String territoryCode() const
Definition: qlocale_p.h:428
constexpr QLocalePrivate(const QLocaleData *data, const uint index, QLocale::NumberOptions numberOptions=QLocale::DefaultNumberOptions, int refs=0)
Definition: qlocale_p.h:410
const uint m_index
Definition: qlocale_p.h:448
static QLatin1String scriptToCode(QLocale::Script script)
Definition: qlocale.cpp:242
QByteArray bcp47Name(char separator='-') const
Definition: qlocale.cpp:467
static QLatin1String languageToCode(QLocale::Language language, QLocale::LanguageCodeTypes codeTypes=QLocale::AnyLanguageCode)
Definition: qlocale.cpp:217
QBasicAtomicInt ref
Definition: qlocale_p.h:447
The QString class provides a Unicode character string.
Definition: qstring.h:388
static QString fromRawData(const QChar *, qsizetype size)
Definition: qstring.cpp:8938
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QStrin...
Definition: qstringview.h:122
@ StringToAlternateQuotation
Definition: qlocale_p.h:123
@ DateTimeToStringShort
Definition: qlocale_p.h:111
@ DateTimeFormatLong
Definition: qlocale_p.h:108
@ StandaloneMonthNameLong
Definition: qlocale_p.h:129
@ ListToSeparatedString
Definition: qlocale_p.h:125
@ StandaloneMonthNameNarrow
Definition: qlocale_p.h:131
@ StringToStandardQuotation
Definition: qlocale_p.h:122
@ StandaloneDayNameShort
Definition: qlocale_p.h:133
@ NativeTerritoryName
Definition: qlocale_p.h:128
@ NativeLanguageName
Definition: qlocale_p.h:127
@ StandaloneDayNameLong
Definition: qlocale_p.h:132
@ StandaloneMonthNameShort
Definition: qlocale_p.h:130
@ DateTimeToStringLong
Definition: qlocale_p.h:110
@ DateTimeFormatShort
Definition: qlocale_p.h:109
virtual QLocale fallbackLocale() const
Definition: qlocale_mac.mm:531
uint fallbackLocaleIndex() const
Definition: qlocale_p.h:455
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:95
Definition: base.h:37
QString str
[2]
std::string toLower(std::string const &s)
@ CaseInsensitive
Definition: qnamespace.h:1283
#define QString()
Definition: parse-defines.h:51
#define Q_BASIC_ATOMIC_INITIALIZER(a)
EGLOutputLayerEXT EGLint EGLAttrib value
bool qIsInf(qfloat16 f) noexcept
Definition: qfloat16.h:220
QT_BEGIN_INCLUDE_NAMESPACE typedef unsigned char uchar
Definition: qglobal.h:332
unsigned short quint16
Definition: qglobal.h:286
unsigned long long quint64
Definition: qglobal.h:299
unsigned int uint
Definition: qglobal.h:334
long long qint64
Definition: qglobal.h:298
unsigned short ushort
Definition: qglobal.h:333
unsigned char quint8
Definition: qglobal.h:284
QString qt_readEscapedFormatString(QStringView format, int *idx)
Definition: qlocale.cpp:634
bool qt_splitLocaleName(QStringView name, QStringView *lang=nullptr, QStringView *script=nullptr, QStringView *cntry=nullptr)
Definition: qlocale.cpp:576
#define rangeIndex(name)
Definition: qlocale_p.h:386
Q_DECLARE_TYPEINFO(QSystemLocale::QueryType, Q_PRIMITIVE_TYPE)
@ AsciiSpaceMask
Definition: qlocale_p.h:519
#define rangeGetter(name)
Definition: qlocale_p.h:377
#define Size(name)
constexpr bool ascii_isspace(uchar c)
Definition: qlocale_p.h:525
int qt_repeatCount(QStringView s)
Definition: qlocale.cpp:684
#define Q_DECLARE_METATYPE(TYPE)
Definition: qmetatype.h:1417
GLenum type
Definition: qopengl.h:270
GLsizei const GLfloat * v
[13]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint index
[2]
GLuint GLuint end
GLint GLsizei width
GLboolean GLuint group
GLbitfield flags
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLint ref
GLuint name
GLint GLsizei GLsizei GLenum format
GLenum query
Definition: qopenglext.h:2738
const GLubyte * c
Definition: qopenglext.h:12701
GLuint in
Definition: qopenglext.h:8870
GLuint64EXT * result
[6]
Definition: qopenglext.h:10932
GLdouble s
[6]
Definition: qopenglext.h:235
GLuint num
Definition: qopenglext.h:5654
GLenum GLenum GLsizei void * table
Definition: qopenglext.h:2745
GLenum GLint GLint * precision
Definition: qopenglext.h:1890
#define Q_ASSERT(cond)
Definition: qrandom.cpp:84
@ Q_PRIMITIVE_TYPE
Definition: qtypeinfo.h:155
@ Q_RELOCATABLE_TYPE
Definition: qtypeinfo.h:156
QSharedPointer< T > other(t)
[5]
QGraphicsWidget * form
char32_t ucsFirst(const char16_t *table) const
Definition: qlocale_p.h:338
QStringView viewListEntry(const char16_t *table, int index) const
Definition: qlocale_p.h:334
QString getData(const char16_t *table) const
Definition: qlocale_p.h:320
QStringView viewData(const char16_t *table) const
Definition: qlocale_p.h:326
QString getListEntry(const char16_t *table, int index) const
Definition: qlocale_p.h:330
static quint64 bytearrayToUnsLongLong(QByteArrayView num, int base, bool *ok)
Definition: qlocale.cpp:4185
QString positiveSign() const
Definition: qlocale.cpp:964
static float convertDoubleToFloat(double d, bool *ok)
Definition: qlocale_p.h:262
QString groupSeparator() const
Definition: qlocale.cpp:901
char32_t zeroUcs() const
Definition: qlocale.cpp:936
quint8 m_grouping_least
Definition: qlocale_p.h:404
QString zeroDigit() const
Definition: qlocale.cpp:924
quint8 m_grouping_top
Definition: qlocale_p.h:402
quint8 m_grouping_higher
Definition: qlocale_p.h:403
QString decimalPoint() const
Definition: qlocale.cpp:889
QString doubleToString(double d, int precision=-1, DoubleForm form=DFSignificantDigits, int width=-1, unsigned flags=NoFlags) const
Definition: qlocale.cpp:3556
quint8 m_weekend_start
Definition: qlocale_p.h:400
quint8 m_currency_digits
Definition: qlocale_p.h:397
static const QLocaleData * c()
Definition: qlocale.cpp:828
QVarLengthArray< char, 256 > CharBuff
Definition: qlocale_p.h:227
QLocaleId id() const
Definition: qlocale_p.h:303
QString listSeparator() const
Definition: qlocale.cpp:919
quint64 stringToUnsLongLong(QStringView str, int base, bool *ok, QLocale::NumberOptions options) const
Definition: qlocale.cpp:4136
qint64 stringToLongLong(QStringView str, int base, bool *ok, QLocale::NumberOptions options) const
Definition: qlocale.cpp:4123
QString percentSign() const
Definition: qlocale.cpp:914
bool numberToCLocale(QStringView s, QLocale::NumberOptions number_options, CharBuff *result) const
Definition: qlocale.cpp:3891
@ ZeroPadExponent
Definition: qlocale_p.h:221
@ BlankBeforePositive
Definition: qlocale_p.h:214
@ AddTrailingZeroes
Definition: qlocale_p.h:211
@ AlwaysShowSign
Definition: qlocale_p.h:215
Q_CORE_EXPORT bool validateChars(QStringView str, NumberMode numMode, QByteArray *buff, int decDigits=-1, QLocale::NumberOptions number_options=QLocale::DefaultNumberOptions) const
Definition: qlocale.cpp:4017
ForEachQLocaleRange(rangeIndex) ForEachQLocaleRange(Size) char m_currency_iso_code[3]
double stringToDouble(QStringView str, bool *ok, QLocale::NumberOptions options) const
Definition: qlocale.cpp:4106
QString longLongToString(qint64 l, int precision=-1, int base=10, int width=-1, unsigned flags=NoFlags) const
Definition: qlocale.cpp:3799
@ DoubleScientificMode
Definition: qlocale_p.h:225
@ DoubleStandardMode
Definition: qlocale_p.h:225
@ DFSignificantDigits
Definition: qlocale_p.h:205
quint8 m_first_day_of_week
Definition: qlocale_p.h:399
quint8 m_weekend_end
Definition: qlocale_p.h:401
char numericToCLocale(QStringView in) const
Definition: qlocale_p.h:466
quint8 m_currency_rounding
Definition: qlocale_p.h:398
QString exponentSeparator() const
Definition: qlocale.cpp:976
QString negativeSign() const
Definition: qlocale.cpp:952
static Q_CORE_EXPORT qint64 bytearrayToLongLong(QByteArrayView num, int base, bool *ok)
Definition: qlocale.cpp:4149
QString unsLongLongToString(quint64 l, int precision=-1, int base=10, int width=-1, unsigned flags=NoFlags) const
Definition: qlocale.cpp:3814
static int findLocaleIndex(QLocaleId localeId)
Definition: qlocale.cpp:496
bool operator==(QLocaleId other) const
Definition: qlocale_p.h:159
QLocaleId withLikelySubtagsRemoved() const
Definition: qlocale.cpp:393
bool matchesAll() const
Definition: qlocale_p.h:168
bool operator!=(QLocaleId other) const
Definition: qlocale_p.h:161
ushort script_id
Definition: qlocale_p.h:190
bool acceptLanguage(quint16 lang) const
Definition: qlocale_p.h:173
bool acceptScriptTerritory(QLocaleId other) const
Definition: qlocale_p.h:179
QLocaleId withLikelySubtagsAdded() const
Definition: qlocale.cpp:309
ushort territory_id
Definition: qlocale_p.h:190
QByteArray name(char separator='-') const
Definition: qlocale.cpp:417
ushort language_id
Definition: qlocale_p.h:190
static QLocaleId fromName(QStringView name)
Definition: qlocale.cpp:620
bool isValid() const
Definition: qlocale_p.h:163
CurrencyToStringArgument(const QVariant &v, const QString &s)
Definition: qlocale_p.h:81
Definition: inftrees.h:24
constexpr int huge