| 46 | #include "core/string/string_buffer.h" |
| 47 | |
| 48 | char32_t VariantParser::Stream::get_char() { |
| 49 | // is within buffer? |
| 50 | if (readahead_pointer < readahead_filled) { |
| 51 | return readahead_buffer[readahead_pointer++]; |
| 52 | } |
| 53 | |
| 54 | // attempt to readahead |
| 55 | readahead_filled = _read_buffer(readahead_buffer, readahead_enabled ? READAHEAD_SIZE : 1); |
| 56 | if (readahead_filled) { |
| 57 | readahead_pointer = 0; |
| 58 | } else { |
| 59 | // EOF |
| 60 | readahead_pointer = 1; |
| 61 | eof = true; |
| 62 | return 0; |
| 63 | } |
| 64 | return get_char(); |
| 65 | } |
| 66 | |
| 67 | bool VariantParser::Stream::is_eof() const { |
| 68 | if (readahead_enabled) { |
no outgoing calls
no test coverage detected