![]() |
simdjson 4.6.4
Ridiculously Fast JSON
|
A type representing a JSON number. More...
#include <json_type.h>
Public Member Functions | |
| simdjson_inline ondemand::number_type | get_number_type () const noexcept |
| return the automatically determined type of the number: number_type::floating_point_number, number_type::signed_integer or number_type::unsigned_integer. | |
| simdjson_inline bool | is_uint64 () const noexcept |
| return true if the automatically determined type of the number is number_type::unsigned_integer. | |
| simdjson_inline uint64_t | get_uint64 () const noexcept |
| return the value as a uint64_t, only valid if is_uint64() is true. | |
| simdjson_inline | operator uint64_t () const noexcept |
| simdjson_inline bool | is_int64 () const noexcept |
| return true if the automatically determined type of the number is number_type::signed_integer. | |
| simdjson_inline int64_t | get_int64 () const noexcept |
| return the value as a int64_t, only valid if is_int64() is true. | |
| simdjson_inline | operator int64_t () const noexcept |
| simdjson_inline bool | is_double () const noexcept |
| return true if the automatically determined type of the number is number_type::floating_point_number. | |
| simdjson_inline double | get_double () const noexcept |
| return the value as a double, only valid if is_double() is true. | |
| simdjson_inline | operator double () const noexcept |
| simdjson_inline double | as_double () const noexcept |
| Convert the number to a double. | |
Protected Member Functions | |
| simdjson_inline void | append_s64 (int64_t value) noexcept |
| Store a signed 64-bit value to the number. | |
| simdjson_inline void | append_u64 (uint64_t value) noexcept |
| Store an unsigned 64-bit value to the number. | |
| simdjson_inline void | append_double (double value) noexcept |
| Store a double value to the number. | |
| simdjson_inline void | skip_double () noexcept |
| Specifies that the value is a double, but leave it undefined. | |
Protected Attributes | ||
| union { | ||
| double floating_point_number | ||
| int64_t signed_integer | ||
| uint64_t unsigned_integer | ||
| } | payload | |
| End of friend declarations. | ||
| number_type | type {number_type::signed_integer} | |
A type representing a JSON number.
The design of the struct is deliberately straight-forward. All functions return standard values with no error check.
Definition at line 33 of file json_type.h.
|
protectednoexcept |
Store a double value to the number.
Definition at line 95 of file json_type-inl.h.
|
protectednoexcept |
Store a signed 64-bit value to the number.
Definition at line 85 of file json_type-inl.h.
|
protectednoexcept |
Store an unsigned 64-bit value to the number.
Definition at line 90 of file json_type-inl.h.
|
noexcept |
Convert the number to a double.
Though it always succeed, the conversion may be lossy if the number cannot be represented exactly.
Definition at line 75 of file json_type-inl.h.
|
noexcept |
return the value as a double, only valid if is_double() is true.
Definition at line 67 of file json_type-inl.h.
|
noexcept |
return the value as a int64_t, only valid if is_int64() is true.
Definition at line 55 of file json_type-inl.h.
|
noexcept |
return the automatically determined type of the number: number_type::floating_point_number, number_type::signed_integer or number_type::unsigned_integer.
enum class number_type { floating_point_number=1, /// a binary64 number signed_integer, /// a signed integer that fits in a 64-bit word using two's complement unsigned_integer /// a positive integer larger or equal to 1<<63 };
Definition at line 35 of file json_type-inl.h.
|
noexcept |
return the value as a uint64_t, only valid if is_uint64() is true.
Definition at line 43 of file json_type-inl.h.
|
noexcept |
return true if the automatically determined type of the number is number_type::floating_point_number.
Definition at line 63 of file json_type-inl.h.
|
noexcept |
return true if the automatically determined type of the number is number_type::signed_integer.
Definition at line 51 of file json_type-inl.h.
|
noexcept |
return true if the automatically determined type of the number is number_type::unsigned_integer.
Definition at line 39 of file json_type-inl.h.
|
noexcept |
Definition at line 71 of file json_type-inl.h.
|
noexcept |
Definition at line 59 of file json_type-inl.h.
|
noexcept |
Definition at line 47 of file json_type-inl.h.
|
protectednoexcept |
Specifies that the value is a double, but leave it undefined.
Definition at line 100 of file json_type-inl.h.
| double simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number::floating_point_number |
Definition at line 116 of file json_type.h.
| union { ... } simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number::payload |
End of friend declarations.
Our attributes are a union type (size = 64 bits) followed by a type indicator.
| int64_t simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number::signed_integer |
Definition at line 117 of file json_type.h.
|
protected |
Definition at line 120 of file json_type.h.
| uint64_t simdjson::SIMDJSON_IMPLEMENTATION::ondemand::number::unsigned_integer |
Definition at line 118 of file json_type.h.