Loading...
Searching...
No Matches
line_buffer.h
Go to the documentation of this file.
/******************************************************************
** line_buffer ****************************************************
*******************************************************************
*
* Line buffered input on top of e. g., read(2).
*
* Copyright (c) 2015 Alec Leamas
*
* */
#ifndef LIB_LINE_BUFFER_H_
#define LIB_LINE_BUFFER_H_
#include <string>
class LineBuffer {
private:
std::string buff;
public:
void append(const char* line, size_t size);
bool has_lines();
const char* c_str();
std::string get_next_line();
LineBuffer();
};
#endif // LIB_LINE_BUFFER_H_
LineBuffer::c_str
const char * c_str()
Peek the complete buffer contents.
Definition line_buffer.cpp:34
LineBuffer::append
void append(const char *line, size_t size)
Insert data in buffer.
Definition line_buffer.cpp:28
LineBuffer::get_next_line
std::string get_next_line()
Return and remove first line in buffer, possibly "".
Definition line_buffer.cpp:40
LineBuffer::has_lines
bool has_lines()
Check if get_next_line() returns a non-empty string.
Definition line_buffer.cpp:22