| 212 | } |
| 213 | |
| 214 | void binary_example2() |
| 215 | { |
| 216 | std::vector<uint8_t> input = { 0x13,0x00,0x00,0x00, // Document has 19 bytes |
| 217 | 0x05, // Binary data |
| 218 | 0x70,0x44,0x00, // "pD" |
| 219 | 0x05,0x00,0x00,0x00, // Length is 5 |
| 220 | 0x80, // Subtype is 128 |
| 221 | 0x48,0x65,0x6c,0x6c,0x6f, // 'H','e','l','l','o' |
| 222 | 0x00 // terminating null |
| 223 | }; |
| 224 | |
| 225 | json j = bson::decode_bson<json>(input); |
| 226 | std::cout << "JSON:\n" << pretty_print(j) << "\n\n"; |
| 227 | |
| 228 | std::cout << "tag: " << j["pD"].tag() << "\n"; |
| 229 | std::cout << "ext_tag: " << j["pD"].ext_tag() << "\n"; |
| 230 | auto bytes = j["pD"].as<std::vector<uint8_t>>(); |
| 231 | std::cout << "binary data: " << jsoncons::byte_string_view{ bytes } << "\n"; |
| 232 | } |
| 233 | |
| 234 | void decode_decimal128() |
| 235 | { |
no test coverage detected