! @brief Writes a BSON element with key @a name and integer @a value */
| 13714 | @brief Writes a BSON element with key @a name and integer @a value |
| 13715 | */ |
| 13716 | void write_bson_integer(const string_t& name, |
| 13717 | const std::int64_t value) |
| 13718 | { |
| 13719 | if ((std::numeric_limits<std::int32_t>::min)() <= value && value <= (std::numeric_limits<std::int32_t>::max)()) |
| 13720 | { |
| 13721 | write_bson_entry_header(name, 0x10); // int32 |
| 13722 | write_number<std::int32_t, true>(static_cast<std::int32_t>(value)); |
| 13723 | } |
| 13724 | else |
| 13725 | { |
| 13726 | write_bson_entry_header(name, 0x12); // int64 |
| 13727 | write_number<std::int64_t, true>(static_cast<std::int64_t>(value)); |
| 13728 | } |
| 13729 | } |
| 13730 | |
| 13731 | /*! |
| 13732 | @return The size of the BSON-encoded unsigned integer in @a j |
nothing calls this directly
no outgoing calls
no test coverage detected