This class defines a value‐semantic type that represents a JSON number.

Synopsis

Declared in <bdljsn_jsonnumber.h>

class JsonNumber;

Description

Objects of this class have a value determined at construction and does not change except by assignment from or swap with another JsonNumber object. The value can be specified by supplying a string that conforms to the {JSON Textual Specification} or from one of the {Supported Types}. The value of a JSON object can be converted to any of those types; however, some of those conversions can be inexact.

Type Aliases

Name

Description

allocator_type

This typedef is an alias for allocator_type.

Enums

Name

Description

Unnamed enum

Undocumented symbol.

Member Functions

Name

Description

JsonNumber [constructor]

Constructors

operator=

Assignment operators

allocator [deprecated]

DEPRECATED: Use get_allocator() instead.

asDecimal64

Same as the related overload above for asDecimal64.

asDecimal64Exact

Load into result the closest Decimal64 representation.

asDouble

Same as the related overload above for asDouble.

asFloat

Return the closest floating point representation to this number.

asInt

Same as the related overload above for asInt.

asInt64

Same as the related overload above for asInt64.

asLong

Same as the related overload above for asLong.

asLonglong

Same as the related overload above for asLonglong.

asShort

Load into the specified result the integer value of this number.

asUint

Same as the related overload above for asUint.

asUint64

Same as the related overload above for asUint64.

asUlong

Same as the related overload above for asUlong.

asUlonglong

Same as the related overload above for asUlonglong.

asUshort

Same as the related overload above for asUshort.

get_allocator

Return the allocator used by this object to supply memory.

isEqual

Return true if this number and other represent the same value.

isIntegral

Return true if the value of this JsonNumber is an exact integer.

print

Write the value of this object to the specified output stream.

swap

Efficiently exchange the value of this object with that of other.

value

Return the textual representation of this JsonNumber.

operator BloombergLP::bslmf::NestedTraitDeclaration<JsonNumber, IsBitwiseMoveable>

Declare nested type traits for this type.

operator bdldfp::Decimal64

Same as the related overload above for operator Decimal_Type64.

operator double

Same as the related overload above for operator double.

operator float

Return the closest floating point representation to this number.

Static Member Functions

Name

Description

isValidNumber

Return true if the specified text complies with the grammar of a JSON number, and false otherwise.

Friends

Name

Description

BloombergLP::bdljsn::swap

Exchange the values of the specified a and b objects.

Non-Member Functions

Name

Description

operator!=

Same as the related overload above for operator!=.

operator!=

Return true if the specified lhs and rhs do not have the same value.

operator==

Same as the related overload above for operator==.

operator==

Return true if the specified lhs and rhs have the same value.

Created with MrDocs