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

Function read_json

test/corelib/src/read_encoded_data_tests.cpp:15–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14template <typename Source>
15typename std::enable_if<ext_traits::is_byte<typename Source::value_type>::value,std::size_t>::type
16read_json(Source& source, char* buffer, std::size_t capacity, unicode_traits::encoding_kind& encoding)
17{
18 using value_type = typename Source::value_type;
19
20 std::size_t count = 0;
21 char* ptr = buffer;
22 if (encoding != unicode_traits::encoding_kind::undetected)
23 {
24 count = source.read(buffer, capacity);
25 auto r = unicode_traits::detect_json_encoding(buffer,capacity);
26 encoding = r.encoding;
27 count -= (r.ptr - buffer);
28 ptr = r.ptr;
29 }
30 switch (encoding)
31 {
32 case unicode_traits::encoding_kind::utf8:
33 break;
34 case unicode_traits::encoding_kind::utf16le:
35 break;
36 case unicode_traits::encoding_kind::utf16be:
37 break;
38 case unicode_traits::encoding_kind::utf32le:
39 break;
40 case unicode_traits::encoding_kind::utf32be:
41 break;
42 }
43}
44
45TEST_CASE("Read utf8 encoded data")
46{

Callers

nothing calls this directly

Calls 2

detect_json_encodingFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected