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

Function wjson_surrogate_pair

examples/src/wjson_examples.cpp:57–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55#endif
56
57void wjson_surrogate_pair()
58{
59#ifdef _MSC_VER
60 std::wstring input = L"[\"\\uD950\\uDF21\"]";
61 std::wistringstream is(input);
62
63 wjson val = wjson::parse(is);
64
65 std::wstring s = val[0].as<std::wstring>();
66 std::cout << "length=" << s.length() << '\n';
67 std::cout << "Hex dump: [";
68 for (std::size_t i = 0; i < s.size(); ++i)
69 {
70 if (i != 0)
71 std::cout << " ";
72 uint32_t u(s[i] >= 0 ? s[i] : 256 + s[i] );
73 std::cout << "0x" << std::hex<< std::setfill('0') << std::setw(2) << u;
74 }
75 std::cout << "]" << '\n';
76#endif
77}
78
79int main()
80{

Callers 1

mainFunction · 0.85

Calls 3

parseFunction · 0.85
lengthMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected