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

Function decode_cbor_with_packed_strings

examples/src/cbor_examples.cpp:327–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325}
326
327void decode_cbor_with_packed_strings()
328{
329 std::vector<uint8_t> v = {0xd9,0x01,0x00, // tag(256)
330 0x85, // array(5)
331 0x63, // text(3)
332 0x61,0x61,0x61, // "aaa"
333 0xd8, 0x19, // tag(25)
334 0x00, // unsigned(0)
335 0xd9, 0x01,0x00, // tag(256)
336 0x83, // array(3)
337 0x63, // text(3)
338 0x62,0x62,0x62, // "bbb"
339 0x63, // text(3)
340 0x61,0x61,0x61, // "aaa"
341 0xd8, 0x19, // tag(25)
342 0x01, // unsigned(1)
343 0xd9, 0x01,0x00, // tag(256)
344 0x82, // array(2)
345 0x63, // text(3)
346 0x63,0x63,0x63, // "ccc"
347 0xd8, 0x19, // tag(25)
348 0x00, // unsigned(0)
349 0xd8, 0x19, // tag(25)
350 0x00 // unsigned(0)
351 };
352
353 ojson j = cbor::decode_cbor<ojson>(v);
354
355 std::cout << pretty_print(j) << "\n";
356}
357
358const std::vector<uint8_t> data = {
359 0x9f, // Start indefinte length array

Callers 1

mainFunction · 0.85

Calls 1

pretty_printFunction · 0.85

Tested by

no test coverage detected