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

(9fee7cdfcce00ce6500b8eebf67f4a6c91be98bd)

#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:499
GLuint index
[2]

Function Documentation

◆ badSeparatorWarning()

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

Definition at line 1525 of file qlocale.cpp.

◆ c_private()

static QLocalePrivate * c_private ( )
staticnoexcept

Definition at line 776 of file qlocale.cpp.

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

+ Here is the caller graph for this function:

◆ calculateFiller()

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

Definition at line 2238 of file qlocale.cpp.

◆ calculateFlags()

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

◆ checkParsed()

static bool checkParsed ( QByteArrayView num,
qsizetype used )
static

Definition at line 4852 of file qlocale.cpp.

◆ comparesEqual()

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

Definition at line 1011 of file qlocale.cpp.

◆ defaultData()

static const QLocaleData * defaultData ( )
static

Definition at line 930 of file qlocale.cpp.

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

+ Here is the caller graph for this function:

◆ defaultIndex()

static qsizetype defaultIndex ( )
static

Definition at line 937 of file qlocale.cpp.

References defaultData(), and locale_data.

+ Here is the call graph for this function:

◆ defaultNumberOptions() [1/2]

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

Definition at line 782 of file qlocale.cpp.

◆ defaultNumberOptions() [2/2]

static constexpr QLocale::NumberOptions defaultNumberOptions ( quint16 forLanguage)
staticconstexpr

Definition at line 787 of file qlocale.cpp.

◆ findLocaleIndexById()

static qsizetype findLocaleIndexById ( QLocaleId localeId)
staticnoexcept

Definition at line 499 of file qlocale.cpp.

◆ findLocalePrivate()

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

Definition at line 989 of file qlocale.cpp.

References c_private(), defaultData(), locale_data, and locale_data_size.

+ Here is the call graph for this function:

◆ findTag()

static QStringView findTag ( QStringView name)
staticnoexcept

Definition at line 629 of file qlocale.cpp.

◆ getMonthDataFor()

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

Definition at line 3280 of file qlocale.cpp.

References locale_data, and QLocalePrivate::m_data.

◆ localeString()

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

Definition at line 1056 of file qlocale.cpp.

References single_character_data.

◆ offsetFromAbbreviation()

static QString offsetFromAbbreviation ( QString && text)
static

Definition at line 3767 of file qlocale.cpp.

◆ operator<<() [1/2]

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

Definition at line 960 of file qlocale.cpp.

◆ operator<<() [2/2]

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

Definition at line 5439 of file qlocale.cpp.

◆ operator>>()

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

Definition at line 966 of file qlocale.cpp.

◆ Q_GLOBAL_STATIC()

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

Definition at line 975 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 1306 of file qlocale.cpp.

◆ qt_readEscapedFormatString()

QString qt_readEscapedFormatString ( QStringView format,
qsizetype * idx )

Definition at line 712 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:762

Definition at line 762 of file qlocale.cpp.

◆ qt_splitLocaleName()

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

Definition at line 649 of file qlocale.cpp.

References Qt::CaseSensitive.

◆ rawMonthName()

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

Definition at line 3307 of file qlocale.cpp.

◆ rawStandaloneMonthName()

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

Definition at line 3332 of file qlocale.cpp.

◆ rawStandaloneWeekDayName()

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

Definition at line 3382 of file qlocale.cpp.

◆ rawWeekDayName()

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

Definition at line 3358 of file qlocale.cpp.

References days_data.

◆ scriptIndex()

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

Definition at line 181 of file qlocale.cpp.

References Qt::CaseInsensitive, and script_code_list.

◆ stringWidth()

static qsizetype stringWidth ( QStringView text)
static

Definition at line 2213 of file qlocale.cpp.

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

+ Here is the call graph for this function:

◆ systemData()

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

Definition at line 890 of file qlocale.cpp.

◆ systemLocale()

static const QSystemLocale * systemLocale ( )
static

Definition at line 843 of file qlocale.cpp.

◆ systemLocaleString()

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

Definition at line 1038 of file qlocale.cpp.

◆ timeFormatContainsAP()

static bool timeFormatContainsAP ( QStringView format)
static

Definition at line 2445 of file qlocale.cpp.

◆ toIntegral_helper()

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

Definition at line 1573 of file qlocale.cpp.

References QLocalePrivate::m_data.

◆ updateSystemPrivate()

static void updateSystemPrivate ( )
static

Definition at line 855 of file qlocale.cpp.

◆ validTag()

static bool validTag ( QStringView tag)
static

Definition at line 638 of file qlocale.cpp.

Variable Documentation

◆ _systemLocale

static Q_CONSTINIT QSystemLocale * _systemLocale = nullptr
static

Definition at line 83 of file qlocale.cpp.

◆ default_data

static Q_CONSTINIT const QLocaleData * default_data = nullptr
static

Definition at line 773 of file qlocale.cpp.

◆ locale_data_size

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

Definition at line 518 of file qlocale.cpp.

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

◆ systemLocaleData

static Q_CONSTINIT QLocaleData systemLocaleData = {}
static

Definition at line 84 of file qlocale.cpp.