! @return whether object creation completed */
| 11662 | @return whether object creation completed |
| 11663 | */ |
| 11664 | bool get_ubjson_object() |
| 11665 | { |
| 11666 | std::pair<std::size_t, char_int_type> size_and_type; |
| 11667 | if (JSON_HEDLEY_UNLIKELY(!get_ubjson_size_type(size_and_type))) |
| 11668 | { |
| 11669 | return false; |
| 11670 | } |
| 11671 | |
| 11672 | // do not accept ND-array size in objects in BJData |
| 11673 | if (input_format == input_format_t::bjdata && size_and_type.first != npos && (size_and_type.second & (1 << 8)) != 0) |
| 11674 | { |
| 11675 | auto last_token = get_token_string(); |
| 11676 | return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, |
| 11677 | exception_message(input_format, "BJData object does not support ND-array size in optimized format", "object"), nullptr)); |
| 11678 | } |
| 11679 | |
| 11680 | string_t key; |
| 11681 | if (size_and_type.first != npos) |
| 11682 | { |
| 11683 | if (JSON_HEDLEY_UNLIKELY(!sax->start_object(size_and_type.first))) |
| 11684 | { |
| 11685 | return false; |
| 11686 | } |
| 11687 | |
| 11688 | if (size_and_type.second != 0) |
| 11689 | { |
| 11690 | for (std::size_t i = 0; i < size_and_type.first; ++i) |
| 11691 | { |
| 11692 | if (JSON_HEDLEY_UNLIKELY(!get_ubjson_string(key) || !sax->key(key))) |
| 11693 | { |
| 11694 | return false; |
| 11695 | } |
| 11696 | if (JSON_HEDLEY_UNLIKELY(!get_ubjson_value(size_and_type.second))) |
| 11697 | { |
| 11698 | return false; |
| 11699 | } |
| 11700 | key.clear(); |
| 11701 | } |
| 11702 | } |
| 11703 | else |
| 11704 | { |
| 11705 | for (std::size_t i = 0; i < size_and_type.first; ++i) |
| 11706 | { |
| 11707 | if (JSON_HEDLEY_UNLIKELY(!get_ubjson_string(key) || !sax->key(key))) |
| 11708 | { |
| 11709 | return false; |
| 11710 | } |
| 11711 | if (JSON_HEDLEY_UNLIKELY(!parse_ubjson_internal())) |
| 11712 | { |
| 11713 | return false; |
| 11714 | } |
| 11715 | key.clear(); |
| 11716 | } |
| 11717 | } |
| 11718 | } |
| 11719 | else |
| 11720 | { |
| 11721 | if (JSON_HEDLEY_UNLIKELY(!sax->start_object(static_cast<std::size_t>(-1)))) |
nothing calls this directly
no test coverage detected