Files
2025-10-25 03:02:53 +03:00

47 lines
3.9 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[streambuf.general]
# 31 Input/output library [[input.output]](./#input.output)
## 31.6 Stream buffers [[stream.buffers]](stream.buffers#streambuf.general)
### 31.6.3 Class template basic_streambuf [[streambuf]](streambuf#general)
#### 31.6.3.1 General [streambuf.general]
[🔗](#lib:basic_streambuf)
namespace std {template<class charT, class traits = char_traits<charT>>class basic_streambuf {public:using char_type = charT; using int_type = typename traits::int_type; using pos_type = typename traits::pos_type; using off_type = typename traits::off_type; using traits_type = traits; virtual ~basic_streambuf(); // [[streambuf.locales]](streambuf.locales "31.6.3.3.1Locales"), locales locale pubimbue(const locale& loc);
locale getloc() const; // [[streambuf.buffer]](streambuf.buffer "31.6.3.3.2Buffer management and positioning"), buffer and positioning basic_streambuf* 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 and put areas// [[streambuf.pub.get]](streambuf.pub.get "31.6.3.3.3Get area"), get area streamsize in_avail();
int_type snextc();
int_type sbumpc();
int_type sgetc();
streamsize sgetn(char_type* s, streamsize n); // [[streambuf.pub.pback]](streambuf.pub.pback "31.6.3.3.4Putback"), putback int_type sputbackc(char_type c);
int_type sungetc(); // [[streambuf.pub.put]](streambuf.pub.put "31.6.3.3.5Put area"), 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); // [[streambuf.get.area]](streambuf.get.area "31.6.3.4.2Get area access"), get area access 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); // [[streambuf.put.area]](streambuf.put.area "31.6.3.4.3Put area access"), put area access char_type* pbase() const;
char_type* pptr() const;
char_type* epptr() const; void pbump(int n); void setp(char_type* pbeg, char_type* pend); // [[streambuf.virtuals]](streambuf.virtuals "31.6.3.5Virtual functions"), virtual functions// [[streambuf.virt.locales]](streambuf.virt.locales "31.6.3.5.1Locales"), localesvirtual void imbue(const locale& loc); // [[streambuf.virt.buffer]](streambuf.virt.buffer "31.6.3.5.2Buffer management and positioning"), buffer management and positioningvirtual basic_streambuf* 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(); // [[streambuf.virt.get]](streambuf.virt.get "31.6.3.5.3Get area"), get areavirtual streamsize showmanyc(); virtual streamsize xsgetn(char_type* s, streamsize n); virtual int_type underflow(); virtual int_type uflow(); // [[streambuf.virt.pback]](streambuf.virt.pback "31.6.3.5.4Putback"), putbackvirtual int_type pbackfail(int_type c = traits::eof()); // [[streambuf.virt.put]](streambuf.virt.put "31.6.3.5.5Put area"), put areavirtual streamsize xsputn(const char_type* s, streamsize n); virtual int_type overflow(int_type c = traits::eof()); };}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3088)
The class templatebasic_streambuf serves as a base class for deriving various[*stream buffers*](#def:stream_buffers) whose objects each control two[*character sequences*](#def:character_sequences):
- [(1.1)](#1.1)
a character[*input sequence*](#def:input_sequence);
- [(1.2)](#1.2)
a character[*output sequence*](#def:output_sequence)[.](#1.sentence-1)