! @brief Serializes the JSON value @a j to BSON and associates it with the key @a name. @param name The name to associate with the JSON entity @a j within the current BSON document @return The size of the BSON entry */
| 13878 | @return The size of the BSON entry |
| 13879 | */ |
| 13880 | void write_bson_element(const string_t& name, |
| 13881 | const BasicJsonType& j) |
| 13882 | { |
| 13883 | switch (j.type()) |
| 13884 | { |
| 13885 | case value_t::object: |
| 13886 | return write_bson_object_entry(name, *j.m_value.object); |
| 13887 | |
| 13888 | case value_t::array: |
| 13889 | return write_bson_array(name, *j.m_value.array); |
| 13890 | |
| 13891 | case value_t::binary: |
| 13892 | return write_bson_binary(name, *j.m_value.binary); |
| 13893 | |
| 13894 | case value_t::boolean: |
| 13895 | return write_bson_boolean(name, j.m_value.boolean); |
| 13896 | |
| 13897 | case value_t::number_float: |
| 13898 | return write_bson_double(name, j.m_value.number_float); |
| 13899 | |
| 13900 | case value_t::number_integer: |
| 13901 | return write_bson_integer(name, j.m_value.number_integer); |
| 13902 | |
| 13903 | case value_t::number_unsigned: |
| 13904 | return write_bson_unsigned(name, j.m_value.number_unsigned); |
| 13905 | |
| 13906 | case value_t::string: |
| 13907 | return write_bson_string(name, *j.m_value.string); |
| 13908 | |
| 13909 | case value_t::null: |
| 13910 | return write_bson_null(name); |
| 13911 | |
| 13912 | // LCOV_EXCL_START |
| 13913 | default: |
| 13914 | JSON_ASSERT(false); |
| 13915 | return; |
| 13916 | // LCOV_EXCL_STOP |
| 13917 | } |
| 13918 | } |
| 13919 | |
| 13920 | /*! |
| 13921 | @brief Calculates the size of the BSON serialization of the given |