Collects bytes into NUL terminated lines of up to N - 1 characters; IGNORE_CHAR bytes are skipped and an overlong line is dropped up to its terminator.
More...
|
| char * | feed (uint8_t c) |
| | Feed one byte; returns the completed line (empty lines included), valid until the next call, or nullptr.
|
| |
| char * | feed (uint8_t c, size_t &len) |
| | As feed(c), and sets len to the line length when a line is returned.
|
| |
| size_t | length () const |
| | Length of the partial line; 0 after a line is returned and while an overlong line is dropped.
|
| |
| const char * | partial () |
| | The partial line, NUL terminated, for prompts with no line end; the first N - 1 characters on the byte that overflowed, empty while the rest of that line is dropped.
|
| |
| bool | overflowed () const |
| | True only right after the feed() that found the line too long; the rest of that line is then dropped.
|
| |
| void | log_if_overflowed (const char *tag) const |
| | Log the shared "line dropped" warning when the last feed() overflowed.
|
| |
| void | reset () |
| | Forget the partial line and start a new one with the next byte.
|
| |
| void | restart_with (uint8_t c) |
| | Start a new line with c, e.g. the byte that overflowed; c must not be TERMINATOR_CHAR or IGNORE_CHAR.
|
| |
| void | discard_line () |
| | Drop everything up to and including the next terminator.
|
| |
template<size_t N, char TERMINATOR_CHAR = '\n', char IGNORE_CHAR = '\r'>
class esphome::LineReader< N, TERMINATOR_CHAR, IGNORE_CHAR >
Collects bytes into NUL terminated lines of up to N - 1 characters; IGNORE_CHAR bytes are skipped and an overlong line is dropped up to its terminator.
Definition at line 15 of file line_reader.h.
template<size_t N, char TERMINATOR_CHAR = '\n', char IGNORE_CHAR = '\r'>
The partial line, NUL terminated, for prompts with no line end; the first N - 1 characters on the byte that overflowed, empty while the rest of that line is dropped.
Definition at line 60 of file line_reader.h.