From daa3ca8a2e42446a3d7fd0ae83bcffa59713b6c7 Mon Sep 17 00:00:00 2001 From: Julian Becker Date: Tue, 16 Oct 2018 19:29:42 +0200 Subject: [PATCH] BSON: Adjusted documentation of `binary_writer::to_bson()` --- include/nlohmann/json.hpp | 7 ++++++- single_include/nlohmann/json.hpp | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 1b61e995..c973f0a0 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -6609,6 +6609,7 @@ class basic_json number_integer | 2147483648..9223372036854775807 | int64 | 0x12 number_unsigned | 0..2147483647 | int32 | 0x10 number_unsigned | 2147483648..9223372036854775807 | int64 | 0x12 + number_unsigned | 9223372036854775808..18446744073709551615| -- | -- number_float | *any value* | double | 0x01 string | *any value* | string | 0x02 array | *any value* | document | 0x04 @@ -6616,8 +6617,12 @@ class basic_json @warning The mapping is **incomplete**, since only JSON-objects (and things contained therein) can be serialized to BSON. + Also, integers larger than 9223372036854775807 cannot be serialized to BSON. - @pre The input `j` is required to be an object: `j.is_object() == true` + @throw out_of_range.407 if `j.is_number_unsigned() && j.get() > 9223372036854775807` + @throw type_error.317 if `!j.is_object()` + + @pre The input `j` is required to be an object: `j.is_object() == true`. @note Any BSON output created via @ref to_bson can be successfully parsed by @ref from_bson. diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 4bd80c54..87abf2ca 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -18195,6 +18195,7 @@ class basic_json number_integer | 2147483648..9223372036854775807 | int64 | 0x12 number_unsigned | 0..2147483647 | int32 | 0x10 number_unsigned | 2147483648..9223372036854775807 | int64 | 0x12 + number_unsigned | 9223372036854775808..18446744073709551615| -- | -- number_float | *any value* | double | 0x01 string | *any value* | string | 0x02 array | *any value* | document | 0x04 @@ -18202,8 +18203,12 @@ class basic_json @warning The mapping is **incomplete**, since only JSON-objects (and things contained therein) can be serialized to BSON. + Also, integers larger than 9223372036854775807 cannot be serialized to BSON. - @pre The input `j` is required to be an object: `j.is_object() == true` + @throw out_of_range.407 if `j.is_number_unsigned() && j.get() > 9223372036854775807` + @throw type_error.317 if `!j.is_object()` + + @pre The input `j` is required to be an object: `j.is_object() == true`. @note Any BSON output created via @ref to_bson can be successfully parsed by @ref from_bson.