MCPcopy Create free account
hub / github.com/InkboxSoftware/all-screen-keyboard / write_bson_integer

Method write_bson_integer

keyboard/src/json.hpp:16889–16902  ·  view source on GitHub ↗

! @brief Writes a BSON element with key @a name and integer @a value */

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected