From Jason Turner

[depr.strstreambuf.virtuals]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpuf0ao9mo/{from.md → to.md} +0 -164
tmp/tmpuf0ao9mo/{from.md → to.md} RENAMED
@@ -1,164 +0,0 @@
1
- #### `strstreambuf` overridden virtual functions <a id="depr.strstreambuf.virtuals">[[depr.strstreambuf.virtuals]]</a>
2
-
3
- ``` cpp
4
- int_type overflow(int_type c = EOF) override;
5
- ```
6
-
7
- *Effects:* Appends the character designated by `c` to the output
8
- sequence, if possible, in one of two ways:
9
-
10
- - If `c != EOF` and if either the output sequence has a write position
11
- available or the function makes a write position available (as
12
- described below), assigns `c` to `*pnext++`. Returns
13
- `(unsigned char)c`.
14
- - If `c == EOF`, there is no character to append. Returns a value other
15
- than `EOF`.
16
-
17
- Returns `EOF` to indicate failure.
18
-
19
- *Remarks:* The function can alter the number of write positions
20
- available as a result of any call.
21
-
22
- To make a write position available, the function reallocates (or
23
- initially allocates) an array object with a sufficient number of
24
- elements `n` to hold the current array object (if any), plus at least
25
- one additional write position. How many additional write positions are
26
- made available is otherwise unspecified. If `palloc` is not a null
27
- pointer, the function calls `(*palloc)(n)` to allocate the new dynamic
28
- array object. Otherwise, it evaluates the expression `new charT[n]`. In
29
- either case, if the allocation fails, the function returns `EOF`.
30
- Otherwise, it sets `allocated` in `strmode`.
31
-
32
- To free a previously existing dynamic array object whose first element
33
- address is `p`: If `pfree` is not a null pointer, the function calls
34
- `(*pfree)(p)`. Otherwise, it evaluates the expression `delete[]p`.
35
-
36
- If `(strmode & dynamic) == 0`, or if `(strmode & frozen) != 0`, the
37
- function cannot extend the array (reallocate it with greater length) to
38
- make a write position available.
39
-
40
- *Recommended practice:* An implementation should consider `alsize` in
41
- making the decision how many additional write positions to make
42
- available.
43
-
44
- ``` cpp
45
- int_type pbackfail(int_type c = EOF) override;
46
- ```
47
-
48
- Puts back the character designated by `c` to the input sequence, if
49
- possible, in one of three ways:
50
-
51
- - If `c != EOF`, if the input sequence has a putback position available,
52
- and if `(char)c == gnext[-1]`, assigns `gnext - 1` to `gnext`. Returns
53
- `c`.
54
- - If `c != EOF`, if the input sequence has a putback position available,
55
- and if `strmode & constant` is zero, assigns `c` to `*–gnext`. Returns
56
- `c`.
57
- - If `c == EOF` and if the input sequence has a putback position
58
- available, assigns `gnext - 1` to `gnext`. Returns a value other than
59
- `EOF`.
60
-
61
- Returns `EOF` to indicate failure.
62
-
63
- *Remarks:* If the function can succeed in more than one of these ways,
64
- it is unspecified which way is chosen. The function can alter the number
65
- of putback positions available as a result of any call.
66
-
67
- ``` cpp
68
- int_type underflow() override;
69
- ```
70
-
71
- *Effects:* Reads a character from the *input sequence*, if possible,
72
- without moving the stream position past it, as follows:
73
-
74
- - If the input sequence has a read position available, the function
75
- signals success by returning `(unsigned char)*gnext`.
76
- - Otherwise, if the current write next pointer `pnext` is not a null
77
- pointer and is greater than the current read end pointer `gend`, makes
78
- a *read position* available by assigning to `gend` a value greater
79
- than `gnext` and no greater than `pnext`. Returns
80
- `(unsigned char)*gnext`.
81
-
82
- Returns `EOF` to indicate failure.
83
-
84
- *Remarks:* The function can alter the number of read positions available
85
- as a result of any call.
86
-
87
- ``` cpp
88
- pos_type seekoff(off_type off, seekdir way, openmode which = in | out) override;
89
- ```
90
-
91
- *Effects:* Alters the stream position within one of the controlled
92
- sequences, if possible, as indicated in
93
- [[depr.strstreambuf.seekoff.pos]].
94
-
95
- **Table: `seekoff` positioning** <a id="depr.strstreambuf.seekoff.pos">[depr.strstreambuf.seekoff.pos]</a>
96
-
97
- | Conditions | Result |
98
- | -------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
99
- | `(which & ios::in) != 0` | positions the input sequence |
100
- | `(which & ios::out) != 0` | positions the output sequence |
101
- | `(which & (ios::in | ios::out)) ==`<br> `(ios::in | ios::out)` and either<br> `way == ios::beg` or `way == ios::end` | positions both the input and the output sequences |
102
- | Otherwise | the positioning operation fails. |
103
-
104
-
105
- For a sequence to be positioned, if its next pointer is a null pointer,
106
- the positioning operation fails. Otherwise, the function determines
107
- `newoff` as indicated in [[depr.strstreambuf.seekoff.newoff]].
108
-
109
- **Table: `newoff` values** <a id="depr.strstreambuf.seekoff.newoff">[depr.strstreambuf.seekoff.newoff]</a>
110
-
111
- | Condition | `newoff` Value |
112
- | ----------------- | -------------------------------------------------------------- |
113
- | `way == ios::beg` | 0 |
114
- | `way == ios::cur` | the next pointer minus the beginning pointer (`xnext - xbeg`). |
115
- | `way == ios::end` | `seekhigh` minus the beginning pointer (`seekhigh - xbeg`). |
116
-
117
-
118
- If `(newoff + off) < (seeklow - xbeg)` or
119
- `(seekhigh - xbeg) < (newoff + off)`, the positioning operation fails.
120
- Otherwise, the function assigns `xbeg + newoff + off` to the next
121
- pointer `xnext`.
122
-
123
- *Returns:* `pos_type(newoff)`, constructed from the resultant offset
124
- `newoff` (of type `off_type`), that stores the resultant stream
125
- position, if possible. If the positioning operation fails, or if the
126
- constructed object cannot represent the resultant stream position, the
127
- return value is `pos_type(off_type(-1))`.
128
-
129
- ``` cpp
130
- pos_type seekpos(pos_type sp, ios_base::openmode which = ios_base::in | ios_base::out) override;
131
- ```
132
-
133
- *Effects:* Alters the stream position within one of the controlled
134
- sequences, if possible, to correspond to the stream position stored in
135
- `sp` (as described below).
136
-
137
- - If `(which & ios::in) != 0`, positions the input sequence.
138
- - If `(which & ios::out) != 0`, positions the output sequence.
139
- - If the function positions neither sequence, the positioning operation
140
- fails.
141
-
142
- For a sequence to be positioned, if its next pointer is a null pointer,
143
- the positioning operation fails. Otherwise, the function determines
144
- `newoff` from `sp.offset()`:
145
-
146
- - If `newoff` is an invalid stream position, has a negative value, or
147
- has a value greater than (`seekhigh - seeklow`), the positioning
148
- operation fails
149
- - Otherwise, the function adds `newoff` to the beginning pointer `xbeg`
150
- and stores the result in the next pointer `xnext`.
151
-
152
- *Returns:* `pos_type(newoff)`, constructed from the resultant offset
153
- `newoff` (of type `off_type`), that stores the resultant stream
154
- position, if possible. If the positioning operation fails, or if the
155
- constructed object cannot represent the resultant stream position, the
156
- return value is `pos_type(off_type(-1))`.
157
-
158
- ``` cpp
159
- streambuf<char>* setbuf(char* s, streamsize n) override;
160
- ```
161
-
162
- *Effects:* Behavior is *implementation-defined*, except that
163
- `setbuf(0, 0)` has no effect.
164
-