| 7867 | */ |
| 7868 | template<typename NumberType> |
| 7869 | bool get_bson_binary(const NumberType len, binary_t& result) |
| 7870 | { |
| 7871 | if (JSON_HEDLEY_UNLIKELY(len < 0)) |
| 7872 | { |
| 7873 | auto last_token = get_token_string(); |
| 7874 | 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"))); |
| 7875 | } |
| 7876 | |
| 7877 | // All BSON binary values have a subtype |
| 7878 | std::uint8_t subtype{}; |
| 7879 | get_number<std::uint8_t>(input_format_t::bson, subtype); |
| 7880 | result.set_subtype(subtype); |
| 7881 | |
| 7882 | return get_binary(input_format_t::bson, len, result); |
| 7883 | } |
| 7884 | |
| 7885 | /*! |
| 7886 | @brief Read a BSON document element of the given @a element_type. |
nothing calls this directly
no test coverage detected