TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ get_msgpack_binary()

template<typename BasicJsonType , typename InputAdapterType , typename SAX = json_sax_dom_parser<BasicJsonType>>
bool nlohmann::detail::binary_reader< BasicJsonType, InputAdapterType, SAX >::get_msgpack_binary ( binary_t &  result)
inlineprivate

reads a MessagePack byte array

This function first reads starting bytes to determine the expected byte array length and then copies this number of bytes into a byte array.

Parameters
[out]resultcreated byte array
Returns
whether byte array creation completed

Definition at line 10055 of file json.hpp.

10056 {
10057 // helper function to set the subtype
10058 auto assign_and_return_true = [&result](std::int8_t subtype)
10059 {
10060 result.set_subtype(static_cast<std::uint8_t>(subtype));
10061 return true;
10062 };
10063
10064 switch (current)
10065 {
10066 case 0xC4: // bin 8
10067 {
10068 std::uint8_t len{};
10069 return get_number(input_format_t::msgpack, len) &&
10070 get_binary(input_format_t::msgpack, len, result);
10071 }
10072
10073 case 0xC5: // bin 16
10074 {
10075 std::uint16_t len{};
10076 return get_number(input_format_t::msgpack, len) &&
10077 get_binary(input_format_t::msgpack, len, result);
10078 }
10079
10080 case 0xC6: // bin 32
10081 {
10082 std::uint32_t len{};
10083 return get_number(input_format_t::msgpack, len) &&
10084 get_binary(input_format_t::msgpack, len, result);
10085 }
10086
10087 case 0xC7: // ext 8
10088 {
10089 std::uint8_t len{};
10090 std::int8_t subtype{};
10091 return get_number(input_format_t::msgpack, len) &&
10092 get_number(input_format_t::msgpack, subtype) &&
10093 get_binary(input_format_t::msgpack, len, result) &&
10094 assign_and_return_true(subtype);
10095 }
10096
10097 case 0xC8: // ext 16
10098 {
10099 std::uint16_t len{};
10100 std::int8_t subtype{};
10101 return get_number(input_format_t::msgpack, len) &&
10102 get_number(input_format_t::msgpack, subtype) &&
10103 get_binary(input_format_t::msgpack, len, result) &&
10104 assign_and_return_true(subtype);
10105 }
10106
10107 case 0xC9: // ext 32
10108 {
10109 std::uint32_t len{};
10110 std::int8_t subtype{};
10111 return get_number(input_format_t::msgpack, len) &&
10112 get_number(input_format_t::msgpack, subtype) &&
10113 get_binary(input_format_t::msgpack, len, result) &&
10114 assign_and_return_true(subtype);
10115 }
10116
10117 case 0xD4: // fixext 1
10118 {
10119 std::int8_t subtype{};
10120 return get_number(input_format_t::msgpack, subtype) &&
10121 get_binary(input_format_t::msgpack, 1, result) &&
10122 assign_and_return_true(subtype);
10123 }
10124
10125 case 0xD5: // fixext 2
10126 {
10127 std::int8_t subtype{};
10128 return get_number(input_format_t::msgpack, subtype) &&
10129 get_binary(input_format_t::msgpack, 2, result) &&
10130 assign_and_return_true(subtype);
10131 }
10132
10133 case 0xD6: // fixext 4
10134 {
10135 std::int8_t subtype{};
10136 return get_number(input_format_t::msgpack, subtype) &&
10137 get_binary(input_format_t::msgpack, 4, result) &&
10138 assign_and_return_true(subtype);
10139 }
10140
10141 case 0xD7: // fixext 8
10142 {
10143 std::int8_t subtype{};
10144 return get_number(input_format_t::msgpack, subtype) &&
10145 get_binary(input_format_t::msgpack, 8, result) &&
10146 assign_and_return_true(subtype);
10147 }
10148
10149 case 0xD8: // fixext 16
10150 {
10151 std::int8_t subtype{};
10152 return get_number(input_format_t::msgpack, subtype) &&
10153 get_binary(input_format_t::msgpack, 16, result) &&
10154 assign_and_return_true(subtype);
10155 }
10156
10157 default: // LCOV_EXCL_LINE
10158 return false; // LCOV_EXCL_LINE
10159 }
10160 }
bool get_binary(const input_format_t format, const NumberType len, binary_t &result)
create a byte array by reading bytes from the input
Definition: json.hpp:10886
char_int_type current
the current character
Definition: json.hpp:10978