31 Input/output library [input.output]

31.6 Stream buffers [stream.buffers]

31.6.3 Class template basic_streambuf [streambuf]

31.6.3.3 Public member functions [streambuf.members]

31.6.3.3.1 Locales [streambuf.locales]

locale pubimbue(const locale& loc);
Effects: Calls imbue(loc).
Postconditions: loc == getloc().
Returns: Previous value of getloc().
locale getloc() const;
Returns: If pubimbue() has ever been called, then the last value of loc supplied, otherwise the current global locale, locale(), in effect at the time of construction.
If called after pubimbue() has been called but before pubimbue has returned (i.e., from within the call of imbue()) then it returns the previous value.

31.6.3.3.2 Buffer management and positioning [streambuf.buffer]

basic_streambuf* pubsetbuf(char_type* s, streamsize n);
Returns: setbuf(s, n).
pos_type pubseekoff(off_type off, ios_base::seekdir way, ios_base::openmode which = ios_base::in | ios_base::out);
Returns: seekoff(off, way, which).
pos_type pubseekpos(pos_type sp, ios_base::openmode which = ios_base::in | ios_base::out);
Returns: seekpos(sp, which).
int pubsync();
Returns: sync().

31.6.3.3.3 Get area [streambuf.pub.get]

streamsize in_avail();
Returns: If a read position is available, returns egptr() - gptr().
Otherwise returns showmanyc().
int_type snextc();
Effects: Calls sbumpc().
Returns: If that function returns traits​::​eof(), returns traits​::​eof().
Otherwise, returns sgetc().
int_type sbumpc();
Effects: If the input sequence read position is not available, returns uflow().
Otherwise, returns traits​::​to_int_type(*gptr()) and increments the next pointer for the input sequence.
int_type sgetc();
Returns: If the input sequence read position is not available, returns underflow().
Otherwise, returns traits​::​to_int_type(*gptr()).
streamsize sgetn(char_type* s, streamsize n);
Returns: xsgetn(s, n).

31.6.3.3.4 Putback [streambuf.pub.pback]

int_type sputbackc(char_type c);
Effects: If the input sequence putback position is not available, or if traits​::​eq(c, gptr()[-1]) is false, returns pbackfail(traits​::​to_int_type(c)).
Otherwise, decrements the next pointer for the input sequence and returns traits​::​to_int_type(*gptr()).
int_type sungetc();
Effects: If the input sequence putback position is not available, returns pbackfail().
Otherwise, decrements the next pointer for the input sequence and returns traits​::​to_int_type(*gptr()).

31.6.3.3.5 Put area [streambuf.pub.put]

int_type sputc(char_type c);
Effects: If the output sequence write position is not available, returns overflow(traits​::​to_int_type(c)).
Otherwise, stores c at the next pointer for the output sequence, increments the pointer, and returns traits​::​to_int_type(c).
streamsize sputn(const char_type* s, streamsize n);
Returns: xsputn(s, n).