13 #ifndef _SMING_CORE_DATA_BUFFER_LINE_BUFFER_H_ 14 #define _SMING_CORE_DATA_BUFFER_LINE_BUFFER_H_ 16 #include <user_config.h> 67 bool contains(
const char* text)
const;
76 char buffer[BUFSIZE] = {
'\0'};
82 if(c ==
'\n' || c ==
'\r') {
86 if(c >= 0x20 && c < 0x7f && length < (BUFSIZE - 1)) {
88 buffer[length] =
'\0';
101 buffer[length] =
'\0';
108 auto len = strlen(text);
109 return memcmp(buffer, text, len) == 0;
114 return strstr(buffer, text) !=
nullptr;
bool startsWith(const char *text) const
Check for matching text at start of line, case-sensitive.
Definition: LineBuffer.h:106
bool backspace()
Remove last character from buffer.
Definition: LineBuffer.h:95
Class to enable buffering of a single line of text, with simple editing.
Definition: LineBuffer.h:22
char * getBuffer()
Get the text, nul-terminated.
Definition: LineBuffer.h:42
void clear()
Clear contents of buffer.
Definition: LineBuffer.h:34
unsigned getLength() const
Get number of characters in the text line.
Definition: LineBuffer.h:50
char addChar(char c)
Add a character to the buffer.
Definition: LineBuffer.h:80
bool contains(const char *text) const
Check for matching text anywhere in line, case-sensitive.
Definition: LineBuffer.h:112