Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class template basic_bufferbuf

boost::interprocess::basic_bufferbuf

Synopsis

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

template<typename CharT, typename CharTraits> 
class basic_bufferbuf : public std::basic_streambuf< CharT, CharTraits > {
public:
  // 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 > basic_streambuf_t;

  // public member functions
  explicit basic_bufferbuf(std::ios_base::openmode = std::ios_base::in|std::ios_base::out);
  explicit basic_bufferbuf(CharT *, std::size_t, 
                           std::ios_base::openmode = std::ios_base::in|std::ios_base::out);
  virtual ~basic_bufferbuf();
  std::pair< CharT *, std::size_t > buffer() const;
  std::pair< CharT *, std::size_t > written_buffer() const;
  void buffer(CharT *, std::size_t);
};

Description

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

basic_bufferbuf public member functions

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

    Constructor. Does not throw.

  2. explicit basic_bufferbuf(CharT * buf, 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. virtual ~basic_bufferbuf();
  4. std::pair< CharT *, std::size_t > buffer() const;

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

  5. std::pair< CharT *, std::size_t > written_buffer() const;

    Returns the pointer and size of the written part of the buffer: in std::ios_base::out mode, from the start of the buffer to the current write position. Otherwise, the whole buffer. Like std::basic_spanbuf::span(). Does not throw.

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

    Sets the underlying buffer to a new value. The read position goes to the start of the buffer. The write position goes to the start of the buffer, or to the end of the buffer in std::ios_base::ate mode. Does not throw.


PrevUpHomeNext