@brief get next character from the input This function provides the interface to the used input adapter. It does not throw in case the input reached EOF, but returns a `std::char_traits ::eof()` in that case. Stores the scanned characters for use in error messages. @return character read from the input */
| 8375 | @return character read from the input |
| 8376 | */ |
| 8377 | std::char_traits<char>::int_type get() |
| 8378 | { |
| 8379 | ++position.chars_read_total; |
| 8380 | ++position.chars_read_current_line; |
| 8381 | |
| 8382 | if (next_unget) |
| 8383 | { |
| 8384 | // just reset the next_unget variable and work with current |
| 8385 | next_unget = false; |
| 8386 | } |
| 8387 | else |
| 8388 | { |
| 8389 | current = ia->get_character(); |
| 8390 | } |
| 8391 | |
| 8392 | if (JSON_HEDLEY_LIKELY(current != std::char_traits<char>::eof())) |
| 8393 | { |
| 8394 | token_string.push_back(std::char_traits<char>::to_char_type(current)); |
| 8395 | } |
| 8396 | |
| 8397 | if (current == '\n') |
| 8398 | { |
| 8399 | ++position.lines_read; |
| 8400 | position.chars_read_current_line = 0; |
| 8401 | } |
| 8402 | |
| 8403 | return current; |
| 8404 | } |
| 8405 | |
| 8406 | /*! |
| 8407 | @brief unget current character (read it again on next get) |
no test coverage detected