! @param[in] len the length of the object or static_cast (-1) for an object of indefinite size @param[in] tag_handler how CBOR tags should be treated @return whether object creation completed */
| 10286 | @return whether object creation completed |
| 10287 | */ |
| 10288 | bool get_cbor_object(const std::size_t len, |
| 10289 | const cbor_tag_handler_t tag_handler) |
| 10290 | { |
| 10291 | if (JSON_HEDLEY_UNLIKELY(!sax->start_object(len))) |
| 10292 | { |
| 10293 | return false; |
| 10294 | } |
| 10295 | |
| 10296 | if (len != 0) |
| 10297 | { |
| 10298 | string_t key; |
| 10299 | if (len != static_cast<std::size_t>(-1)) |
| 10300 | { |
| 10301 | for (std::size_t i = 0; i < len; ++i) |
| 10302 | { |
| 10303 | get(); |
| 10304 | if (JSON_HEDLEY_UNLIKELY(!get_cbor_string(key) || !sax->key(key))) |
| 10305 | { |
| 10306 | return false; |
| 10307 | } |
| 10308 | |
| 10309 | if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(true, tag_handler))) |
| 10310 | { |
| 10311 | return false; |
| 10312 | } |
| 10313 | key.clear(); |
| 10314 | } |
| 10315 | } |
| 10316 | else |
| 10317 | { |
| 10318 | while (get() != 0xFF) |
| 10319 | { |
| 10320 | if (JSON_HEDLEY_UNLIKELY(!get_cbor_string(key) || !sax->key(key))) |
| 10321 | { |
| 10322 | return false; |
| 10323 | } |
| 10324 | |
| 10325 | if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(true, tag_handler))) |
| 10326 | { |
| 10327 | return false; |
| 10328 | } |
| 10329 | key.clear(); |
| 10330 | } |
| 10331 | } |
| 10332 | } |
| 10333 | |
| 10334 | return sax->end_object(); |
| 10335 | } |
| 10336 | |
| 10337 | ///////////// |
| 10338 | // MsgPack // |
nothing calls this directly
no test coverage detected