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

(7838a57d2937070bb1a83122491f25b2b396553b)

#include "qlocale_tools_p.h"
#include "qdoublescanprint_p.h"
#include "qlocale_p.h"
#include "qstring.h"
#include <private/qtools_p.h>
#include <private/qnumeric_p.h>
#include <cstdio>
#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <limits>
#include <charconv>
Include dependency graph for qlocale_tools.cpp:

Go to the source code of this file.

Macros

#define LLONG_MAX   Q_INT64_C(0x7fffffffffffffff)
#define LLONG_MIN   (-LLONG_MAX - Q_INT64_C(1))
#define ULLONG_MAX   Q_UINT64_C(0xffffffffffffffff)
#define BIG_BASE_LOOP(b)
#define SMALL_BASE_LOOP(b)

Functions

QT_CLOCALE_HOLDER void qt_doubleToAscii (double d, QLocaleData::DoubleForm form, int precision, char *buf, qsizetype bufSize, bool &sign, int &length, int &decpt)
QSimpleParsedNumber< double > qt_asciiToDouble (const char *num, qsizetype numLen, StrayCharacterMode strayCharMode)
static auto scanPrefix (const char *p, const char *stop, int base)
static bool isDigitForBase (char d, int base)
QSimpleParsedNumber< qulonglongqstrntoull (const char *begin, qsizetype size, int base)
QSimpleParsedNumber< qlonglongqstrntoll (const char *begin, qsizetype size, int base)
template<typename Char>
static Q_ALWAYS_INLINE void qulltoString_helper (qulonglong number, int base, Char *&p)
QString qulltoBasicLatin (qulonglong number, int base, bool negative)
QString qulltoa (qulonglong number, int base, const QStringView zero)
char * qulltoa2 (char *p, qulonglong n, int base)
double qstrntod (const char *s00, qsizetype len, const char **se, bool *ok)
QString qdtoa (qreal d, int *decpt, int *sign)
static QLocaleData::DoubleForm resolveFormat (int precision, int decpt, qsizetype length)
static constexpr int digits (int number)
template<typename T>
static T dtoString (double d, QLocaleData::DoubleForm form, int precision, bool uppercase)
QString qdtoBasicLatin (double d, QLocaleData::DoubleForm form, int precision, bool uppercase)
QByteArray qdtoAscii (double d, QLocaleData::DoubleForm form, int precision, bool uppercase)

Macro Definition Documentation

◆ BIG_BASE_LOOP

#define BIG_BASE_LOOP ( b)
Value:
do { \
const int r = number % b; \
*--p = Char((r < 10 ? '0' : 'a' - 10) + r); \
number /= b; \
} while (number)
GLboolean GLboolean GLboolean b
GLboolean r
GLfloat GLfloat p
char Char

◆ LLONG_MAX

#define LLONG_MAX   Q_INT64_C(0x7fffffffffffffff)

Definition at line 33 of file qlocale_tools.cpp.

◆ LLONG_MIN

#define LLONG_MIN   (-LLONG_MAX - Q_INT64_C(1))

Definition at line 36 of file qlocale_tools.cpp.

◆ SMALL_BASE_LOOP

#define SMALL_BASE_LOOP ( b)
Value:
do { \
*--p = Char('0' + number % b); \
number /= b; \
} while (number)

◆ ULLONG_MAX

#define ULLONG_MAX   Q_UINT64_C(0xffffffffffffffff)

Definition at line 39 of file qlocale_tools.cpp.

Function Documentation

◆ digits()

constexpr int digits ( int number)
staticconstexpr

Definition at line 639 of file qlocale_tools.cpp.

Referenced by dtoString().

Here is the caller graph for this function:

◆ dtoString()

template<typename T>
T dtoString ( double d,
QLocaleData::DoubleForm form,
int precision,
bool uppercase )
static

Definition at line 652 of file qlocale_tools.cpp.

References QLocaleData::DFDecimal, QLocaleData::DFExponent, QLocaleData::DFSignificantDigits, and digits().

Here is the call graph for this function:

◆ isDigitForBase()

bool isDigitForBase ( char d,
int base )
static

Definition at line 409 of file qlocale_tools.cpp.

◆ qdtoa()

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

Definition at line 585 of file qlocale_tools.cpp.

◆ qdtoAscii()

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

Definition at line 806 of file qlocale_tools.cpp.

Referenced by QByteArray::number().

Here is the caller graph for this function:

◆ qdtoBasicLatin()

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

Definition at line 801 of file qlocale_tools.cpp.

◆ qstrntod()

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

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 575 of file qlocale_tools.cpp.

◆ qstrntoll()

QSimpleParsedNumber< qlonglong > qstrntoll ( const char * begin,
qsizetype size,
int base )
nodiscard

Definition at line 440 of file qlocale_tools.cpp.

References scanPrefix().

Here is the call graph for this function:

◆ qstrntoull()

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

Definition at line 422 of file qlocale_tools.cpp.

References scanPrefix().

Here is the call graph for this function:

◆ qt_asciiToDouble()

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

Definition at line 256 of file qlocale_tools.cpp.

References TrailingJunkAllowed.

◆ qt_doubleToAscii()

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

Definition at line 48 of file qlocale_tools.cpp.

References QLocaleData::DFExponent, and QLocaleData::DFSignificantDigits.

◆ qulltoa()

QString qulltoa ( qulonglong number,
int base,
const QStringView zero )
nodiscard

Definition at line 521 of file qlocale_tools.cpp.

◆ qulltoa2()

char * qulltoa2 ( char * p,
qulonglong n,
int base )
nodiscard

Definition at line 556 of file qlocale_tools.cpp.

◆ qulltoBasicLatin()

QString qulltoBasicLatin ( qulonglong number,
int base,
bool negative )
nodiscard

Definition at line 503 of file qlocale_tools.cpp.

◆ qulltoString_helper()

template<typename Char>
Q_ALWAYS_INLINE void qulltoString_helper ( qulonglong number,
int base,
Char *& p )
static

Definition at line 474 of file qlocale_tools.cpp.

◆ resolveFormat()

QLocaleData::DoubleForm resolveFormat ( int precision,
int decpt,
qsizetype length )
static

Definition at line 605 of file qlocale_tools.cpp.

References QLocaleData::DFDecimal, and QLocaleData::DFExponent.

◆ scanPrefix()

auto scanPrefix ( const char * p,
const char * stop,
int base )
static

Definition at line 371 of file qlocale_tools.cpp.

Referenced by qstrntoll(), and qstrntoull().

Here is the caller graph for this function: