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

Function example2

examples/src/msgpack_examples.cpp:52–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52void example2()
53{
54 ojson j1;
55 j1["zero"] = 0;
56 j1["one"] = 1;
57 j1["two"] = 2;
58 j1["null"] = jsoncons::null_type();
59 j1["true"] = true;
60 j1["false"] = false;
61 j1["max int64_t"] = (std::numeric_limits<int64_t>::max)();
62 j1["max uint64_t"] = (std::numeric_limits<uint64_t>::max)();
63 j1["min int64_t"] = (std::numeric_limits<int64_t>::lowest)();
64 j1["max int32_t"] = (std::numeric_limits<int32_t>::max)();
65 j1["max uint32_t"] = (std::numeric_limits<uint32_t>::max)();
66 j1["min int32_t"] = (std::numeric_limits<int32_t>::lowest)();
67 j1["max int16_t"] = (std::numeric_limits<int16_t>::max)();
68 j1["max uint16_t"] = (std::numeric_limits<uint16_t>::max)();
69 j1["min int16_t"] = (std::numeric_limits<int16_t>::lowest)();
70 j1["max int8_t"] = (std::numeric_limits<int8_t>::max)();
71 j1["max uint8_t"] = (std::numeric_limits<uint8_t>::max)();
72 j1["min int8_t"] = (std::numeric_limits<int8_t>::lowest)();
73 j1["max double"] = (std::numeric_limits<double>::max)();
74 j1["min double"] = (std::numeric_limits<double>::lowest)();
75 j1["max float"] = (std::numeric_limits<float>::max)();
76 j1["zero float"] = 0.0;
77 j1["min float"] = (std::numeric_limits<float>::lowest)();
78 j1["Key too long for small string optimization"] = "String too long for small string optimization";
79
80 std::vector<uint8_t> v;
81 msgpack::encode_msgpack(j1, v);
82
83 ojson j2 = msgpack::decode_msgpack<ojson>(v);
84
85 std::cout << pretty_print(j2) << '\n';
86
87 std::cout << '\n';
88}
89
90void ext_example()
91{

Callers 1

mainFunction · 0.85

Calls 3

null_typeClass · 0.85
encode_msgpackFunction · 0.85
pretty_printFunction · 0.85

Tested by

no test coverage detected