Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Class template basic_bufferbuf



// In header: <boost/interprocess/streams/bufferstream.hpp>

template<typename CharT, typename CharTraits> 
class basic_bufferbuf {
  // types
  typedef CharT                                          char_type;  
  typedef CharTraits::int_type                           int_type;   
  typedef CharTraits::pos_type                           pos_type;   
  typedef CharTraits::off_type                           off_type;   
  typedef CharTraits                                     traits_type;
  typedef std::basic_streambuf< char_type, traits_type > base_t;     

  // construct/copy/destruct
  basic_bufferbuf(std::ios_base::openmode = std::ios_base::in|std::ios_base::out);
  basic_bufferbuf(CharT *, std::size_t, 
                  std::ios_base::openmode = std::ios_base::in|std::ios_base::out);

  // public member functions
  std::pair< CharT *, std::size_t > buffer() const;
  void buffer(CharT *, std::size_t);
  void set_pointers();

  // protected member functions
  int_type underflow();
  int_type pbackfail(int_type = CharTraits::eof());
  int_type overflow(int_type = CharTraits::eof());
  pos_type seekoff(off_type, std::ios_base::seekdir, 
                   std::ios_base::openmode = std::ios_base::in|std::ios_base::out);
  pos_type seekpos(pos_type, 
                   std::ios_base::openmode = std::ios_base::in|std::ios_base::out);


A streambuf class that controls the transmission of elements to and from a basic_xbufferstream. The elements are transmitted from a to a fixed size buffer

basic_bufferbuf public construct/copy/destruct

  1. basic_bufferbuf(std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out);

    Constructor. Does not throw.

  2. basic_bufferbuf(CharT * buffer, std::size_t length, 
                    std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out);

    Constructor. Assigns formatting buffer. Does not throw.

  3. ~basic_bufferbuf();

basic_bufferbuf public member functions

  1. std::pair< CharT *, std::size_t > buffer() const;

    Returns the pointer and size of the internal buffer. Does not throw.

  2. void buffer(CharT * buffer, std::size_t length);

    Sets the underlying buffer to a new value Does not throw.

  3. void set_pointers();
    @ private:

basic_bufferbuf protected member functions

  1. int_type underflow();
  2. int_type pbackfail(int_type c = CharTraits::eof());
  3. int_type overflow(int_type c = CharTraits::eof());
  4. pos_type seekoff(off_type off, std::ios_base::seekdir dir, 
                     std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out);
  5. pos_type seekpos(pos_type pos, 
                     std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out);