MCPcopy Create free account
hub / github.com/AllentDan/LibtorchTutorials / get_cbor_object

Method get_cbor_object

lesson6-Segmentation/json.hpp:8714–8758  ·  view source on GitHub ↗

! @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 */

Source from the content-addressed store, hash-verified

8712 @return whether object creation completed
8713 */
8714 bool get_cbor_object(const std::size_t len,
8715 const cbor_tag_handler_t tag_handler)
8716 {
8717 if (JSON_HEDLEY_UNLIKELY(!sax->start_object(len)))
8718 {
8719 return false;
8720 }
8721
8722 string_t key;
8723 if (len != std::size_t(-1))
8724 {
8725 for (std::size_t i = 0; i < len; ++i)
8726 {
8727 get();
8728 if (JSON_HEDLEY_UNLIKELY(!get_cbor_string(key) || !sax->key(key)))
8729 {
8730 return false;
8731 }
8732
8733 if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(true, tag_handler)))
8734 {
8735 return false;
8736 }
8737 key.clear();
8738 }
8739 }
8740 else
8741 {
8742 while (get() != 0xFF)
8743 {
8744 if (JSON_HEDLEY_UNLIKELY(!get_cbor_string(key) || !sax->key(key)))
8745 {
8746 return false;
8747 }
8748
8749 if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(true, tag_handler)))
8750 {
8751 return false;
8752 }
8753 key.clear();
8754 }
8755 }
8756
8757 return sax->end_object();
8758 }
8759
8760 /////////////
8761 // MsgPack //

Callers

nothing calls this directly

Calls 5

getFunction · 0.85
clearMethod · 0.80
start_objectMethod · 0.45
keyMethod · 0.45
end_objectMethod · 0.45

Tested by

no test coverage detected