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

Method calc_bson_array_size

Source/Utils/json.hpp:13775–13785  ·  view source on GitHub ↗

! @return The size of the BSON-encoded array @a value */

Source from the content-addressed store, hash-verified

13773 @return The size of the BSON-encoded array @a value
13774 */
13775 static std::size_t calc_bson_array_size(const typename BasicJsonType::array_t& value)
13776 {
13777 std::size_t array_index = 0ul;
13778
13779 const std::size_t embedded_document_size = std::accumulate(std::begin(value), std::end(value), std::size_t(0), [&array_index](std::size_t result, const typename BasicJsonType::array_t::value_type& el)
13780 {
13781 return result + calc_bson_element_size(std::to_string(array_index++), el);
13782 });
13783
13784 return sizeof(std::int32_t) + embedded_document_size + 1ul;
13785 }
13786
13787 /*!
13788 @return The size of the BSON-encoded binary array @a value

Callers

nothing calls this directly

Calls 2

beginFunction · 0.70
endFunction · 0.70

Tested by

no test coverage detected