LIRC libraries
LinuxInfraredRemoteControl
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
23
class
LineBuffer
{
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_
LineBuffer::has_lines
bool has_lines()
Check if get_next_line() returns a non-empty string.
Definition:
line_buffer.cpp:22
LineBuffer::get_next_line
std::string get_next_line()
Return and remove first line in buffer, possibly "".
Definition:
line_buffer.cpp:40
LineBuffer::append
void append(const char *line, size_t size)
Insert data in buffer.
Definition:
line_buffer.cpp:28
LineBuffer::c_str
const char * c_str()
Peek the complete buffer contents.
Definition:
line_buffer.cpp:34
LineBuffer
After appending, data can be retrieved as lines.
Definition:
line_buffer.h:23
lib
line_buffer.h
Generated by
1.8.17