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

Method calc_bson_object_size

Source/Utils/json.hpp:13926–13935  ·  view source on GitHub ↗

! @brief Calculates the size of the BSON serialization of the given JSON-object @a j. @param[in] j JSON value to serialize @pre j.type() == value_t::object */

Source from the content-addressed store, hash-verified

13924 @pre j.type() == value_t::object
13925 */
13926 static std::size_t calc_bson_object_size(const typename BasicJsonType::object_t& value)
13927 {
13928 std::size_t document_size = std::accumulate(value.begin(), value.end(), std::size_t(0),
13929 [](size_t result, const typename BasicJsonType::object_t::value_type& el)
13930 {
13931 return result += calc_bson_element_size(el.first, el.second);
13932 });
13933
13934 return sizeof(std::int32_t) + document_size + 1ul;
13935 }
13936
13937 /*!
13938 @param[in] j JSON value to serialize

Callers

nothing calls this directly

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected