| 8621 | */ |
| 8622 | template<typename NumberType> |
| 8623 | bool get_bson_binary(const NumberType len, binary_t& result) |
| 8624 | { |
| 8625 | if (JSON_HEDLEY_UNLIKELY(len < 0)) |
| 8626 | { |
| 8627 | auto last_token = get_token_string(); |
| 8628 | return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::bson, "byte array length cannot be negative, is " + std::to_string(len), "binary"), BasicJsonType())); |
| 8629 | } |
| 8630 | |
| 8631 | // All BSON binary values have a subtype |
| 8632 | std::uint8_t subtype{}; |
| 8633 | get_number<std::uint8_t>(input_format_t::bson, subtype); |
| 8634 | result.set_subtype(subtype); |
| 8635 | |
| 8636 | return get_binary(input_format_t::bson, len, result); |
| 8637 | } |
| 8638 | |
| 8639 | /*! |
| 8640 | @brief Read a BSON document element of the given @a element_type. |
nothing calls this directly
no test coverage detected