| 110 | } |
| 111 | |
| 112 | span<const value_type> read_buffer(std::error_code& ec) |
| 113 | { |
| 114 | if (source_.eof()) |
| 115 | { |
| 116 | return span<const value_type>(); |
| 117 | } |
| 118 | |
| 119 | auto s = source_.read_buffer(); |
| 120 | const value_type* data = s.data(); |
| 121 | std::size_t length = s.size(); |
| 122 | |
| 123 | if (bof_ && length > 0) |
| 124 | { |
| 125 | auto r = unicode_traits::detect_json_encoding(data, length); |
| 126 | if (!(r.encoding == unicode_traits::encoding_kind::utf8 || r.encoding == unicode_traits::encoding_kind::undetected)) |
| 127 | { |
| 128 | ec = json_errc::illegal_unicode_character; |
| 129 | return span<const value_type>(); |
| 130 | } |
| 131 | length -= (r.ptr - data); |
| 132 | data = r.ptr; |
| 133 | bof_ = false; |
| 134 | } |
| 135 | |
| 136 | return span<const value_type>(data, length); |
| 137 | } |
| 138 | }; |
| 139 | |
| 140 | } // namespace jsoncons |
nothing calls this directly
no test coverage detected