streambuf
Streambuf buffer management is fairly sophisticated (this is a nice way to say ``complicated''). The standard protocol has the following ``areas'':
The GNU streambuf
design extends this, but the details are
still evolving.
The following methods are used to manipulate these areas.
These are all protected methods, which are intended to be
used by virtual function in classes derived from streambuf
.
They are also all ANSI/ISO-standard, and the ugly names
are traditional.
(Note that if a pointer points to the 'end' of an area,
it means that it points to the character after the area.)
pptr() < epptr ()
, the pptr()
returns a pointer to the current put position.
(In that case, the next write will
overwrite *pptr()
, and increment pptr()
.)
Otherwise, there is no put position available
(and the next character written will cause streambuf::overflow
to be called).
gptr() < egptr ()
, then gptr()
returns a pointer to the current get position.
(In that case the next read will read *gptr()
,
and possibly increment gptr()
.)
Otherwise, there is no read position available
(and the next read will cause streambuf::underflow
to be called).