tmp/tmpi_z7rn1o/{from.md → to.md}
RENAMED
|
@@ -1,98 +0,0 @@
|
|
| 1 |
-
##### Buffer conversions <a id="conversions.buffer">[[conversions.buffer]]</a>
|
| 2 |
-
|
| 3 |
-
Class template `wbuffer_convert` looks like a wide stream buffer, but
|
| 4 |
-
performs all its I/O through an underlying byte stream buffer that you
|
| 5 |
-
specify when you construct it. Like class template `wstring_convert`, it
|
| 6 |
-
lets you specify a code conversion facet to perform the conversions,
|
| 7 |
-
without affecting any streams or locales.
|
| 8 |
-
|
| 9 |
-
``` cpp
|
| 10 |
-
namespace std {
|
| 11 |
-
template<class Codecvt,
|
| 12 |
-
class Elem = wchar_t,
|
| 13 |
-
class Tr = std::char_traits<Elem> >
|
| 14 |
-
class wbuffer_convert
|
| 15 |
-
: public std::basic_streambuf<Elem, Tr> {
|
| 16 |
-
public:
|
| 17 |
-
typedef typename Codecvt::state_type state_type;
|
| 18 |
-
|
| 19 |
-
explicit wbuffer_convert(std::streambuf* bytebuf = 0,
|
| 20 |
-
Codecvt* pcvt = new Codecvt,
|
| 21 |
-
state_type state = state_type());
|
| 22 |
-
|
| 23 |
-
~wbuffer_convert();
|
| 24 |
-
|
| 25 |
-
wbuffer_convert(const wbuffer_convert&) = delete;
|
| 26 |
-
wbuffer_convert& operator=(const wbuffer_convert&) = delete;
|
| 27 |
-
|
| 28 |
-
std::streambuf* rdbuf() const;
|
| 29 |
-
std::streambuf* rdbuf(std::streambuf* bytebuf);
|
| 30 |
-
|
| 31 |
-
state_type state() const;
|
| 32 |
-
|
| 33 |
-
private:
|
| 34 |
-
std::streambuf* bufptr; // exposition only
|
| 35 |
-
Codecvt* cvtptr; // exposition only
|
| 36 |
-
state_type cvtstate; // exposition only
|
| 37 |
-
};
|
| 38 |
-
}
|
| 39 |
-
```
|
| 40 |
-
|
| 41 |
-
The class template describes a stream buffer that controls the
|
| 42 |
-
transmission of elements of type `Elem`, whose character traits are
|
| 43 |
-
described by the class `Tr`, to and from a byte stream buffer of type
|
| 44 |
-
`std::streambuf`. Conversion between a sequence of `Elem` values and
|
| 45 |
-
multibyte sequences is performed by an object of class `Codecvt`, which
|
| 46 |
-
shall meet the requirements of the standard code-conversion facet
|
| 47 |
-
`std::codecvt<Elem, char, std::mbstate_t>`.
|
| 48 |
-
|
| 49 |
-
An object of this class template stores:
|
| 50 |
-
|
| 51 |
-
- `bufptr` — a pointer to its underlying byte stream buffer
|
| 52 |
-
- `cvtptr` — a pointer to the allocated conversion object (which is
|
| 53 |
-
freed when the `wbuffer_convert` object is destroyed)
|
| 54 |
-
- `cvtstate` — a conversion state object
|
| 55 |
-
|
| 56 |
-
``` cpp
|
| 57 |
-
state_type state() const;
|
| 58 |
-
```
|
| 59 |
-
|
| 60 |
-
*Returns:* `cvtstate`.
|
| 61 |
-
|
| 62 |
-
``` cpp
|
| 63 |
-
std::streambuf* rdbuf() const;
|
| 64 |
-
```
|
| 65 |
-
|
| 66 |
-
*Returns:* `bufptr`.
|
| 67 |
-
|
| 68 |
-
``` cpp
|
| 69 |
-
std::streambuf* rdbuf(std::streambuf* bytebuf);
|
| 70 |
-
```
|
| 71 |
-
|
| 72 |
-
*Effects:* stores `bytebuf` in `bufptr`.
|
| 73 |
-
|
| 74 |
-
*Returns:* The previous value of `bufptr`.
|
| 75 |
-
|
| 76 |
-
``` cpp
|
| 77 |
-
typedef typename Codecvt::state_type state_type;
|
| 78 |
-
```
|
| 79 |
-
|
| 80 |
-
The type shall be a synonym for `Codecvt::state_type`.
|
| 81 |
-
|
| 82 |
-
``` cpp
|
| 83 |
-
explicit wbuffer_convert(std::streambuf* bytebuf = 0,
|
| 84 |
-
Codecvt* pcvt = new Codecvt, state_type state = state_type());
|
| 85 |
-
```
|
| 86 |
-
|
| 87 |
-
*Requires:* `pcvt != nullptr`.
|
| 88 |
-
|
| 89 |
-
*Effects:* The constructor constructs a stream buffer object,
|
| 90 |
-
initializes `bufptr` to `bytebuf`, initializes `cvtptr` to `pcvt`, and
|
| 91 |
-
initializes `cvtstate` to `state`.
|
| 92 |
-
|
| 93 |
-
``` cpp
|
| 94 |
-
~wbuffer_convert();
|
| 95 |
-
```
|
| 96 |
-
|
| 97 |
-
*Effects:* The destructor shall delete `cvtptr`.
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|