Standard library header <streambuf>

From cppreference.com
< cpp‎ | header

This header is part of the Input/Output library.

Classes

abstracts a raw device
(class template)

Typedefs

streambuf basic_streambuf<char>
wstreambuf basic_streambuf<wchar_t>

Synopsis

namespace std {
 
    template <class charT, class traits = char_traits<charT> >
    class basic_streambuf;
 
    typedef basic_streambuf<char> streambuf;
    typedef basic_streambuf<wchar_t> wstreambuf;
}

Class std::basic_streambuf

template <class charT, class traits = char_traits<charT> >
class basic_streambuf {
 public:
    // types:
    typedef charT char_type;
    typedef typename traits::int_type int_type;
    typedef typename traits::pos_type pos_type;
    typedef typename traits::off_type off_type;
    typedef traits traits_type;
 
    virtual ~basic_streambuf();
 
    // locales:
    locale pubimbue(const locale& loc);
    locale getloc() const;
 
    // buffer and positioning:
    basic_streambuf<char_type,traits>*
    pubsetbuf(char_type* s, streamsize n);
    pos_type pubseekoff(off_type off, ios_base::seekdir way,
                        ios_base::openmode which = ios_base::in|ios_base::out);
    pos_type pubseekpos(pos_type sp,
                        ios_base::openmode which = ios_base::in|ios_base::out);
    int pubsync();
 
    // Get area:
    streamsize in_avail();
    int_type snextc();
    int_type sbumpc();
    int_type sgetc();
    streamsize sgetn(char_type* s, streamsize n);
 
    // Putback:
    int_type sputbackc(char_type c);
    int_type sungetc();
 
    // Put area:
    int_type sputc(char_type c);
    streamsize sputn(const char_type* s, streamsize n);
 
 protected:
    basic_streambuf();
    basic_streambuf(const basic_streambuf& rhs);
    basic_streambuf& operator=(const basic_streambuf& rhs);
    void swap(basic_streambuf& rhs);
 
    // Get area:
    char_type* eback() const;
    char_type* gptr() const;
    char_type* egptr() const;
    void gbump(int n);
    void setg(char_type* gbeg, char_type* gnext, char_type* gend);
 
    // Put area:
    char_type* pbase() const;
    char_type* pptr() const;
    char_type* epptr() const;
    void pbump(int n);
    void setp(char_type* pbeg, char_type* pend);
 
    // virtual functions:
    // Locales:
    virtual void imbue(const locale& loc);
 
    // Buffer management and positioning:
    virtual basic_streambuf<char_type,traits>* setbuf(char_type* s, streamsize n);
    virtual pos_type seekoff(off_type off, ios_base::seekdir way,
                             ios_base::openmode which = ios_base::in|ios_base::out);
    virtual pos_type seekpos(pos_type sp,
                             ios_base::openmode which = ios_base::in|ios_base::out);
    virtual int sync();
 
    // Get area:
    virtual streamsize showmanyc();
    virtual streamsize xsgetn(char_type* s, streamsize n);
    virtual int_type underflow();
    virtual int_type uflow();
 
    // Putback:
    virtual int_type pbackfail(int_type c = traits::eof());
 
    // Put area:
    virtual streamsize xsputn(const char_type* s, streamsize n);
    virtual int_type overflow (int_type c = traits::eof());
};