! @brief Writes a BSON element with key @a name and integer @a value */
| 16887 | @brief Writes a BSON element with key @a name and integer @a value |
| 16888 | */ |
| 16889 | void write_bson_integer(const string_t& name, |
| 16890 | const std::int64_t value) |
| 16891 | { |
| 16892 | if ((std::numeric_limits<std::int32_t>::min)() <= value && value <= (std::numeric_limits<std::int32_t>::max)()) |
| 16893 | { |
| 16894 | write_bson_entry_header(name, 0x10); // int32 |
| 16895 | write_number<std::int32_t>(static_cast<std::int32_t>(value), true); |
| 16896 | } |
| 16897 | else |
| 16898 | { |
| 16899 | write_bson_entry_header(name, 0x12); // int64 |
| 16900 | write_number<std::int64_t>(static_cast<std::int64_t>(value), true); |
| 16901 | } |
| 16902 | } |
| 16903 | |
| 16904 | /*! |
| 16905 | @return The size of the BSON-encoded unsigned integer in @a j |
nothing calls this directly
no outgoing calls
no test coverage detected