tmp/tmpr2_8jgaa/{from.md → to.md}
RENAMED
|
@@ -1,7 +1,9 @@
|
|
| 1 |
### Class `strstreambuf` <a id="depr.strstreambuf">[[depr.strstreambuf]]</a>
|
| 2 |
|
|
|
|
|
|
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
class strstreambuf : public basic_streambuf<char> {
|
| 6 |
public:
|
| 7 |
strstreambuf() : strstreambuf(0) {}
|
|
@@ -57,11 +59,11 @@ attributes.
|
|
| 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
|
| 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
|
|
@@ -179,13 +181,13 @@ except that the constructor also sets `constant` in `strmode`.
|
|
| 179 |
virtual ~strstreambuf();
|
| 180 |
```
|
| 181 |
|
| 182 |
*Effects:* Destroys an object of class `strstreambuf`. The function
|
| 183 |
frees the dynamically allocated array object only if
|
| 184 |
-
`(strmode & allocated) != 0` and
|
| 185 |
-
|
| 186 |
-
|
| 187 |
|
| 188 |
#### Member functions <a id="depr.strstreambuf.members">[[depr.strstreambuf.members]]</a>
|
| 189 |
|
| 190 |
``` cpp
|
| 191 |
void freeze(bool freezefl = true);
|
|
@@ -238,11 +240,11 @@ available as a result of any call.
|
|
| 238 |
|
| 239 |
To make a write position available, the function reallocates (or
|
| 240 |
initially allocates) an array object with a sufficient number of
|
| 241 |
elements `n` to hold the current array object (if any), plus at least
|
| 242 |
one additional write position. How many additional write positions are
|
| 243 |
-
made available is otherwise unspecified.
|
| 244 |
pointer, the function calls `(*palloc)(n)` to allocate the new dynamic
|
| 245 |
array object. Otherwise, it evaluates the expression `new charT[n]`. In
|
| 246 |
either case, if the allocation fails, the function returns `EOF`.
|
| 247 |
Otherwise, it sets `allocated` in `strmode`.
|
| 248 |
|
|
@@ -252,10 +254,14 @@ address is `p`: If `pfree` is not a null pointer, the function calls
|
|
| 252 |
|
| 253 |
If `(strmode & dynamic) == 0`, or if `(strmode & frozen) != 0`, the
|
| 254 |
function cannot extend the array (reallocate it with greater length) to
|
| 255 |
make a write position available.
|
| 256 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 257 |
``` cpp
|
| 258 |
int_type pbackfail(int_type c = EOF) override;
|
| 259 |
```
|
| 260 |
|
| 261 |
Puts back the character designated by `c` to the input sequence, if
|
|
@@ -263,12 +269,12 @@ possible, in one of three ways:
|
|
| 263 |
|
| 264 |
- If `c != EOF`, if the input sequence has a putback position available,
|
| 265 |
and if `(char)c == gnext[-1]`, assigns `gnext - 1` to `gnext`. Returns
|
| 266 |
`c`.
|
| 267 |
- If `c != EOF`, if the input sequence has a putback position available,
|
| 268 |
-
and if `strmode & constant` is zero, assigns `c` to `*
|
| 269 |
-
|
| 270 |
- If `c == EOF` and if the input sequence has a putback position
|
| 271 |
available, assigns `gnext - 1` to `gnext`. Returns a value other than
|
| 272 |
`EOF`.
|
| 273 |
|
| 274 |
Returns `EOF` to indicate failure.
|
|
|
|
| 1 |
### Class `strstreambuf` <a id="depr.strstreambuf">[[depr.strstreambuf]]</a>
|
| 2 |
|
| 3 |
+
#### General <a id="depr.strstreambuf.general">[[depr.strstreambuf.general]]</a>
|
| 4 |
+
|
| 5 |
``` cpp
|
| 6 |
namespace std {
|
| 7 |
class strstreambuf : public basic_streambuf<char> {
|
| 8 |
public:
|
| 9 |
strstreambuf() : strstreambuf(0) {}
|
|
|
|
| 59 |
For the sake of exposition, these are represented as elements of a
|
| 60 |
bitmask type (indicated here as `T1`) called `strstate`. The elements
|
| 61 |
are:
|
| 62 |
|
| 63 |
- `allocated`, set when a dynamic array object has been allocated, and
|
| 64 |
+
hence will be freed by the destructor for the `strstreambuf` object;
|
| 65 |
- `constant`, set when the array object has `const` elements, so the
|
| 66 |
output sequence cannot be written;
|
| 67 |
- `dynamic`, set when the array object is allocated (or reallocated) as
|
| 68 |
necessary to hold a character sequence that can change in length;
|
| 69 |
- `frozen`, set when the program has requested that the array object not
|
|
|
|
| 181 |
virtual ~strstreambuf();
|
| 182 |
```
|
| 183 |
|
| 184 |
*Effects:* Destroys an object of class `strstreambuf`. The function
|
| 185 |
frees the dynamically allocated array object only if
|
| 186 |
+
`(strmode & allocated) != 0` and `(strmode & frozen) == 0`.
|
| 187 |
+
([[depr.strstreambuf.virtuals]] describes how a dynamically allocated
|
| 188 |
+
array object is freed.)
|
| 189 |
|
| 190 |
#### Member functions <a id="depr.strstreambuf.members">[[depr.strstreambuf.members]]</a>
|
| 191 |
|
| 192 |
``` cpp
|
| 193 |
void freeze(bool freezefl = true);
|
|
|
|
| 240 |
|
| 241 |
To make a write position available, the function reallocates (or
|
| 242 |
initially allocates) an array object with a sufficient number of
|
| 243 |
elements `n` to hold the current array object (if any), plus at least
|
| 244 |
one additional write position. How many additional write positions are
|
| 245 |
+
made available is otherwise unspecified. If `palloc` is not a null
|
| 246 |
pointer, the function calls `(*palloc)(n)` to allocate the new dynamic
|
| 247 |
array object. Otherwise, it evaluates the expression `new charT[n]`. In
|
| 248 |
either case, if the allocation fails, the function returns `EOF`.
|
| 249 |
Otherwise, it sets `allocated` in `strmode`.
|
| 250 |
|
|
|
|
| 254 |
|
| 255 |
If `(strmode & dynamic) == 0`, or if `(strmode & frozen) != 0`, the
|
| 256 |
function cannot extend the array (reallocate it with greater length) to
|
| 257 |
make a write position available.
|
| 258 |
|
| 259 |
+
*Recommended practice:* An implementation should consider `alsize` in
|
| 260 |
+
making the decision how many additional write positions to make
|
| 261 |
+
available.
|
| 262 |
+
|
| 263 |
``` cpp
|
| 264 |
int_type pbackfail(int_type c = EOF) override;
|
| 265 |
```
|
| 266 |
|
| 267 |
Puts back the character designated by `c` to the input sequence, if
|
|
|
|
| 269 |
|
| 270 |
- If `c != EOF`, if the input sequence has a putback position available,
|
| 271 |
and if `(char)c == gnext[-1]`, assigns `gnext - 1` to `gnext`. Returns
|
| 272 |
`c`.
|
| 273 |
- If `c != EOF`, if the input sequence has a putback position available,
|
| 274 |
+
and if `strmode & constant` is zero, assigns `c` to `*–gnext`. Returns
|
| 275 |
+
`c`.
|
| 276 |
- If `c == EOF` and if the input sequence has a putback position
|
| 277 |
available, assigns `gnext - 1` to `gnext`. Returns a value other than
|
| 278 |
`EOF`.
|
| 279 |
|
| 280 |
Returns `EOF` to indicate failure.
|