| 13 | |
| 14 | template <typename Source> |
| 15 | typename std::enable_if<ext_traits::is_byte<typename Source::value_type>::value,std::size_t>::type |
| 16 | read_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 | |
| 45 | TEST_CASE("Read utf8 encoded data") |
| 46 | { |
nothing calls this directly
no test coverage detected