21 #ifndef G_LINE_BUFFER_H
22 #define G_LINE_BUFFER_H
33 class LineBufferIterator ;
55 G_EXCEPTION( Overflow ,
"line buffer overflow: maximum input line length exceeded" ) ;
57 explicit LineBuffer(
const std::string & eol = std::string(
"\n") ,
bool do_throw_on_overflow =
false ) ;
60 void add(
const std::string & segment ) ;
70 const std::string &
current()
const ;
95 static unsigned long m_limit ;
100 bool m_current_valid ;
101 std::string m_current ;
124 const std::string &
line() ;
142 m_store_length(b.m_store.length())
void add(const std::string &segment)
Adds a data segment.
const std::string & current() const
Returns the current line, without extracting it.
std::string::size_type size_type
A std::size_t type.
bool more() const
Returns true if there is a line() to be had.
LineBuffer(const std::string &eol=std::string("\n"), bool do_throw_on_overflow=false)
Constructor.
An iterator class for GNet::LineBuffer.
LineBufferIterator(LineBuffer &)
Constructor.
const std::string & line()
Returns the current line and increments the iterator.
~LineBufferIterator()
Destructor.
#define G_EXCEPTION(class_name, description)
define as a function rather than a type if optimising for size
A class which does line buffering.
std::string line()
Extracts a line and returns it as a string.
bool more() const
Returns true if there are complete line(s) to be extracted.
void discard()
Discards the current line.