GNU Info

Info Node: (iostream-295.info)Areas

(iostream-295.info)Areas


Next: Overflow Up: Streambuf
Enter node , (file) or (file)node

Areas of a `streambuf'
======================

   Streambuf buffer management is fairly sophisticated (this is a nice
way to say "complicated").  The standard protocol has the following
"areas":

   * The "put area" contains characters waiting for output.

   * The "get area" contains characters available for reading.

   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.)

 - Method: char* streambuf::pbase () const
     Returns a pointer to the start of the put area.

 - Method: char* streambuf::epptr () const
     Returns a pointer to the end of the put area.

 - Method: char* streambuf::pptr () const
     If `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).

 - Method: void streambuf::pbump (int N)
     Add N to the current put pointer.  No error checking is done.

 - Method: void streambuf::setp (char* P, char* E)
     Sets the start of the put area to P, the end of the put area to E,
     and the current put pointer to P (also).

 - Method: char* streambuf::eback () const
     Returns a pointer to the start of the get area.

 - Method: char* streambuf::egptr () const
     Returns a pointer to the end of the get area.

 - Method: char* streambuf::gptr () const
     If `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).

 - Method: void streambuf:gbump (int N)
     Add N to the current get pointer.  No error checking is done.

 - Method: void streambuf::setg (char* B, char* P, char* E)
     Sets the start of the get area to B, the end of the get area to E,
     and the current put pointer to P.


automatically generated by info2www version 1.2.2.9