! @param[in] len the length of the object or std::size_t(-1) for an object of indefinite size @return whether object creation completed */
| 5962 | @return whether object creation completed |
| 5963 | */ |
| 5964 | bool get_cbor_object(const std::size_t len) |
| 5965 | { |
| 5966 | if (JSON_HEDLEY_UNLIKELY(not sax->start_object(len))) |
| 5967 | { |
| 5968 | return false; |
| 5969 | } |
| 5970 | |
| 5971 | string_t key; |
| 5972 | if (len != std::size_t(-1)) |
| 5973 | { |
| 5974 | for (std::size_t i = 0; i < len; ++i) |
| 5975 | { |
| 5976 | get(); |
| 5977 | if (JSON_HEDLEY_UNLIKELY(not get_cbor_string(key) or not sax->key(key))) |
| 5978 | { |
| 5979 | return false; |
| 5980 | } |
| 5981 | |
| 5982 | if (JSON_HEDLEY_UNLIKELY(not parse_cbor_internal())) |
| 5983 | { |
| 5984 | return false; |
| 5985 | } |
| 5986 | key.clear(); |
| 5987 | } |
| 5988 | } |
| 5989 | else |
| 5990 | { |
| 5991 | while (get() != 0xFF) |
| 5992 | { |
| 5993 | if (JSON_HEDLEY_UNLIKELY(not get_cbor_string(key) or not sax->key(key))) |
| 5994 | { |
| 5995 | return false; |
| 5996 | } |
| 5997 | |
| 5998 | if (JSON_HEDLEY_UNLIKELY(not parse_cbor_internal())) |
| 5999 | { |
| 6000 | return false; |
| 6001 | } |
| 6002 | key.clear(); |
| 6003 | } |
| 6004 | } |
| 6005 | |
| 6006 | return sax->end_object(); |
| 6007 | } |
| 6008 | |
| 6009 | ///////////// |
| 6010 | // MsgPack // |
nothing calls this directly
no test coverage detected