! @param[in] len the length of the object or std::size_t(-1) for an object of indefinite size @param[in] tag_handler how CBOR tags should be treated @return whether object creation completed */
| 8711 | @return whether object creation completed |
| 8712 | */ |
| 8713 | bool get_cbor_object(const std::size_t len, |
| 8714 | const cbor_tag_handler_t tag_handler) |
| 8715 | { |
| 8716 | if (JSON_HEDLEY_UNLIKELY(!sax->start_object(len))) |
| 8717 | { |
| 8718 | return false; |
| 8719 | } |
| 8720 | |
| 8721 | string_t key; |
| 8722 | if (len != std::size_t(-1)) |
| 8723 | { |
| 8724 | for (std::size_t i = 0; i < len; ++i) |
| 8725 | { |
| 8726 | get(); |
| 8727 | if (JSON_HEDLEY_UNLIKELY(!get_cbor_string(key) || !sax->key(key))) |
| 8728 | { |
| 8729 | return false; |
| 8730 | } |
| 8731 | |
| 8732 | if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(true, tag_handler))) |
| 8733 | { |
| 8734 | return false; |
| 8735 | } |
| 8736 | key.clear(); |
| 8737 | } |
| 8738 | } |
| 8739 | else |
| 8740 | { |
| 8741 | while (get() != 0xFF) |
| 8742 | { |
| 8743 | if (JSON_HEDLEY_UNLIKELY(!get_cbor_string(key) || !sax->key(key))) |
| 8744 | { |
| 8745 | return false; |
| 8746 | } |
| 8747 | |
| 8748 | if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(true, tag_handler))) |
| 8749 | { |
| 8750 | return false; |
| 8751 | } |
| 8752 | key.clear(); |
| 8753 | } |
| 8754 | } |
| 8755 | |
| 8756 | return sax->end_object(); |
| 8757 | } |
| 8758 | |
| 8759 | ///////////// |
| 8760 | // MsgPack // |
nothing calls this directly
no test coverage detected