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
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)
static constexpr double roundTowards0 (double d)

Detailed Description

Implements the JavaScript double-to-int coercion.

Since
6.1

Definition at line 13 of file qjsnumbercoercion.h.

Member Function Documentation

◆ equals()

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

Definition at line 61 of file qjsnumbercoercion.h.

◆ isArrayIndex() [1/3]

constexpr 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 29 of file qjsnumbercoercion.h.

◆ isArrayIndex() [2/3]

constexpr 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 37 of file qjsnumbercoercion.h.

◆ isArrayIndex() [3/3]

constexpr 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 42 of file qjsnumbercoercion.h.

◆ isInteger()

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

Definition at line 17 of file qjsnumbercoercion.h.

◆ roundTowards0()

constexpr double QJSNumberCoercion::roundTowards0 ( double d)
inlinestaticconstexpr

Rounds d towards 0 by JavaScript ToInteger rules and returns the result.

Definition at line 69 of file qjsnumbercoercion.h.

◆ toInteger()

constexpr int QJSNumberCoercion::toInteger ( double d)
inlinestaticconstexpr

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

Definition at line 47 of file qjsnumbercoercion.h.


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