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

Function binary_example1

examples/src/bson_examples.cpp:202–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200}
201
202void binary_example1()
203{
204 json j;
205 std::vector<uint8_t> bstr = { '1', '2', '3', '4' };
206 j.try_emplace("binary", jsoncons::byte_string_arg, bstr); // default subtype is user defined
207 // or j.try_emplace("binary", byte_string_arg, bstr, 0x80);
208
209 std::vector<char> buffer;
210 bson::encode_bson(j, buffer);
211 std::cout << jsoncons::byte_string_view(buffer) << "\n\n";
212}
213
214void binary_example2()
215{

Callers 1

mainFunction · 0.85

Calls 3

encode_bsonFunction · 0.85
byte_string_viewClass · 0.85
try_emplaceMethod · 0.45

Tested by

no test coverage detected