MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / calc_bson_entry_header_size

Method calc_bson_entry_header_size

Source/Utils/json.hpp:13628–13638  ·  view source on GitHub ↗

! @return The size of a BSON document entry header, including the id marker and the entry name size (and its null-terminator). */

Source from the content-addressed store, hash-verified

13626 and the entry name size (and its null-terminator).
13627 */
13628 static std::size_t calc_bson_entry_header_size(const string_t& name)
13629 {
13630 const auto it = name.find(static_cast<typename string_t::value_type>(0));
13631 if (JSON_HEDLEY_UNLIKELY(it != BasicJsonType::string_t::npos))
13632 {
13633 JSON_THROW(out_of_range::create(409,
13634 "BSON key cannot contain code point U+0000 (at byte " + std::to_string(it) + ")"));
13635 }
13636
13637 return /*id*/ 1ul + name.size() + /*zero-terminator*/1u;
13638 }
13639
13640 /*!
13641 @brief Writes the given @a element_type and @a name to the output adapter

Callers

nothing calls this directly

Calls 3

createFunction · 0.85
findMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected