MCPcopy Create free account
hub / github.com/danielaparker/jsoncons / decode_decimal128

Function decode_decimal128

examples/src/bson_examples.cpp:234–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232}
233
234void decode_decimal128()
235{
236 std::vector<uint8_t> input = {
237 0x18,0x00,0x00,0x00, // Document has 24 bytes
238 0x13, // 128-bit decimal floating point
239 0x61,0x00, // "a"
240 0x01,0x00,0x00,0x00,
241 0x00,0x00,0x00,0x00, // 1E-6176
242 0x00,0x00,0x00,0x00,
243 0x00,0x00,0x00,0x00,
244 0x00 // terminating null
245 };
246
247 json j = bson::decode_bson<json>(input);
248
249 std::cout << "(1) " << j << "\n\n";
250 std::cout << "(2) " << j.at("a").tag() << "\n\n";
251
252 std::vector<uint8_t> output;
253 bson::encode_bson(j, output);
254 assert(output == input);
255}
256
257void encode_decimal128()
258{

Callers 1

mainFunction · 0.85

Calls 3

encode_bsonFunction · 0.85
atMethod · 0.80
tagMethod · 0.45

Tested by

no test coverage detected