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
qlocale.cpp File Reference

(631c9ad638ed104579f7b3b5c69766852da6a01e)

#include "qglobal.h"
#include "qplatformdefs.h"
#include "qcalendar.h"
#include "qdatastream.h"
#include "qdebug.h"
#include "private/qduplicatetracker_p.h"
#include "qhashfunctions.h"
#include "qstring.h"
#include "qstringiterator_p.h"
#include "qlocale.h"
#include "qlocale_p.h"
#include "qlocale_tools_p.h"
#include <private/qtools_p.h>
#include "qnamespace.h"
#include "qdatetime.h"
#include "qstringlist.h"
#include "qvariant.h"
#include "qvarlengtharray.h"
#include "qstringbuilder.h"
#include "private/qnumeric_p.h"
#include <cmath>
#include "qmutex.h"
#include "private/qcalendarbackend_p.h"
#include "private/qgregoriancalendar_p.h"
#include <q20iterator.h>
#include "qlocale_data_p.h"
#include "moc_qlocale.cpp"
Include dependency graph for qlocale.cpp:

Go to the source code of this file.

Namespaces

namespace  QtTimeZoneLocale

Macros

#define CheckCandidate(id)

Functions

static qsizetype scriptIndex (QStringView code, Qt::CaseSensitivity cs) noexcept
static qsizetype findLocaleIndexById (QLocaleId localeId) noexcept
static QStringView findTag (QStringView name) noexcept
static bool validTag (QStringView tag)
bool qt_splitLocaleName (QStringView name, QStringView *lang, QStringView *script, QStringView *land) noexcept
QString qt_readEscapedFormatString (QStringView format, qsizetype *idx)
qsizetype qt_repeatCount (QStringView s) noexcept
static QLocalePrivatec_private () noexcept
static constexpr QLocale::NumberOptions defaultNumberOptions (QLocale::Language forLanguage)
static constexpr QLocale::NumberOptions defaultNumberOptions (quint16 forLanguage)
static const QSystemLocalesystemLocale ()
static void updateSystemPrivate ()
static const QLocaleDatasystemData (qsizetype *sysIndex=nullptr)
static const QLocaleDatadefaultData ()
static qsizetype defaultIndex ()
QDataStreamoperator<< (QDataStream &ds, const QLocale &l)
QDataStreamoperator>> (QDataStream &ds, QLocale &l)
 Q_GLOBAL_STATIC (QSharedDataPointer< QLocalePrivate >, defaultLocalePrivate, new QLocalePrivate(defaultData(), defaultIndex(), defaultNumberOptions(defaultData() ->m_language_id))) static QLocalePrivate *localePrivateByName(QStringView name)
static QLocalePrivatefindLocalePrivate (QLocale::Language language, QLocale::Script script, QLocale::Territory territory)
bool comparesEqual (const QLocale &loc, QLocale::Language lang)
static std::optional< QStringsystemLocaleString (const QLocaleData *that, QSystemLocale::QueryType type)
static QString localeString (const QLocaleData *that, QSystemLocale::QueryType type, QLocaleData::DataRange range)
size_t qHash (const QLocale &key, size_t seed=0)
static Q_DECL_COLD_FUNCTION void badSeparatorWarning (const char *method, char sep)
template<typename T>
static T toIntegral_helper (const QLocalePrivate *d, QStringView str, bool *ok)
static qsizetype stringWidth (QStringView text)
static unsigned calculateFlags (int fieldWidth, char32_t fillChar, const QLocale &locale)
static QString calculateFiller (qsizetype padding, char32_t fillChar, qsizetype fieldWidth, const QLocaleData *localeData)
static bool timeFormatContainsAP (QStringView format)
static const QCalendarLocalegetMonthDataFor (const QLocalePrivate *loc, const QCalendarLocale *table)
static QString rawMonthName (const QCalendarLocale &localeData, const char16_t *monthsData, int month, QLocale::FormatType type)
static QString rawStandaloneMonthName (const QCalendarLocale &localeData, const char16_t *monthsData, int month, QLocale::FormatType type)
static QString rawWeekDayName (const QLocaleData *data, const int day, QLocale::FormatType type)
static QString rawStandaloneWeekDayName (const QLocaleData *data, const int day, QLocale::FormatType type)
static QString offsetFromAbbreviation (QString &&text)
QString QtTimeZoneLocale::zoneOffsetFormat (const QLocale &locale, qsizetype, QLocale::FormatType width, const QDateTime &when, int offsetSeconds)
static bool checkParsed (QByteArrayView num, qsizetype used)
QDebug operator<< (QDebug dbg, const QLocale &l)

Variables

static Q_CONSTINIT QSystemLocale_systemLocale = nullptr
static Q_CONSTINIT QLocaleData systemLocaleData = {}
static constexpr qsizetype locale_data_size = q20::ssize(locale_data) - 1
static Q_CONSTINIT const QLocaleDatadefault_data = nullptr

Macro Definition Documentation

◆ CheckCandidate

#define CheckCandidate ( id)
Value:
do { \
if (!tried.contains(id)) { \
if (index >= 0) \
return index; \
tried.push_back(id); \
} \
} while (false)
static qsizetype findLocaleIndexById(QLocaleId localeId) noexcept
Definition qlocale.cpp:504
GLuint index

Function Documentation

◆ badSeparatorWarning()

Q_DECL_COLD_FUNCTION void badSeparatorWarning ( const char * method,
char sep )
static

Definition at line 1537 of file qlocale.cpp.

◆ c_private()

QLocalePrivate * c_private ( )
staticnoexcept

Definition at line 789 of file qlocale.cpp.

Referenced by QLocale::comparesEqual, findLocalePrivate(), and Q_GLOBAL_STATIC().

Here is the caller graph for this function:

◆ calculateFiller()

QString calculateFiller ( qsizetype padding,
char32_t fillChar,
qsizetype fieldWidth,
const QLocaleData * localeData )
static

Definition at line 2250 of file qlocale.cpp.

◆ calculateFlags()

unsigned calculateFlags ( int fieldWidth,
char32_t fillChar,
const QLocale & locale )
static

◆ checkParsed()

bool checkParsed ( QByteArrayView num,
qsizetype used )
static

Definition at line 4925 of file qlocale.cpp.

◆ comparesEqual()

bool comparesEqual ( const QLocale & loc,
QLocale::Language lang )

Definition at line 1022 of file qlocale.cpp.

◆ defaultData()

const QLocaleData * defaultData ( )
static

Definition at line 943 of file qlocale.cpp.

Referenced by QLocale::comparesEqual, defaultIndex(), and findLocalePrivate().

Here is the caller graph for this function:

◆ defaultIndex()

qsizetype defaultIndex ( )
static

Definition at line 950 of file qlocale.cpp.

References defaultData(), and locale_data.

Here is the call graph for this function:

◆ defaultNumberOptions() [1/2]

constexpr QLocale::NumberOptions defaultNumberOptions ( QLocale::Language forLanguage)
staticconstexpr

Definition at line 795 of file qlocale.cpp.

◆ defaultNumberOptions() [2/2]

constexpr QLocale::NumberOptions defaultNumberOptions ( quint16 forLanguage)
staticconstexpr

Definition at line 800 of file qlocale.cpp.

◆ findLocaleIndexById()

qsizetype findLocaleIndexById ( QLocaleId localeId)
staticnoexcept

Definition at line 504 of file qlocale.cpp.

◆ findLocalePrivate()

QLocalePrivate * findLocalePrivate ( QLocale::Language language,
QLocale::Script script,
QLocale::Territory territory )
static

Definition at line 1001 of file qlocale.cpp.

References c_private(), and defaultData().

Here is the call graph for this function:

◆ findTag()

QStringView findTag ( QStringView name)
staticnoexcept

Definition at line 642 of file qlocale.cpp.

◆ getMonthDataFor()

const QCalendarLocale & getMonthDataFor ( const QLocalePrivate * loc,
const QCalendarLocale * table )
static

Definition at line 3298 of file qlocale.cpp.

References locale_data, and QLocalePrivate::m_data.

◆ localeString()

QString localeString ( const QLocaleData * that,
QSystemLocale::QueryType type,
QLocaleData::DataRange range )
static

Definition at line 1066 of file qlocale.cpp.

References single_character_data.

◆ offsetFromAbbreviation()

QString offsetFromAbbreviation ( QString && text)
static

Definition at line 3760 of file qlocale.cpp.

◆ operator<<() [1/2]

QDataStream & operator<< ( QDataStream & ds,
const QLocale & l )

Definition at line 973 of file qlocale.cpp.

◆ operator<<() [2/2]

QDebug operator<< ( QDebug dbg,
const QLocale & l )

Definition at line 5520 of file qlocale.cpp.

◆ operator>>()

QDataStream & operator>> ( QDataStream & ds,
QLocale & l )

Definition at line 979 of file qlocale.cpp.

◆ Q_GLOBAL_STATIC()

Q_GLOBAL_STATIC ( QSharedDataPointer< QLocalePrivate > ,
defaultLocalePrivate ,
new QLocalePrivatedefaultData(), defaultIndex(), defaultNumberOptions(defaultData() ->m_language_id) )

Definition at line 988 of file qlocale.cpp.

References c_private().

Here is the call graph for this function:

◆ qHash()

size_t qHash ( const QLocale & key,
size_t seed = 0 )
noexcept
Since
5.6 \qhashold{QLocale}

Definition at line 1318 of file qlocale.cpp.

◆ qt_readEscapedFormatString()

QString qt_readEscapedFormatString ( QStringView format,
qsizetype * idx )

Definition at line 725 of file qlocale.cpp.

◆ qt_repeatCount()

qsizetype qt_repeatCount ( QStringView s)
nodiscardnoexcept

Counts the number of identical leading characters in s.

If s is empty, returns 0.

Otherwise, returns the number of consecutive {s.front()} characters at the start of s.

qt_repeatCount(u"a"); // == 1
qt_repeatCount(u"ab"); // == 1
qt_repeatCount(u"aab"); // == 2
qsizetype qt_repeatCount(QStringView s) noexcept
Definition qlocale.cpp:775

Definition at line 775 of file qlocale.cpp.

◆ qt_splitLocaleName()

bool qt_splitLocaleName ( QStringView name,
QStringView * lang,
QStringView * script,
QStringView * land )
nodiscardnoexcept

Definition at line 662 of file qlocale.cpp.

References Qt::CaseSensitive.

◆ rawMonthName()

QString rawMonthName ( const QCalendarLocale & localeData,
const char16_t * monthsData,
int month,
QLocale::FormatType type )
static

Definition at line 3325 of file qlocale.cpp.

◆ rawStandaloneMonthName()

QString rawStandaloneMonthName ( const QCalendarLocale & localeData,
const char16_t * monthsData,
int month,
QLocale::FormatType type )
static

Definition at line 3337 of file qlocale.cpp.

◆ rawStandaloneWeekDayName()

QString rawStandaloneWeekDayName ( const QLocaleData * data,
const int day,
QLocale::FormatType type )
static

Definition at line 3375 of file qlocale.cpp.

◆ rawWeekDayName()

QString rawWeekDayName ( const QLocaleData * data,
const int day,
QLocale::FormatType type )
static

Definition at line 3351 of file qlocale.cpp.

References days_data.

◆ scriptIndex()

qsizetype scriptIndex ( QStringView code,
Qt::CaseSensitivity cs )
staticnoexcept

Definition at line 184 of file qlocale.cpp.

References Qt::CaseInsensitive, and script_code_list.

◆ stringWidth()

qsizetype stringWidth ( QStringView text)
static

Definition at line 2225 of file qlocale.cpp.

References QStringIterator::hasNext(), and QStringIterator::next().

Here is the call graph for this function:

◆ systemData()

const QLocaleData * systemData ( qsizetype * sysIndex = nullptr)
static

Definition at line 903 of file qlocale.cpp.

◆ systemLocale()

const QSystemLocale * systemLocale ( )
static

Definition at line 856 of file qlocale.cpp.

◆ systemLocaleString()

std::optional< QString > systemLocaleString ( const QLocaleData * that,
QSystemLocale::QueryType type )
static

Definition at line 1048 of file qlocale.cpp.

◆ timeFormatContainsAP()

bool timeFormatContainsAP ( QStringView format)
static

Definition at line 2457 of file qlocale.cpp.

◆ toIntegral_helper()

template<typename T>
T toIntegral_helper ( const QLocalePrivate * d,
QStringView str,
bool * ok )
inlinestatic

Definition at line 1585 of file qlocale.cpp.

References QLocalePrivate::m_data.

◆ updateSystemPrivate()

void updateSystemPrivate ( )
static

Definition at line 868 of file qlocale.cpp.

◆ validTag()

bool validTag ( QStringView tag)
static

Definition at line 651 of file qlocale.cpp.

Variable Documentation

◆ _systemLocale

Q_CONSTINIT QSystemLocale * _systemLocale = nullptr
static

Definition at line 83 of file qlocale.cpp.

◆ default_data

Q_CONSTINIT const QLocaleData * default_data = nullptr
static

Definition at line 786 of file qlocale.cpp.

◆ locale_data_size

constexpr qsizetype locale_data_size = q20::ssize(locale_data) - 1
staticconstexpr

Definition at line 523 of file qlocale.cpp.

◆ systemLocaleData

Q_CONSTINIT QLocaleData systemLocaleData = {}
static

Definition at line 84 of file qlocale.cpp.