! @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 */
| 10212 | @return whether object creation completed |
| 10213 | */ |
| 10214 | bool get_cbor_object(const std::size_t len, |
| 10215 | const cbor_tag_handler_t tag_handler) |
| 10216 | { |
| 10217 | if (JSON_HEDLEY_UNLIKELY(!sax->start_object(len))) |
| 10218 | { |
| 10219 | return false; |
| 10220 | } |
| 10221 | |
| 10222 | if (len != 0) |
| 10223 | { |
| 10224 | string_t key; |
| 10225 | if (len != static_cast<std::size_t>(-1)) |
| 10226 | { |
| 10227 | for (std::size_t i = 0; i < len; ++i) |
| 10228 | { |
| 10229 | get(); |
| 10230 | if (JSON_HEDLEY_UNLIKELY(!get_cbor_string(key) || !sax->key(key))) |
| 10231 | { |
| 10232 | return false; |
| 10233 | } |
| 10234 | |
| 10235 | if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(true, tag_handler))) |
| 10236 | { |
| 10237 | return false; |
| 10238 | } |
| 10239 | key.clear(); |
| 10240 | } |
| 10241 | } |
| 10242 | else |
| 10243 | { |
| 10244 | while (get() != 0xFF) |
| 10245 | { |
| 10246 | if (JSON_HEDLEY_UNLIKELY(!get_cbor_string(key) || !sax->key(key))) |
| 10247 | { |
| 10248 | return false; |
| 10249 | } |
| 10250 | |
| 10251 | if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(true, tag_handler))) |
| 10252 | { |
| 10253 | return false; |
| 10254 | } |
| 10255 | key.clear(); |
| 10256 | } |
| 10257 | } |
| 10258 | } |
| 10259 | |
| 10260 | return sax->end_object(); |
| 10261 | } |
| 10262 | |
| 10263 | ///////////// |
| 10264 | // MsgPack // |
nothing calls this directly
no test coverage detected