tmp/tmpvyy6lpzv/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### General <a id="streambuf.general">[[streambuf.general]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std {
|
| 5 |
+
template<class charT, class traits = char_traits<charT>>
|
| 6 |
+
class basic_streambuf {
|
| 7 |
+
public:
|
| 8 |
+
using char_type = charT;
|
| 9 |
+
using int_type = typename traits::int_type;
|
| 10 |
+
using pos_type = typename traits::pos_type;
|
| 11 |
+
using off_type = typename traits::off_type;
|
| 12 |
+
using traits_type = traits;
|
| 13 |
+
|
| 14 |
+
virtual ~basic_streambuf();
|
| 15 |
+
|
| 16 |
+
// [streambuf.locales], locales
|
| 17 |
+
locale pubimbue(const locale& loc);
|
| 18 |
+
locale getloc() const;
|
| 19 |
+
|
| 20 |
+
// [streambuf.buffer], buffer and positioning
|
| 21 |
+
basic_streambuf* pubsetbuf(char_type* s, streamsize n);
|
| 22 |
+
pos_type pubseekoff(off_type off, ios_base::seekdir way,
|
| 23 |
+
ios_base::openmode which
|
| 24 |
+
= ios_base::in | ios_base::out);
|
| 25 |
+
pos_type pubseekpos(pos_type sp,
|
| 26 |
+
ios_base::openmode which
|
| 27 |
+
= ios_base::in | ios_base::out);
|
| 28 |
+
int pubsync();
|
| 29 |
+
|
| 30 |
+
// get and put areas
|
| 31 |
+
// [streambuf.pub.get], get area
|
| 32 |
+
streamsize in_avail();
|
| 33 |
+
int_type snextc();
|
| 34 |
+
int_type sbumpc();
|
| 35 |
+
int_type sgetc();
|
| 36 |
+
streamsize sgetn(char_type* s, streamsize n);
|
| 37 |
+
|
| 38 |
+
// [streambuf.pub.pback], putback
|
| 39 |
+
int_type sputbackc(char_type c);
|
| 40 |
+
int_type sungetc();
|
| 41 |
+
|
| 42 |
+
// [streambuf.pub.put], put area
|
| 43 |
+
int_type sputc(char_type c);
|
| 44 |
+
streamsize sputn(const char_type* s, streamsize n);
|
| 45 |
+
|
| 46 |
+
protected:
|
| 47 |
+
basic_streambuf();
|
| 48 |
+
basic_streambuf(const basic_streambuf& rhs);
|
| 49 |
+
basic_streambuf& operator=(const basic_streambuf& rhs);
|
| 50 |
+
|
| 51 |
+
void swap(basic_streambuf& rhs);
|
| 52 |
+
|
| 53 |
+
// [streambuf.get.area], get area access
|
| 54 |
+
char_type* eback() const;
|
| 55 |
+
char_type* gptr() const;
|
| 56 |
+
char_type* egptr() const;
|
| 57 |
+
void gbump(int n);
|
| 58 |
+
void setg(char_type* gbeg, char_type* gnext, char_type* gend);
|
| 59 |
+
|
| 60 |
+
// [streambuf.put.area], put area access
|
| 61 |
+
char_type* pbase() const;
|
| 62 |
+
char_type* pptr() const;
|
| 63 |
+
char_type* epptr() const;
|
| 64 |
+
void pbump(int n);
|
| 65 |
+
void setp(char_type* pbeg, char_type* pend);
|
| 66 |
+
|
| 67 |
+
// [streambuf.virtuals], virtual functions
|
| 68 |
+
// [streambuf.virt.locales], locales
|
| 69 |
+
virtual void imbue(const locale& loc);
|
| 70 |
+
|
| 71 |
+
// [streambuf.virt.buffer], buffer management and positioning
|
| 72 |
+
virtual basic_streambuf* setbuf(char_type* s, streamsize n);
|
| 73 |
+
virtual pos_type seekoff(off_type off, ios_base::seekdir way,
|
| 74 |
+
ios_base::openmode which
|
| 75 |
+
= ios_base::in | ios_base::out);
|
| 76 |
+
virtual pos_type seekpos(pos_type sp,
|
| 77 |
+
ios_base::openmode which
|
| 78 |
+
= ios_base::in | ios_base::out);
|
| 79 |
+
virtual int sync();
|
| 80 |
+
|
| 81 |
+
// [streambuf.virt.get], get area
|
| 82 |
+
virtual streamsize showmanyc();
|
| 83 |
+
virtual streamsize xsgetn(char_type* s, streamsize n);
|
| 84 |
+
virtual int_type underflow();
|
| 85 |
+
virtual int_type uflow();
|
| 86 |
+
|
| 87 |
+
// [streambuf.virt.pback], putback
|
| 88 |
+
virtual int_type pbackfail(int_type c = traits::eof());
|
| 89 |
+
|
| 90 |
+
// [streambuf.virt.put], put area
|
| 91 |
+
virtual streamsize xsputn(const char_type* s, streamsize n);
|
| 92 |
+
virtual int_type overflow(int_type c = traits::eof());
|
| 93 |
+
};
|
| 94 |
+
}
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
The class template `basic_streambuf` serves as an abstract base class
|
| 98 |
+
for deriving various *stream buffers* whose objects each control two
|
| 99 |
+
*character sequences*:
|
| 100 |
+
|
| 101 |
+
- a character *input sequence*;
|
| 102 |
+
- a character *output sequence*.
|
| 103 |
+
|