MCPcopy Create free account
hub / github.com/AllentDan/LibtorchTutorials / write_bson_integer

Method write_bson_integer

lesson6-Segmentation/json.hpp:13716–13729  ·  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

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected