From 4a5277d09db5546645b95df3896eb2c50499d9d2 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Mon, 20 Jul 2020 14:11:43 +0200 Subject: [PATCH] :pencil: update documentation --- doc/mkdocs/docs/features/binary_formats/ubjson.md | 2 +- doc/mkdocs/docs/home/exceptions.md | 14 ++++++++++++++ include/nlohmann/json.hpp | 2 +- single_include/nlohmann/json.hpp | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/doc/mkdocs/docs/features/binary_formats/ubjson.md b/doc/mkdocs/docs/features/binary_formats/ubjson.md index cb01cfde..050b4ec5 100644 --- a/doc/mkdocs/docs/features/binary_formats/ubjson.md +++ b/doc/mkdocs/docs/features/binary_formats/ubjson.md @@ -28,6 +28,7 @@ number_unsigned | 128..255 | uint8 | `U` number_unsigned | 256..32767 | int16 | `I` number_unsigned | 32768..2147483647 | int32 | `l` number_unsigned | 2147483648..9223372036854775807 | int64 | `L` +number_unsigned | 2147483649..18446744073709551615 | high-precision | `H` number_float | *any value* | float64 | `D` string | *with shortest length indicator* | string | `S` array | *see notes on optimized format* | array | `[` @@ -44,7 +45,6 @@ object | *see notes on optimized format* | map | `{` The following values can **not** be converted to a UBJSON value: - strings with more than 9223372036854775807 bytes (theoretical) - - unsigned integer numbers above 9223372036854775807 !!! info "Unused UBJSON markers" diff --git a/doc/mkdocs/docs/home/exceptions.md b/doc/mkdocs/docs/home/exceptions.md index d7430ccc..e1e1d13b 100644 --- a/doc/mkdocs/docs/home/exceptions.md +++ b/doc/mkdocs/docs/home/exceptions.md @@ -279,6 +279,16 @@ The parsing of the corresponding BSON record type is not implemented (yet). [json.exception.parse_error.114] parse error at byte 5: Unsupported BSON record type 0xFF ``` +### json.exception.parse_error.115 + +A UBJSON high-precision number could not be parsed. + +!!! failure "Example message" + + ``` + [json.exception.parse_error.115] parse error at byte 5: syntax error while parsing UBJSON high-precision number: invalid number text: 1A + ``` + ## Iterator errors This exception is thrown if iterators passed to a library function do not match @@ -765,6 +775,10 @@ UBJSON and BSON only support integer numbers up to 9223372036854775807. number overflow serializing '9223372036854775808' ``` +!!! note + + Since version 3.9.0, integer numbers beyond int64 are serialized as high-precision UBJSON numbers, and this exception does not further occur. + ### json.exception.out_of_range.408 The size (following `#`) of an UBJSON array or object exceeds the maximal capacity. diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index dd8842a6..e9f57795 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -7200,6 +7200,7 @@ class basic_json number_unsigned | 256..32767 | int16 | `I` number_unsigned | 32768..2147483647 | int32 | `l` number_unsigned | 2147483648..9223372036854775807 | int64 | `L` + number_unsigned | 2147483649..18446744073709551615 | high-precision | `H` number_float | *any value* | float64 | `D` string | *with shortest length indicator* | string | `S` array | *see notes on optimized format* | array | `[` @@ -7210,7 +7211,6 @@ class basic_json @note The following values can **not** be converted to a UBJSON value: - strings with more than 9223372036854775807 bytes (theoretical) - - unsigned integer numbers above 9223372036854775807 @note The following markers are not used in the conversion: - `Z`: no-op values are not created. diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 48504a85..30e994a3 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -23433,6 +23433,7 @@ class basic_json number_unsigned | 256..32767 | int16 | `I` number_unsigned | 32768..2147483647 | int32 | `l` number_unsigned | 2147483648..9223372036854775807 | int64 | `L` + number_unsigned | 2147483649..18446744073709551615 | high-precision | `H` number_float | *any value* | float64 | `D` string | *with shortest length indicator* | string | `S` array | *see notes on optimized format* | array | `[` @@ -23443,7 +23444,6 @@ class basic_json @note The following values can **not** be converted to a UBJSON value: - strings with more than 9223372036854775807 bytes (theoretical) - - unsigned integer numbers above 9223372036854775807 @note The following markers are not used in the conversion: - `Z`: no-op values are not created.