TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ write_bson_unsigned()

template<typename BasicJsonType , typename CharType >
void nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_bson_unsigned ( const string_t &  name,
const BasicJsonType &  j 
)
inlineprivate

Writes a BSON element with key name and unsigned value.

Definition at line 14903 of file json.hpp.

14905 {
14906 if (j.m_value.number_unsigned <= static_cast<std::uint64_t>((std::numeric_limits<std::int32_t>::max)()))
14907 {
14908 write_bson_entry_header(name, 0x10 /* int32 */);
14909 write_number<std::int32_t, true>(static_cast<std::int32_t>(j.m_value.number_unsigned));
14910 }
14911
14912 else if (j.m_value.number_unsigned <= static_cast<std::uint64_t>((std::numeric_limits<std::int64_t>::max)()))
14913 {
14914 write_bson_entry_header(name, 0x12 /* int64 */);
14915 write_number<std::int64_t, true>(static_cast<std::int64_t>(j.m_value.number_unsigned));
14916 }
14917
14918 else
14919 {
14920 JSON_THROW(out_of_range::create(407, "integer number " + std::to_string(j.m_value.number_unsigned) + " cannot be represented by BSON as it does not fit int64", j));
14921 }
14922 }
void write_bson_entry_header(const string_t &name, const std::uint8_t element_type)
Writes the given element_type and name to the output adapter.
Definition: json.hpp:14803