LIRC libraries
Linux Infrared Remote Control
Loading...
Searching...
No Matches
line_buffer.h
Go to the documentation of this file.
1/******************************************************************
2** line_buffer ****************************************************
3*******************************************************************
4*
5* Line buffered input on top of e. g., read(2).
6*
7* Copyright (c) 2015 Alec Leamas
8*
9* */
10
16#ifndef LIB_LINE_BUFFER_H_
17#define LIB_LINE_BUFFER_H_
18
19#include <string>
20
21
24 private:
25 std::string buff;
26
27 public:
29 void append(const char* line, size_t size);
30
32 bool has_lines();
33
35 const char* c_str();
36
38 std::string get_next_line();
39
40 LineBuffer();
41};
42
43#endif // LIB_LINE_BUFFER_H_
After appending, data can be retrieved as lines.
Definition line_buffer.h:23
const char * c_str()
Peek the complete buffer contents.
void append(const char *line, size_t size)
Insert data in buffer.
std::string get_next_line()
Return and remove first line in buffer, possibly "".
bool has_lines()
Check if get_next_line() returns a non-empty string.