29 Input/output library [input.output]

29.6 Stream buffers [stream.buffers]

29.6.3 Class template basic_­streambuf [streambuf]

29.6.3.2 Public member functions [streambuf.members]

29.6.3.2.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.

29.6.3.2.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().

29.6.3.2.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).

29.6.3.2.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()).

29.6.3.2.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).