Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QLocaleData Struct Reference

#include <qlocale_p.h>

Collaboration diagram for QLocaleData:

Classes

struct  GroupSizes
struct  ParsingResult
struct  NumericData
class  DigitSequence
 Descriptor for a digit sequence within a text. More...
struct  DataRange

Public Types

enum  DoubleForm { DFExponent = 0 , DFDecimal , DFSignificantDigits , _DFMax = DFSignificantDigits }
enum  Flags {
  NoFlags = 0 , AddTrailingZeroes = 0x01 , ZeroPadded = 0x02 , LeftAdjusted = 0x04 ,
  BlankBeforePositive = 0x08 , AlwaysShowSign = 0x10 , GroupDigits = 0x20 , CapitalEorX = 0x40 ,
  ShowBase = 0x80 , UppercaseBase = 0x100 , ZeroPadExponent = 0x200 , ForcePoint = 0x400
}
enum  NumberMode { IntegerMode , DoubleStandardMode , DoubleScientificMode }
using CharBuff = QVarLengthArray<char, 256>

Public Member Functions

QString doubleToString (double d, int precisionprecision=-1, DoubleForm form=DFSignificantDigits, int widthwidth=-1, unsigned flagsflags=NoFlags) const
QString longLongToString (qint64 l, int precisionprecision=-1, int base=10, int widthwidth=-1, unsigned flagsflags=NoFlags) const
QString unsLongLongToString (quint64 l, int precisionprecision=-1, int base=10, int widthwidth=-1, unsigned flagsflags=NoFlags) const
double stringToDouble (QStringView str, bool *ok, QLocale::NumberOptions options) const
QSimpleParsedNumber< qint64 > stringToLongLong (QStringView str, int base, QLocale::NumberOptions options) const
QSimpleParsedNumber< quint64 > stringToUnsLongLong (QStringView str, int base, QLocale::NumberOptions options) const
bool numberToCLocale (QStringView ss, QLocale::NumberOptions number_options, NumberMode modemode, CharBuff *resultresult) const
 Returns a DigitSequence describing some portion of text starting at from.
DigitSequence digitSequence (QStringView text, DigitSequence::Options flagsflags=DigitSequence::Option::Default, qsizetype from=0, qsizetype maxDigits=-1) const
Q_CORE_EXPORT ParsingResult validateChars (QStringView str, NumberMode numMode, int decDigits=-1, QLocale::NumberOptions number_options=QLocale::DefaultNumberOptions) const
QLocaleId id () const
QString decimalPoint () const
QString groupSeparator () const
QString listSeparator () const
QString percentSign () const
QString zeroDigit () const
Q_AUTOTEST_EXPORT char32_t zeroUcs () const
QString positiveSign () const
QString negativeSign () const
QString exponentSeparator () const
Q_CORE_EXPORT GroupSizes groupSizes () const
 ForEachQLocaleRange (rangeIndex) ForEachQLocaleRange(Size) char m_currency_iso_code[3]

Static Public Member Functions

static Q_AUTOTEST_EXPORT qsizetype findLocaleIndex (QLocaleId localeId) noexcept
static Q_AUTOTEST_EXPORT const QLocaleData * c () noexcept
static Q_AUTOTEST_EXPORT bool allLocaleDataRows (bool(*check)(qsizetype, const QLocaleData &))
static Q_AUTOTEST_EXPORT const QLocaleData * dataForLocaleIndex (qsizetype indexindex)
static float convertDoubleToFloat (double d, bool *ok)
static Q_CORE_EXPORT QSimpleParsedNumber< qint64 > bytearrayToLongLong (QByteArrayView numnum, int base)
static QSimpleParsedNumber< quint64 > bytearrayToUnsLongLong (QByteArrayView numnum, int base)

Public Attributes

quint8 m_currency_digits: 2
quint8 m_currency_rounding: 3
quint8 m_first_day_of_week: 3
quint8 m_weekend_start: 3
quint8 m_weekend_end: 3
quint8 m_grouping_first: 2
quint8 m_grouping_higher: 3
quint8 m_grouping_least: 3

Detailed Description

Definition at line 251 of file qlocale_p.h.

Member Typedef Documentation

◆ CharBuff

Definition at line 296 of file qlocale_p.h.

Member Enumeration Documentation

◆ DoubleForm

Enumerator
DFExponent 
DFDecimal 
DFSignificantDigits 
_DFMax 

Definition at line 263 of file qlocale_p.h.

◆ Flags

Enumerator
NoFlags 
AddTrailingZeroes 
ZeroPadded 
LeftAdjusted 
BlankBeforePositive 
AlwaysShowSign 
GroupDigits 
CapitalEorX 
ShowBase 
UppercaseBase 
ZeroPadExponent 
ForcePoint 

Definition at line 270 of file qlocale_p.h.

◆ NumberMode

Enumerator
IntegerMode 
DoubleStandardMode 
DoubleScientificMode 

Definition at line 286 of file qlocale_p.h.

Member Function Documentation

◆ allLocaleDataRows()

bool QLocaleData::allLocaleDataRows ( bool(* check )(qsizetype, const QLocaleData &))
staticnodiscard

Definition at line 526 of file qlocale.cpp.

◆ bytearrayToLongLong()

QSimpleParsedNumber< qint64 > QLocaleData::bytearrayToLongLong ( QByteArrayView num,
int base )
staticnodiscard

Definition at line 5171 of file qlocale.cpp.

◆ bytearrayToUnsLongLong()

QSimpleParsedNumber< quint64 > QLocaleData::bytearrayToUnsLongLong ( QByteArrayView num,
int base )
staticnodiscard

Definition at line 5179 of file qlocale.cpp.

◆ c()

const QLocaleData * QLocaleData::c ( )
staticnodiscardnoexcept

Definition at line 941 of file qlocale.cpp.

References locale_data.

◆ convertDoubleToFloat()

float QLocaleData::convertDoubleToFloat ( double d,
bool * ok )
inlinestaticnodiscard

Definition at line 344 of file qlocale_p.h.

Referenced by QByteArray::toFloat(), and QtPrivate::toFloat().

Here is the caller graph for this function:

◆ dataForLocaleIndex()

const QLocaleData * QLocaleData::dataForLocaleIndex ( qsizetype index)
staticnodiscard

Definition at line 536 of file qlocale.cpp.

References locale_data.

◆ decimalPoint()

QString QLocaleData::decimalPoint ( ) const
nodiscard

Definition at line 1049 of file qlocale.cpp.

◆ digitSequence()

DigitSequence QLocaleData::digitSequence ( QStringView text,
DigitSequence::Options flags = DigitSequence::Option::Default,
qsizetype from = 0,
qsizetype maxDigits = -1 ) const
inlinenodiscard

Definition at line 543 of file qlocale_p.h.

References IntegerMode.

◆ doubleToString()

QString QLocaleData::doubleToString ( double d,
int precision = -1,
DoubleForm form = DFSignificantDigits,
int width = -1,
unsigned flags = NoFlags ) const
nodiscard

◆ exponentSeparator()

QString QLocaleData::exponentSeparator ( ) const
nodiscard

Definition at line 1100 of file qlocale.cpp.

References single_character_data.

◆ findLocaleIndex()

qsizetype QLocaleData::findLocaleIndex ( QLocaleId localeId)
staticnodiscardnoexcept

Definition at line 594 of file qlocale.cpp.

References QLocaleId::language_id, QLocaleId::script_id, QLocaleId::territory_id, and QLocaleId::withLikelySubtagsAdded().

Here is the call graph for this function:

◆ ForEachQLocaleRange()

QLocaleData::ForEachQLocaleRange ( rangeIndex )

◆ groupSeparator()

QString QLocaleData::groupSeparator ( ) const
nodiscard

Definition at line 1054 of file qlocale.cpp.

◆ groupSizes()

QLocaleData::GroupSizes QLocaleData::groupSizes ( ) const
nodiscard

◆ id()

QLocaleId QLocaleData::id ( ) const
inlinenodiscard

Definition at line 554 of file qlocale_p.h.

Referenced by QLocalePrivate::bcp47Name().

Here is the caller graph for this function:

◆ listSeparator()

QString QLocaleData::listSeparator ( ) const
nodiscard

Definition at line 1064 of file qlocale.cpp.

References single_character_data.

◆ longLongToString()

QString QLocaleData::longLongToString ( qint64 l,
int precision = -1,
int base = 10,
int width = -1,
unsigned flags = NoFlags ) const
nodiscard

Definition at line 4293 of file qlocale.cpp.

◆ negativeSign()

QString QLocaleData::negativeSign ( ) const
nodiscard

Definition at line 1090 of file qlocale.cpp.

◆ numberToCLocale()

bool QLocaleData::numberToCLocale ( QStringView s,
QLocale::NumberOptions number_options,
NumberMode mode,
CharBuff * result ) const
nodiscard

Returns a DigitSequence describing some portion of text starting at from.

QLocaleData::DigitSequence QLocaleData::digitSequence(QStringView text, QLocaleData::DigitSequence::Options, qsizetype from, qsizetype maxDigits)

As for the \l{QLocaleData::}{DigitSequence} constructor, supplying the \l{QLocaleData::}{NumericData} for this QLocaleData instance and the IntegerMode as the relevant argument to it.

If maxDigits is not passed, this will scan as many digits as it finds (after, where relevant, a sign) in a prefix of text and allocate space in which to store the results. If text is not known to be of sensible length for the data it is expected to contain, this may involve unbounded scanning and allocation. Callers should consider how many digits they can possibly have a use for and pass that, or a conservative upper-bound estimate of it, for maxDigits whenever they reasonably can.

If digits beyond that are technically acceptable (albeit useless), for example surplus digits in a fractional part, the caller can use a QStringIterator on text, starting at the return's endIndex(), and iterating as long as NumericData::digitValue() >= 0, to skip over the surplus. (You can also use digitValue() > 0 to resolve the case where a trailing 5 followed by 0s leaves open the possibility of an exact half in need of rounding according to the parity of the digit before the 5.)

Definition at line 4858 of file qlocale.cpp.

◆ percentSign()

QString QLocaleData::percentSign ( ) const
nodiscard

Definition at line 1059 of file qlocale.cpp.

References single_character_data.

◆ positiveSign()

QString QLocaleData::positiveSign ( ) const
nodiscard

Definition at line 1095 of file qlocale.cpp.

◆ stringToDouble()

double QLocaleData::stringToDouble ( QStringView str,
bool * ok,
QLocale::NumberOptions options ) const
nodiscard

Definition at line 5116 of file qlocale.cpp.

◆ stringToLongLong()

QSimpleParsedNumber< qint64 > QLocaleData::stringToLongLong ( QStringView str,
int base,
QLocale::NumberOptions options ) const
nodiscard

Definition at line 5132 of file qlocale.cpp.

◆ stringToUnsLongLong()

QSimpleParsedNumber< quint64 > QLocaleData::stringToUnsLongLong ( QStringView str,
int base,
QLocale::NumberOptions options ) const
nodiscard

Definition at line 5143 of file qlocale.cpp.

◆ unsLongLongToString()

QString QLocaleData::unsLongLongToString ( quint64 l,
int precision = -1,
int base = 10,
int width = -1,
unsigned flags = NoFlags ) const
nodiscard

Definition at line 4308 of file qlocale.cpp.

◆ validateChars()

QLocaleData::ParsingResult QLocaleData::validateChars ( QStringView str,
NumberMode numMode,
int decDigits = -1,
QLocale::NumberOptions number_options = QLocale::DefaultNumberOptions ) const
nodiscard

◆ zeroDigit()

QString QLocaleData::zeroDigit ( ) const
nodiscard

Definition at line 1069 of file qlocale.cpp.

◆ zeroUcs()

char32_t QLocaleData::zeroUcs ( ) const
nodiscard

Definition at line 1074 of file qlocale.cpp.

References single_character_data, and QLocaleData::DataRange::ucsFirst().

Here is the call graph for this function:

Member Data Documentation

◆ m_currency_digits

quint8 QLocaleData::m_currency_digits

Definition at line 663 of file qlocale_p.h.

◆ m_currency_rounding

quint8 QLocaleData::m_currency_rounding

Definition at line 664 of file qlocale_p.h.

◆ m_first_day_of_week

quint8 QLocaleData::m_first_day_of_week

Definition at line 665 of file qlocale_p.h.

◆ m_grouping_first

quint8 QLocaleData::m_grouping_first

Definition at line 668 of file qlocale_p.h.

◆ m_grouping_higher

quint8 QLocaleData::m_grouping_higher

Definition at line 669 of file qlocale_p.h.

◆ m_grouping_least

quint8 QLocaleData::m_grouping_least

Definition at line 670 of file qlocale_p.h.

◆ m_weekend_end

quint8 QLocaleData::m_weekend_end

Definition at line 667 of file qlocale_p.h.

◆ m_weekend_start

quint8 QLocaleData::m_weekend_start

Definition at line 666 of file qlocale_p.h.


The documentation for this struct was generated from the following files: