Click on the banner to return to the class reference home page.

basic_streambuf


Base Class

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Synopsis

#include <streambuf>
template<class charT, class traits = char_traits<charT> >
class basic_streambuf;

Description

The class template basic_streambuf<charT,traits> serves as an abstract base class for deriving various stream buffers whose objects each control two character sequences:

Each sequence is characterized by three pointers which, if non-null, all point into the same charT array object. The array object represents, at any moment, a subsequence of characters from the sequence. Operations performed on a sequence alter the values stored in these pointers, perform reads and writes directly to or from associated sequences, and alter "the stream position" and conversion state as needed to maintain this subsequence relationship. The three pointers are:

Stream buffers can impose various constraints on the sequences they control, including:

Interface

template<class charT, class traits = char_traits<charT> >
class basic_streambuf {

public:
     
 typedef charT                       char_type;
 typedef traits                      traits_type;

 typedef typename traits::int_type    int_type;
 typedef typename traits::pos_type    pos_type;
 typedef typename traits::off_type    off_type;


 virtual ~basic_streambuf();

 locale pubimbue( const locale& loc);
 locale getloc() const; 

 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();
 
 ios_base::openmode which_open_mode();
 
 streamsize   in_avail();

 int_type snextc();

 int_type sbumpc();

 int_type sgetc();

 streamsize sgetn(char_type *s, streamsize n);

 int_type sputbackc(char_type c);

 int sungetc();

 int_type sputc(char_type c);

 streamsize sputn(const char_type *s, streamsize n);

protected:

 basic_streambuf();
     
 char_type *eback() const;
 char_type *gptr() const;
 char_type *egptr() const;

 void gbump(int n);

 void setg(char_type *gbeg_arg,char_type *gnext_arg,
           char_type *gend_arg);

 char_type *pbase() const;
 char_type *pptr() const;
 char_type *epptr() const;

 void pbump(int n);

 void setp(char_type *pbeg_arg,char_type *pend_arg);

 virtual void imbue( const locale& loc);

 virtual int_type overflow(int_type c = traits::eof());

 virtual int_type pbackfail(int_type c = traits::eof());

 virtual int showmanyc();

 virtual int_type underflow();

 virtual int_type uflow();

 virtual streamsize xsgetn(char_type *s, streamsize n);

 virtual streamsize xsputn(const 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 basic_streambuf<charT, traits>*
   setbuf(char_type *s, streamsize n);

 virtual int sync();

};

Types

char_type
int_type
off_type
pos_type
streambuf
traits_type
wstreambuf

Public Constructor

basic_streambuf();

Public Destructor

virtual ~basic_streambuf();

Public Member Functions

locale 
getloc() const;
streamsize 
in_avail();
locale 
pubimbue(const locale& loc);
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 );
basic_streambuf<char_type,traits>* 
pubsetbuf(char_type* s,streamsize n);
int 
pubsync();
int_type 
sbumpc();
int_type 
sgetc();
streamsize 
sgetn(char_type* s, streamsize n);
int_type 
snextc();
int_type 
sputbackc(char_type c);
int_type 
sputc(char_type c);
streamsize 
sputn(const char_type* s, streamsize n);
int_type 
sungetc();
ios_base::openmode 
which_open_mode();

Protected Member Functions

char_type* 
eback() const;
char_type* 
egptr() const;
char_type* 
epptr() const;
void 
gbump(int n);
char_type* 
gptr() const;
void 
imbue(const locale&);
int_type 
overflow(int_type c = traits::eof() );
int_type 
pbackfail(int_type c = traits::eof() );
char_type* 
pbase() const;
void 
pbump(int n);
char_type* 
pptr() const;
pos_type 
seekoff(off_type off, ios_base::seekdir way,
        ios_base::openmode which =
        ios_base::in | ios_base::out );
pos_type 
seekpos(pos_type sp, ios_base::openmode which=
        ios_base::in | ios_base::out );
basic_streambuf* 
setbuf(char_type* s, streamsize n);
void 
setg(char_type* gbeg, char_type* gnext, char_type* gend);
void 
setp(char_type* pbeg, char_type* pend);
int 
showmanyc();
int 
sync();
int_type 
underflow();
int_type 
uflow();
streamsize 
xsgetn(char_type* s, streamsize n);
streamsize 
xsputn(const char_type* s, streamsize n);

See Also

char_traits(3C++), basic_filebuf(3C++), basic_stringbuf(3C++), strstreambuf(3C++)

Working Paper for Draft Proposed International Standard for Information Systems--Programming Language C++, Section 27.5

Standards Conformance

ANSI X3J16/ISO WG21 Joint C++ Committee


©Copyright 1996, Rogue Wave Software, Inc.