15 #include <user_config.h> 66 bool contains(
const char* text)
const;
75 char buffer[BUFSIZE] = {
'\0'};
81 if(c ==
'\n' || c ==
'\r') {
85 if(c >= 0x20 && c < 0x7f && length < (BUFSIZE - 1)) {
87 buffer[length] =
'\0';
100 buffer[length] =
'\0';
107 auto len = strlen(text);
108 return memcmp(buffer, text, len) == 0;
113 return strstr(buffer, text) !=
nullptr;
bool startsWith(const char *text) const
Check for matching text at start of line, case-sensitive.
Definition: LineBuffer.h:105
bool backspace()
Remove last character from buffer.
Definition: LineBuffer.h:94
bool contains(const char *text) const
Check for matching text anywhere in line, case-sensitive.
Definition: LineBuffer.h:111
Class to enable buffering of a single line of text, with simple editing.
Definition: LineBuffer.h:21
char * getBuffer()
Get the text, nul-terminated.
Definition: LineBuffer.h:41
void clear()
Clear contents of buffer.
Definition: LineBuffer.h:33
char addChar(char c)
Add a character to the buffer.
Definition: LineBuffer.h:79
unsigned getLength() const
Get number of characters in the text line.
Definition: LineBuffer.h:49