VideoTools
|
A class which does line buffering. More...
#include <glinebuffer.h>
Public Member Functions | |
LineBuffer () | |
Default constructor for a line buffer that auto-detects either CR or CR-LF line endings based on the first line. More... | |
LineBuffer (const std::string &eol, bool do_throw_on_overflow=false) | |
Constructor. More... | |
void | add (const std::string &segment) |
Adds a data segment. | |
void | add (const char *p, std::string::size_type n) |
Adds a data segment. | |
const std::string & | eol () const |
Returns the line-ending. | |
void | expect (size_t n) |
The next 'n' bytes added and/or extracted are treated as a complete line. More... | |
Friends | |
class | LineBufferIterator |
A class which does line buffering.
Raw data is added, and newline-delimited lines are extracted via an iterator.
Usage:
Definition at line 52 of file glinebuffer.h.
GNet::LineBuffer::LineBuffer | ( | ) |
Default constructor for a line buffer that auto-detects either CR or CR-LF line endings based on the first line.
Definition at line 30 of file glinebuffer.cpp.
|
explicit |
Constructor.
The default is to not throw on overflow because the very large overflow limit is only intended to be protection against a rogue client or a denial-of-service attack.
Definition at line 39 of file glinebuffer.cpp.
void GNet::LineBuffer::expect | ( | size_t | n | ) |
The next 'n' bytes added and/or extracted are treated as a complete line.
This is useful for binary chunks of known size surrounded by text, as in http.
Definition at line 84 of file glinebuffer.cpp.