tmp/tmp5fmejocr/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### General <a id="depr.strstreambuf.general">[[depr.strstreambuf.general]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std {
|
| 5 |
+
class strstreambuf : public basic_streambuf<char> {
|
| 6 |
+
public:
|
| 7 |
+
strstreambuf() : strstreambuf(0) {}
|
| 8 |
+
explicit strstreambuf(streamsize alsize_arg);
|
| 9 |
+
strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));
|
| 10 |
+
strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = nullptr);
|
| 11 |
+
strstreambuf(const char* gnext_arg, streamsize n);
|
| 12 |
+
|
| 13 |
+
strstreambuf(signed char* gnext_arg, streamsize n,
|
| 14 |
+
signed char* pbeg_arg = nullptr);
|
| 15 |
+
strstreambuf(const signed char* gnext_arg, streamsize n);
|
| 16 |
+
strstreambuf(unsigned char* gnext_arg, streamsize n,
|
| 17 |
+
unsigned char* pbeg_arg = nullptr);
|
| 18 |
+
strstreambuf(const unsigned char* gnext_arg, streamsize n);
|
| 19 |
+
|
| 20 |
+
virtual ~strstreambuf();
|
| 21 |
+
|
| 22 |
+
void freeze(bool freezefl = true);
|
| 23 |
+
char* str();
|
| 24 |
+
int pcount();
|
| 25 |
+
|
| 26 |
+
protected:
|
| 27 |
+
int_type overflow (int_type c = EOF) override;
|
| 28 |
+
int_type pbackfail(int_type c = EOF) override;
|
| 29 |
+
int_type underflow() override;
|
| 30 |
+
pos_type seekoff(off_type off, ios_base::seekdir way,
|
| 31 |
+
ios_base::openmode which = ios_base::in | ios_base::out) override;
|
| 32 |
+
pos_type seekpos(pos_type sp,
|
| 33 |
+
ios_base::openmode which = ios_base::in | ios_base::out) override;
|
| 34 |
+
streambuf* setbuf(char* s, streamsize n) override;
|
| 35 |
+
|
| 36 |
+
private:
|
| 37 |
+
using strstate = T1; // exposition only
|
| 38 |
+
static const strstate allocated; // exposition only
|
| 39 |
+
static const strstate constant; // exposition only
|
| 40 |
+
static const strstate dynamic; // exposition only
|
| 41 |
+
static const strstate frozen; // exposition only
|
| 42 |
+
strstate strmode; // exposition only
|
| 43 |
+
streamsize alsize; // exposition only
|
| 44 |
+
void* (*palloc)(size_t); // exposition only
|
| 45 |
+
void (*pfree)(void*); // exposition only
|
| 46 |
+
};
|
| 47 |
+
}
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
The class `strstreambuf` associates the input sequence, and possibly the
|
| 51 |
+
output sequence, with an object of some *character* array type, whose
|
| 52 |
+
elements store arbitrary values. The array object has several
|
| 53 |
+
attributes.
|
| 54 |
+
|
| 55 |
+
[*Note 1*:
|
| 56 |
+
|
| 57 |
+
For the sake of exposition, these are represented as elements of a
|
| 58 |
+
bitmask type (indicated here as `T1`) called `strstate`. The elements
|
| 59 |
+
are:
|
| 60 |
+
|
| 61 |
+
- `allocated`, set when a dynamic array object has been allocated, and
|
| 62 |
+
hence will be freed by the destructor for the `strstreambuf` object;
|
| 63 |
+
- `constant`, set when the array object has `const` elements, so the
|
| 64 |
+
output sequence cannot be written;
|
| 65 |
+
- `dynamic`, set when the array object is allocated (or reallocated) as
|
| 66 |
+
necessary to hold a character sequence that can change in length;
|
| 67 |
+
- `frozen`, set when the program has requested that the array object not
|
| 68 |
+
be altered, reallocated, or freed.
|
| 69 |
+
|
| 70 |
+
— *end note*]
|
| 71 |
+
|
| 72 |
+
[*Note 2*:
|
| 73 |
+
|
| 74 |
+
For the sake of exposition, the maintained data is presented here as:
|
| 75 |
+
|
| 76 |
+
- `strstate strmode`, the attributes of the array object associated with
|
| 77 |
+
the `strstreambuf` object;
|
| 78 |
+
- `int alsize`, the suggested minimum size for a dynamic array object;
|
| 79 |
+
- `void* (*palloc)(size_t)`, points to the function to call to allocate
|
| 80 |
+
a dynamic array object;
|
| 81 |
+
- `void (*pfree)(void*)`, points to the function to call to free a
|
| 82 |
+
dynamic array object.
|
| 83 |
+
|
| 84 |
+
— *end note*]
|
| 85 |
+
|
| 86 |
+
Each object of class `strstreambuf` has a *seekable area*, delimited by
|
| 87 |
+
the pointers `seeklow` and `seekhigh`. If `gnext` is a null pointer, the
|
| 88 |
+
seekable area is undefined. Otherwise, `seeklow` equals `gbeg` and
|
| 89 |
+
`seekhigh` is either `pend`, if `pend` is not a null pointer, or `gend`.
|
| 90 |
+
|