tmp/tmpj1t67dgz/{from.md → to.md}
RENAMED
|
@@ -1,92 +0,0 @@
|
|
| 1 |
-
### Class template `wbuffer_convert` <a id="depr.conversions.buffer">[[depr.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, class Elem = wchar_t, class Tr = char_traits<Elem>>
|
| 12 |
-
class wbuffer_convert : public basic_streambuf<Elem, Tr> {
|
| 13 |
-
public:
|
| 14 |
-
using state_type = typename Codecvt::state_type;
|
| 15 |
-
|
| 16 |
-
wbuffer_convert() : wbuffer_convert(nullptr) {}
|
| 17 |
-
explicit wbuffer_convert(streambuf* bytebuf,
|
| 18 |
-
Codecvt* pcvt = new Codecvt,
|
| 19 |
-
state_type state = state_type());
|
| 20 |
-
|
| 21 |
-
~wbuffer_convert();
|
| 22 |
-
|
| 23 |
-
wbuffer_convert(const wbuffer_convert&) = delete;
|
| 24 |
-
wbuffer_convert& operator=(const wbuffer_convert&) = delete;
|
| 25 |
-
|
| 26 |
-
streambuf* rdbuf() const;
|
| 27 |
-
streambuf* rdbuf(streambuf* bytebuf);
|
| 28 |
-
|
| 29 |
-
state_type state() const;
|
| 30 |
-
|
| 31 |
-
private:
|
| 32 |
-
streambuf* bufptr; // exposition only
|
| 33 |
-
Codecvt* cvtptr; // exposition only
|
| 34 |
-
state_type cvtstate; // exposition only
|
| 35 |
-
};
|
| 36 |
-
}
|
| 37 |
-
```
|
| 38 |
-
|
| 39 |
-
The class template describes a stream buffer that controls the
|
| 40 |
-
transmission of elements of type `Elem`, whose character traits are
|
| 41 |
-
described by the class `Tr`, to and from a byte stream buffer of type
|
| 42 |
-
`streambuf`. Conversion between a sequence of `Elem` values and
|
| 43 |
-
multibyte sequences is performed by an object of class `Codecvt`, which
|
| 44 |
-
shall meet the requirements of the standard code-conversion facet
|
| 45 |
-
`codecvt<Elem, char, mbstate_t>`.
|
| 46 |
-
|
| 47 |
-
An object of this class template stores:
|
| 48 |
-
|
| 49 |
-
- `bufptr` — a pointer to its underlying byte stream buffer
|
| 50 |
-
- `cvtptr` — a pointer to the allocated conversion object (which is
|
| 51 |
-
freed when the `wbuffer_convert` object is destroyed)
|
| 52 |
-
- `cvtstate` — a conversion state object
|
| 53 |
-
|
| 54 |
-
``` cpp
|
| 55 |
-
state_type state() const;
|
| 56 |
-
```
|
| 57 |
-
|
| 58 |
-
*Returns:* `cvtstate`.
|
| 59 |
-
|
| 60 |
-
``` cpp
|
| 61 |
-
streambuf* rdbuf() const;
|
| 62 |
-
```
|
| 63 |
-
|
| 64 |
-
*Returns:* `bufptr`.
|
| 65 |
-
|
| 66 |
-
``` cpp
|
| 67 |
-
streambuf* rdbuf(streambuf* bytebuf);
|
| 68 |
-
```
|
| 69 |
-
|
| 70 |
-
*Effects:* Stores `bytebuf` in `bufptr`.
|
| 71 |
-
|
| 72 |
-
*Returns:* The previous value of `bufptr`.
|
| 73 |
-
|
| 74 |
-
``` cpp
|
| 75 |
-
explicit wbuffer_convert(
|
| 76 |
-
streambuf* bytebuf,
|
| 77 |
-
Codecvt* pcvt = new Codecvt,
|
| 78 |
-
state_type state = state_type());
|
| 79 |
-
```
|
| 80 |
-
|
| 81 |
-
*Requires:* `pcvt != nullptr`.
|
| 82 |
-
|
| 83 |
-
*Effects:* The constructor constructs a stream buffer object,
|
| 84 |
-
initializes `bufptr` to `bytebuf`, initializes `cvtptr` to `pcvt`, and
|
| 85 |
-
initializes `cvtstate` to `state`.
|
| 86 |
-
|
| 87 |
-
``` cpp
|
| 88 |
-
~wbuffer_convert();
|
| 89 |
-
```
|
| 90 |
-
|
| 91 |
-
*Effects:* The destructor shall delete `cvtptr`.
|
| 92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|