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