MCPcopy Create free account
hub / github.com/arun11299/cpp-jwt / parse_bson_element_list

Method parse_bson_element_list

include/jwt/json/json.hpp:7974–8006  ·  view source on GitHub ↗

! @brief Read a BSON element list (as specified in the BSON-spec) The same binary layout is used for objects and arrays, hence it must be indicated with the argument @a is_array which one is expected (true --> array, false --> object). @param[in] is_array Determines if the element list being read is to be treated as an object (@a is_array == false), or

Source from the content-addressed store, hash-verified

7972 @return whether a valid BSON-object/array was passed to the SAX parser
7973 */
7974 bool parse_bson_element_list(const bool is_array)
7975 {
7976 string_t key;
7977
7978 while (auto element_type = get())
7979 {
7980 if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::bson, "element list")))
7981 {
7982 return false;
7983 }
7984
7985 const std::size_t element_type_parse_position = chars_read;
7986 if (JSON_HEDLEY_UNLIKELY(!get_bson_cstr(key)))
7987 {
7988 return false;
7989 }
7990
7991 if (!is_array && !sax->key(key))
7992 {
7993 return false;
7994 }
7995
7996 if (JSON_HEDLEY_UNLIKELY(!parse_bson_element_internal(element_type, element_type_parse_position)))
7997 {
7998 return false;
7999 }
8000
8001 // get_bson_cstr only appends
8002 key.clear();
8003 }
8004
8005 return true;
8006 }
8007
8008 /*!
8009 @brief Reads an array from the BSON input and passes it to the SAX-parser.

Callers

nothing calls this directly

Calls 2

getFunction · 0.85
keyMethod · 0.45

Tested by

no test coverage detected