! @param[in] len the length of the array or static_cast (-1) for an array of indefinite size @param[in] tag_handler how CBOR tags should be treated @return whether array creation completed */
| 10248 | @return whether array creation completed |
| 10249 | */ |
| 10250 | bool get_cbor_array(const std::size_t len, |
| 10251 | const cbor_tag_handler_t tag_handler) |
| 10252 | { |
| 10253 | if (JSON_HEDLEY_UNLIKELY(!sax->start_array(len))) |
| 10254 | { |
| 10255 | return false; |
| 10256 | } |
| 10257 | |
| 10258 | if (len != static_cast<std::size_t>(-1)) |
| 10259 | { |
| 10260 | for (std::size_t i = 0; i < len; ++i) |
| 10261 | { |
| 10262 | if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(true, tag_handler))) |
| 10263 | { |
| 10264 | return false; |
| 10265 | } |
| 10266 | } |
| 10267 | } |
| 10268 | else |
| 10269 | { |
| 10270 | while (get() != 0xFF) |
| 10271 | { |
| 10272 | if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(false, tag_handler))) |
| 10273 | { |
| 10274 | return false; |
| 10275 | } |
| 10276 | } |
| 10277 | } |
| 10278 | |
| 10279 | return sax->end_array(); |
| 10280 | } |
| 10281 | |
| 10282 | /*! |
| 10283 | @param[in] len the length of the object or static_cast<std::size_t>(-1) for an |
nothing calls this directly
no test coverage detected