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
QJSNumberCoercion Class Reference

Implements the JavaScript double-to-int coercion. More...

#include <qjsnumbercoercion.h>

+ Collaboration diagram for QJSNumberCoercion:

Static Public Member Functions

static constexpr bool isInteger (double d)
 
static constexpr bool isArrayIndex (double d)
 
static constexpr bool isArrayIndex (qint64 i)
 
static constexpr bool isArrayIndex (quint64 i)
 
static constexpr int toInteger (double d)
 
static constexpr bool equals (double lhs, double rhs)
 

Detailed Description

Implements the JavaScript double-to-int coercion.

Since
6.1

Definition at line 12 of file qjsnumbercoercion.h.

Member Function Documentation

◆ equals()

static constexpr bool QJSNumberCoercion::equals ( double lhs,
double rhs )
inlinestaticconstexpr

Definition at line 60 of file qjsnumbercoercion.h.

References QT_WARNING_DISABLE_FLOAT_COMPARE, QT_WARNING_POP, and QT_WARNING_PUSH.

Referenced by isArrayIndex(), isInteger(), QQmlPrivate::jsExponentiate(), QJSPrimitiveValue::strictlyEquals(), QJSPrimitiveValue::toBoolean(), and toInteger().

+ Here is the caller graph for this function:

◆ isArrayIndex() [1/3]

bool QJSNumberCoercion::isArrayIndex ( double d)
inlinestaticconstexpr

Checks whether d contains a value that can serve as an index into an array. For that, d must be a non-negative value representable as an unsigned 32bit int.

Definition at line 28 of file qjsnumbercoercion.h.

References d, and equals().

+ Here is the call graph for this function:

◆ isArrayIndex() [2/3]

bool QJSNumberCoercion::isArrayIndex ( qint64 i)
inlinestaticconstexpr

Checks whether i contains a value that can serve as an index into an array. For that, d must be a non-negative value representable as an unsigned 32bit int.

Definition at line 36 of file qjsnumbercoercion.h.

References i.

◆ isArrayIndex() [3/3]

bool QJSNumberCoercion::isArrayIndex ( quint64 i)
inlinestaticconstexpr

Checks whether i contains a value that can serve as an index into an array. For that, d must be a value representable as an unsigned 32bit int.

Definition at line 41 of file qjsnumbercoercion.h.

References i.

◆ isInteger()

bool QJSNumberCoercion::isInteger ( double d)
inlinestaticconstexpr
Deprecated
6.7

Definition at line 16 of file qjsnumbercoercion.h.

References d, and equals().

Referenced by QQmlLocaleValueType::toString().

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

◆ toInteger()

int QJSNumberCoercion::toInteger ( double d)
inlinestaticconstexpr

Coerces the given d to a 32bit integer by JavaScript rules and returns the result.

Definition at line 46 of file qjsnumbercoercion.h.

References d, equals(), i, and toInteger().

Referenced by toInteger().

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

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