@@ -91,6 +91,7 @@ json.exception.parse_error.109 | parse error: array index 'one' is not a number
...
@@ -91,6 +91,7 @@ json.exception.parse_error.109 | parse error: array index 'one' is not a number
json.exception.parse_error.110 | parse error at 1: cannot read 2 bytes from vector | When parsing CBOR or MessagePack, the byte vector ends before the complete value has been read.
json.exception.parse_error.110 | parse error at 1: cannot read 2 bytes from vector | When parsing CBOR or MessagePack, the byte vector ends before the complete value has been read.
json.exception.parse_error.112 | parse error at 1: error reading CBOR; last byte: 0xF8 | Not all types of CBOR or MessagePack are supported. This exception occurs if an unsupported byte was read.
json.exception.parse_error.112 | parse error at 1: error reading CBOR; last byte: 0xF8 | Not all types of CBOR or MessagePack are supported. This exception occurs if an unsupported byte was read.
json.exception.parse_error.113 | parse error at 2: expected a CBOR string; last byte: 0x98 | While parsing a map key, a value that is not a string has been read.
json.exception.parse_error.113 | parse error at 2: expected a CBOR string; last byte: 0x98 | While parsing a map key, a value that is not a string has been read.
json.exception.parse_error.114 | parse error: Unsupported BSON record type 0x0F | The parsing of the corresponding BSON record type is not implemented (yet).
@note For an input with n bytes, 1 is the index of the first character and n+1
@note For an input with n bytes, 1 is the index of the first character and n+1
is the index of the terminating null byte or the end of file. This also
is the index of the terminating null byte or the end of file. This also
returnsax->parse_error(element_type_parse_position,element_type_str,parse_error::create(114,element_type_parse_position,"Unsupported BSON record type 0x"+element_type_str));
}
}
}
/*!
@brief Read a BSON element list (as specified in the BSON-spec) from the input
and passes it to the SAX-parser.
The same binary layout is used for objects and arrays, hence it must
be indicated with the argument @a is_array which one is expected
(true --> array, false --> object).
@param is_array Determines if the element list being read is to be treated as
an object (@a is_array == false), or as an array (@a is_array == true).
@return whether a valid BSON-object/array was passed to the SAX parser
JSON_THROW(type_error::create(317,"JSON value cannot be serialized to requested format"));
JSON_THROW(type_error::create(317,"JSON value of type "+std::to_string(static_cast<std::uint8_t>(j.type()))+" cannot be serialized to requested format"));
@@ -690,6 +690,7 @@ json.exception.parse_error.109 | parse error: array index 'one' is not a number
...
@@ -690,6 +690,7 @@ json.exception.parse_error.109 | parse error: array index 'one' is not a number
json.exception.parse_error.110 | parse error at 1: cannot read 2 bytes from vector | When parsing CBOR or MessagePack, the byte vector ends before the complete value has been read.
json.exception.parse_error.110 | parse error at 1: cannot read 2 bytes from vector | When parsing CBOR or MessagePack, the byte vector ends before the complete value has been read.
json.exception.parse_error.112 | parse error at 1: error reading CBOR; last byte: 0xF8 | Not all types of CBOR or MessagePack are supported. This exception occurs if an unsupported byte was read.
json.exception.parse_error.112 | parse error at 1: error reading CBOR; last byte: 0xF8 | Not all types of CBOR or MessagePack are supported. This exception occurs if an unsupported byte was read.
json.exception.parse_error.113 | parse error at 2: expected a CBOR string; last byte: 0x98 | While parsing a map key, a value that is not a string has been read.
json.exception.parse_error.113 | parse error at 2: expected a CBOR string; last byte: 0x98 | While parsing a map key, a value that is not a string has been read.
json.exception.parse_error.114 | parse error: Unsupported BSON record type 0x0F | The parsing of the corresponding BSON record type is not implemented (yet).
@note For an input with n bytes, 1 is the index of the first character and n+1
@note For an input with n bytes, 1 is the index of the first character and n+1
is the index of the terminating null byte or the end of file. This also
is the index of the terminating null byte or the end of file. This also
...
@@ -6110,7 +6111,12 @@ class binary_reader
...
@@ -6110,7 +6111,12 @@ class binary_reader
private:
private:
/*!
/*!
@return whether array creation completed
@brief Parses a C-style string from the BSON input.
@param [out] result A reference to the string variable where the read string
is to be stored.
@return `true` if the \x00-byte indicating the end of the
string was encountered before the EOF.
`false` indicates an unexpected EOF.
*/
*/
boolget_bson_cstr(string_t&result)
boolget_bson_cstr(string_t&result)
{
{
...
@@ -6132,12 +6138,112 @@ class binary_reader
...
@@ -6132,12 +6138,112 @@ class binary_reader
returntrue;
returntrue;
}
}
boolparse_bson_entries(boolis_array)
/*!
@brief Parses a zero-terminated string of length @a len from the BSON input.
@param [in] len The length (including the zero-byte at the end) of the string to be read.
@param [out] result A reference to the string variable where the read string
is to be stored.
@tparam NumberType The type of the length @a len
@pre len > 0
@return `true` if the string was successfully parsed
returnsax->parse_error(element_type_parse_position,element_type_str,parse_error::create(114,element_type_parse_position,"Unsupported BSON record type 0x"+element_type_str));
}
}
}
/*!
@brief Read a BSON element list (as specified in the BSON-spec) from the input
and passes it to the SAX-parser.
The same binary layout is used for objects and arrays, hence it must
be indicated with the argument @a is_array which one is expected
(true --> array, false --> object).
@param is_array Determines if the element list being read is to be treated as
an object (@a is_array == false), or as an array (@a is_array == true).
@return whether a valid BSON-object/array was passed to the SAX parser
JSON_THROW(type_error::create(317,"JSON value cannot be serialized to requested format"));
JSON_THROW(type_error::create(317,"JSON value of type "+std::to_string(static_cast<std::uint8_t>(j.type()))+" cannot be serialized to requested format"));
break;
break;
casevalue_t::discarded:
casevalue_t::discarded:
break;
break;
...
@@ -18080,7 +18144,13 @@ class basic_json
...
@@ -18080,7 +18144,13 @@ class basic_json
}
}
/*!
@brief Serializes the given JSON object `j` to BSON and returns a vector
containing the corresponding BSON-representation.
@param j The JSON object to convert to BSON.
@return The BSON representation of the JSON input `j`.
@pre The input `j` shall be an object: `j.is_object() == true`