Files
cppdraft_translate/cppdraft/streambuf/members.md
2025-10-25 03:02:53 +03:00

7.3 KiB
Raw Blame History

[streambuf.members]

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);

1

#

Effects: Callsimbue(loc).

2

#

Postconditions: loc == getloc().

3

#

Returns: Previous value ofgetloc().

🔗

locale getloc() const;

4

#

Returns: Ifpubimbue() 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 afterpubimbue() has been called but beforepubimbue has returned (i.e., from within the call ofimbue()) 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);

1

#

Returns: setbuf(s, n).

🔗

pos_type pubseekoff(off_type off, ios_base::seekdir way, ios_base::openmode which = ios_base::in | ios_base::out);

2

#

Returns: seekoff(off, way, which).

🔗

pos_type pubseekpos(pos_type sp, ios_base::openmode which = ios_base::in | ios_base::out);

3

#

Returns: seekpos(sp, which).

🔗

int pubsync();

4

#

Returns: sync().

31.6.3.3.3 Get area [streambuf.pub.get]

🔗

streamsize in_avail();

1

#

Returns: If a read position is available, returnsegptr() - gptr().

Otherwise returnsshowmanyc().

🔗

int_type snextc();

2

#

Effects: Callssbumpc().

3

#

Returns: If that function returnstraits::eof(), returnstraits::eof().

Otherwise, returnssgetc().

🔗

int_type sbumpc();

4

#

Effects: If the input sequence read position is not available, returnsuflow().

Otherwise, returnstraits::to_int_type(*gptr()) and increments the next pointer for the input sequence.

🔗

int_type sgetc();

5

#

Returns: If the input sequence read position is not available, returnsunderflow().

Otherwise, returnstraits::to_int_type(*gptr()).

🔗

streamsize sgetn(char_type* s, streamsize n);

6

#

Returns: xsgetn(s, n).

31.6.3.3.4 Putback [streambuf.pub.pback]

🔗

int_type sputbackc(char_type c);

1

#

Effects: If the input sequence putback position is not available, or iftraits::eq(c, gptr()[-1]) is false, returnspbackfail(traits::to_int_type(c)).

Otherwise, decrements the next pointer for the input sequence and returnstraits::to_int_type(*gptr()).

🔗

int_type sungetc();

2

#

Effects: If the input sequence putback position is not available, returnspbackfail().

Otherwise, decrements the next pointer for the input sequence and returnstraits::to_int_type(*gptr()).

31.6.3.3.5 Put area [streambuf.pub.put]

🔗

int_type sputc(char_type c);

1

#

Effects: If the output sequence write position is not available, returnsoverflow(traits::to_int_type(c)).

Otherwise, stores c at the next pointer for the output sequence, increments the pointer, and returnstraits::to_int_type(c).

🔗

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

2

#

Returns: xsputn(s, n).