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

Function working_with_cbor2

examples/src/cbor_examples.cpp:412–428  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410}
411
412void working_with_cbor2()
413{
414 // Parse the string of data into a std::vector<std::tuple<std::string,jsoncons::byte_string,std::string>> value
415 auto val = cbor::decode_cbor<std::vector<std::tuple<std::string,jsoncons::byte_string,std::string>>>(data);
416
417 std::cout << "(1)\n";
418 for (const auto& row : val)
419 {
420 std::cout << std::get<0>(row) << ", " << std::get<1>(row) << ", " << std::get<2>(row) << "\n";
421 }
422 std::cout << "\n";
423
424 // Serialize back to CBOR
425 std::vector<uint8_t> buffer;
426 cbor::encode_cbor(val, buffer);
427 std::cout << "(2)\n" << byte_string_view(buffer) << "\n\n";
428}
429
430void working_with_cbor3()
431{

Callers 1

mainFunction · 0.85

Calls 2

encode_cborFunction · 0.85
byte_string_viewClass · 0.85

Tested by

no test coverage detected