Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qlocale_tools_p.h File Reference

(62d1ebe465fb0314daeefb2cfe6f1470817a5365)

#include "qlocale_p.h"
#include "qstring.h"
+ Include dependency graph for qlocale_tools_p.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  StrayCharacterMode { TrailingJunkProhibited , TrailingJunkAllowed , WhitespacesAllowed }
 

Functions

QSimpleParsedNumber< double > qt_asciiToDouble (const char *num, qsizetype numLen, StrayCharacterMode strayCharMode=TrailingJunkProhibited)
 
void qt_doubleToAscii (double d, QLocaleData::DoubleForm form, int precision, char *buf, qsizetype bufSize, bool &sign, int &length, int &decpt)
 
QString qulltoBasicLatin (qulonglong l, int base, bool negative)
 
QString qulltoa (qulonglong l, int base, const QStringView zero)
 
Q_CORE_EXPORT QString qdtoa (qreal d, int *decpt, int *sign)
 
QString qdtoBasicLatin (double d, QLocaleData::DoubleForm form, int precision, bool uppercase)
 
QByteArray qdtoAscii (double d, QLocaleData::DoubleForm form, int precision, bool uppercase)
 
constexpr bool isZero (double d)
 
int wholePartSpace (double d)
 
template<typename UcsInt >
UcsInt unicodeForDigit (uint digit, UcsInt zero)
 
Q_CORE_EXPORT double qstrntod (const char *s00, qsizetype len, char const **se, bool *ok)
 
double qstrtod (const char *s00, char const **se, bool *ok)
 
Q_AUTOTEST_EXPORT QSimpleParsedNumber< qlonglongqstrntoll (const char *nptr, qsizetype size, int base)
 
QSimpleParsedNumber< qulonglongqstrntoull (const char *nptr, qsizetype size, int base)
 

Enumeration Type Documentation

◆ StrayCharacterMode

Enumerator
TrailingJunkProhibited 
TrailingJunkAllowed 
WhitespacesAllowed 

Definition at line 23 of file qlocale_tools_p.h.

Function Documentation

◆ isZero()

constexpr bool isZero ( double d)
inlineconstexpr

Definition at line 45 of file qlocale_tools_p.h.

References d.

Referenced by QLocaleData::doubleToString(), dtoString(), qt_asciiToDouble(), and qt_doubleToAscii().

+ Here is the caller graph for this function:

◆ qdtoa()

Q_CORE_EXPORT QString qdtoa ( qreal d,
int * decpt,
int * sign )

Definition at line 572 of file qlocale_tools.cpp.

References d, QLocaleData::DFSignificantDigits, digits(), QLocale::FloatingPointShortest, qt_doubleToAscii(), and sign().

Referenced by QV4::RuntimeHelpers::numberToString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qdtoAscii()

QByteArray qdtoAscii ( double d,
QLocaleData::DoubleForm form,
int precision,
bool uppercase )

Definition at line 793 of file qlocale_tools.cpp.

References d, and form.

Referenced by QByteArray::number().

+ Here is the caller graph for this function:

◆ qdtoBasicLatin()

QString qdtoBasicLatin ( double d,
QLocaleData::DoubleForm form,
int precision,
bool uppercase )

Definition at line 788 of file qlocale_tools.cpp.

References d, and form.

Referenced by QString::number().

+ Here is the caller graph for this function:

◆ qstrntod()

Q_CORE_EXPORT double qstrntod ( const char * s00,
qsizetype len,
const char ** se,
bool * ok )

Converts the initial portion of the string pointed to by s00 to a double, using the 'C' locale. The function sets the pointer pointed to by se to point to the character past the last character converted.

Definition at line 562 of file qlocale_tools.cpp.

References ok, qt_asciiToDouble(), and TrailingJunkAllowed.

Referenced by qstrtod().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qstrntoll()

Q_AUTOTEST_EXPORT QSimpleParsedNumber< qlonglong > qstrntoll ( const char * nptr,
qsizetype size,
int base )

Definition at line 439 of file qlocale_tools.cpp.

References ascii_isspace(), base, begin(), isDigitForBase(), and scanPrefix().

Referenced by QLocaleData::bytearrayToLongLong(), deviceNumber(), parsePosixTime(), qt_doubleToAscii(), and scanLangEnv().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qstrntoull()

QSimpleParsedNumber< qulonglong > qstrntoull ( const char * nptr,
qsizetype size,
int base )

Definition at line 421 of file qlocale_tools.cpp.

References ascii_isspace(), base, begin(), and scanPrefix().

Referenced by QLocaleData::bytearrayToUnsLongLong(), from_string(), parse_field_width(), QIPAddressUtils::parseIp4Internal(), QIPAddressUtils::parseIp6(), and winIso639LangName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qstrtod()

double qstrtod ( const char * s00,
char const ** se,
bool * ok )
inline

Definition at line 79 of file qlocale_tools_p.h.

References ok, and qstrntod().

Referenced by QPSQLResult::data(), QV4::GlobalFunctions::method_parseFloat(), qt_color_from_string(), QV4::RuntimeHelpers::stringToNumber(), and toDouble().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_asciiToDouble()

QSimpleParsedNumber< double > qt_asciiToDouble ( const char * num,
qsizetype numLen,
StrayCharacterMode strayCharMode = TrailingJunkProhibited )

Definition at line 253 of file qlocale_tools.cpp.

References c2, d, fmt, i, isZero(), Q_ASSERT, qsnprintf(), qt_inf(), qt_is_finite(), qt_is_nan(), qt_qnan(), TrailingJunkAllowed, TrailingJunkProhibited, and WhitespacesAllowed.

Referenced by qstrntod(), QLocaleData::stringToDouble(), QStringView::toDouble(), and QtPrivate::toDouble().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_doubleToAscii()

void qt_doubleToAscii ( double d,
QLocaleData::DoubleForm form,
int precision,
char * buf,
qsizetype bufSize,
bool & sign,
int & length,
int & decpt )

Definition at line 45 of file qlocale_tools.cpp.

References d, QLocaleData::DFDecimal, QLocaleData::DFExponent, QLocaleData::DFSignificantDigits, QLocale::FloatingPointShortest, form, isZero(), Q_ASSERT, qMin(), qstrntoll(), qt_is_inf(), qt_is_nan(), sign(), and wholePartSpace().

Referenced by QLocaleData::doubleToString(), dtoString(), and qdtoa().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qulltoa()

QString qulltoa ( qulonglong l,
int base,
const QStringView zero )

Definition at line 520 of file qlocale_tools.cpp.

References base, number, unicodeForDigit(), and zero.

Referenced by QLocaleData::longLongToString(), QIPAddressUtils::number(), and QLocaleData::unsLongLongToString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qulltoBasicLatin()

QString qulltoBasicLatin ( qulonglong l,
int base,
bool negative )

Definition at line 502 of file qlocale_tools.cpp.

References base, number, and QStringLiteral.

Referenced by QString::number(), and QString::number().

+ Here is the caller graph for this function:

◆ unicodeForDigit()

template<typename UcsInt >
UcsInt unicodeForDigit ( uint digit,
UcsInt zero )
inline

Definition at line 61 of file qlocale_tools_p.h.

References Q_ASSERT, and zero.

Referenced by QLocaleData::doubleToString(), and qulltoa().

+ Here is the caller graph for this function:

◆ wholePartSpace()

int wholePartSpace ( double d)
inline

Definition at line 51 of file qlocale_tools_p.h.

References d, and Q_ASSERT.

Referenced by QLocaleData::doubleToString(), dtoString(), and qt_doubleToAscii().

+ Here is the caller graph for this function: