Namespace for utilities converting between JSON number text and numeric types.

Synopsis

Declared in <bdljsn_numberutil.h>

struct NumberUtil;

Description

This struct provides a namespace for a suite of functions that convert between a JSON formated numeric value and various numerical types. The valid syntax for a JSON formatted numeric value is spelled out in https://www.rfc‐editor.org/rfc/rfc8259#section‐6.

Type Aliases

Name

Description

Int64

This typedef is an alias to bsls::Types::Int64.

Uint64

This typedef is an alias to bsls::Types::Uint64.

Enums

Name

Description

Unnamed enum

Special integer conversion status values.

Static Member Functions

Name

Description

areEqual

Return true if the specified lhs and rhs represent the same numeric value, and false otherwise.

asDecimal64

Return the closest floating point representation to the specified value.

asDecimal64Exact

Load the specified result with the specified value.

asDouble

Same as the related overload above for asDouble.

asFloat

Return the closest floating point representation to the specified value.

asInt

Same as the related overload above for asInt.

asInt64

Same as the related overload above for asInt64.

asInteger

Load into the specified result the integer conversion of value.

asLong

Same as the related overload above for asLong.

asLonglong

Same as the related overload above for asLonglong.

asShort

Load the specified result with the specified value.

asUint

Same as the related overload above for asUint.

asUint64

Same as the related overload above for asUint64.

asUlong

Load the specified result with the specified value.

asUlonglong

Same as the related overload above for asUlonglong.

asUshort

Same as the related overload above for asUshort.

isIntegralNumber

Return true if the specified value is a valid integral JSON number.

isValidNumber

Return true if the specified value is a valid JSON number.

stringify

stringify overloads

Created with MrDocs