From Jason Turner

[streambuf.virtuals]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpsggakeao/{from.md → to.md} +50 -16
tmp/tmpsggakeao/{from.md → to.md} RENAMED
@@ -60,12 +60,12 @@ int sync();
60
  *Effects:* Synchronizes the controlled sequences with the arrays. That
61
  is, if `pbase()` is non-null the characters between `pbase()` and
62
  `pptr()` are written to the controlled sequence. The pointers may then
63
  be reset as appropriate.
64
 
65
- *Returns:* -1 on failure. What constitutes failure is determined by each
66
- derived class ([[filebuf.virtuals]]).
67
 
68
  *Default behavior:* Returns zero.
69
 
70
  ##### Get area <a id="streambuf.virt.get">[[streambuf.virt.get]]</a>
71
 
@@ -109,22 +109,38 @@ function only if `gptr()` is null or `gptr() >= egptr()`
109
  *Returns:* `traits::to_int_type(c)`, where `c` is the first *character*
110
  of the *pending sequence*, without moving the input sequence position
111
  past it. If the pending sequence is null then the function returns
112
  `traits::eof()` to indicate failure.
113
 
114
- The *pending sequence* of characters is defined as the concatenation of:
115
 
116
- The *result character* is
 
 
 
117
 
118
- The *backup sequence* is defined as the concatenation of:
 
 
119
 
120
- *Effects:* The function sets up the `gptr()` and `egptr()` satisfying
121
- one of:
 
 
 
 
 
122
 
123
  If `eback()` and `gptr()` are non-null then the function is not
124
  constrained as to their contents, but the “usual backup condition” is
125
- that either:
 
 
 
 
 
 
126
 
127
  *Default behavior:* Returns `traits::eof()`.
128
 
129
  ``` cpp
130
  int_type uflow();
@@ -157,16 +173,16 @@ The *pending sequence* is defined as for `underflow()`, with the
157
  modifications that
158
 
159
  - If `traits::eq_int_type(c, traits::eof())` returns `true`, then the
160
  input sequence is backed up one character before the pending sequence
161
  is determined.
162
- - If `traits::eq_int_type(c,traits::eof())` returns `false`, then `c` is
163
- prepended. Whether the input sequence is backed up or modified in any
164
- other way is unspecified.
165
 
166
- On return, the constraints of `gptr()`, `eback()`, and `pptr()` are the
167
- same as for `underflow()`.
168
 
169
  *Returns:* `traits::eof()` to indicate failure. Failure may occur
170
  because the input sequence could not be backed up, or if for some other
171
  reason the pointers could not be set consistent with the constraints.
172
  `pbackfail()` is called only when put back has really failed.
@@ -183,13 +199,13 @@ streamsize xsputn(const char_type* s, streamsize n);
183
 
184
  *Effects:* Writes up to `n` characters to the output sequence as if by
185
  repeated calls to `sputc(c)`. The characters written are obtained from
186
  successive elements of the array whose first element is designated by
187
  `s`. Writing stops when either `n` characters have been written or a
188
- call to `sputc(c)` would return `traits::eof()`. Is is unspecified
189
  whether the function calls `overflow()` when `pptr() == epptr()` becomes
190
- true or whether it achieves the same effects by other means.
191
 
192
  *Returns:* The number of characters written.
193
 
194
  ``` cpp
195
  int_type overflow(int_type c = traits::eof());
@@ -197,19 +213,37 @@ int_type overflow(int_type c = traits::eof());
197
 
198
  *Effects:* Consumes some initial subsequence of the characters of the
199
  *pending sequence*. The pending sequence is defined as the concatenation
200
  of
201
 
 
 
 
 
 
202
  *Remarks:* The member functions `sputc()` and `sputn()` call this
203
  function in case that no room can be found in the put buffer enough to
204
  accommodate the argument character sequence.
205
 
206
  *Requires:* Every overriding definition of this virtual function shall
207
  obey the following constraints:
208
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  *Returns:* `traits::eof()` or throws an exception if the function fails.
210
 
211
  Otherwise, returns some value other than `traits::eof()` to indicate
212
- success.[^16]
213
 
214
  *Default behavior:* Returns `traits::eof()`.
215
 
 
60
  *Effects:* Synchronizes the controlled sequences with the arrays. That
61
  is, if `pbase()` is non-null the characters between `pbase()` and
62
  `pptr()` are written to the controlled sequence. The pointers may then
63
  be reset as appropriate.
64
 
65
+ *Returns:* `-1` on failure. What constitutes failure is determined by
66
+ each derived class ([[filebuf.virtuals]]).
67
 
68
  *Default behavior:* Returns zero.
69
 
70
  ##### Get area <a id="streambuf.virt.get">[[streambuf.virt.get]]</a>
71
 
 
109
  *Returns:* `traits::to_int_type(c)`, where `c` is the first *character*
110
  of the *pending sequence*, without moving the input sequence position
111
  past it. If the pending sequence is null then the function returns
112
  `traits::eof()` to indicate failure.
113
 
114
+ The *pending sequence* of characters is defined as the concatenation of
115
 
116
+ - the empty sequence if `gptr()` is null, otherwise the characters in
117
+ \[`gptr()`, `egptr()`), followed by
118
+ - some (possibly empty) sequence of characters read from the input
119
+ sequence.
120
 
121
+ The *result character* is the first character of the pending sequence if
122
+ it is non-empty, otherwise the next character that would be read from
123
+ the input sequence.
124
 
125
+ The *backup sequence* is the empty sequence if `eback()` is null,
126
+ otherwise the characters in \[`eback()`, `gptr()`).
127
+
128
+ *Effects:* The function sets up the `gptr()` and `egptr()` such that if
129
+ the pending sequence is non-empty, then `egptr()` is non-null and the
130
+ characters in \[`gptr()`, `egptr()`) are the characters in the pending
131
+ sequence, otherwise either `gptr()` is null or `gptr() == egptr()`.
132
 
133
  If `eback()` and `gptr()` are non-null then the function is not
134
  constrained as to their contents, but the “usual backup condition” is
135
+ that either
136
+
137
+ - the backup sequence contains at least `gptr() - eback()` characters,
138
+ in which case the characters in \[`eback()`, `gptr()`) agree with the
139
+ last `gptr() - eback()` characters of the backup sequence, or
140
+ - the characters in \[`gptr() - n`, `gptr()`) agree with the backup
141
+ sequence (where `n` is the length of the backup sequence).
142
 
143
  *Default behavior:* Returns `traits::eof()`.
144
 
145
  ``` cpp
146
  int_type uflow();
 
173
  modifications that
174
 
175
  - If `traits::eq_int_type(c, traits::eof())` returns `true`, then the
176
  input sequence is backed up one character before the pending sequence
177
  is determined.
178
+ - If `traits::eq_int_type(c, traits::eof())` returns `false`, then `c`
179
+ is prepended. Whether the input sequence is backed up or modified in
180
+ any other way is unspecified.
181
 
182
+ *Postconditions:* On return, the constraints of `gptr()`, `eback()`, and
183
+ `pptr()` are the same as for `underflow()`.
184
 
185
  *Returns:* `traits::eof()` to indicate failure. Failure may occur
186
  because the input sequence could not be backed up, or if for some other
187
  reason the pointers could not be set consistent with the constraints.
188
  `pbackfail()` is called only when put back has really failed.
 
199
 
200
  *Effects:* Writes up to `n` characters to the output sequence as if by
201
  repeated calls to `sputc(c)`. The characters written are obtained from
202
  successive elements of the array whose first element is designated by
203
  `s`. Writing stops when either `n` characters have been written or a
204
+ call to `sputc(c)` would return `traits::eof()`. It is unspecified
205
  whether the function calls `overflow()` when `pptr() == epptr()` becomes
206
+ `true` or whether it achieves the same effects by other means.
207
 
208
  *Returns:* The number of characters written.
209
 
210
  ``` cpp
211
  int_type overflow(int_type c = traits::eof());
 
213
 
214
  *Effects:* Consumes some initial subsequence of the characters of the
215
  *pending sequence*. The pending sequence is defined as the concatenation
216
  of
217
 
218
+ - the empty sequence if `pbase()` is not null, otherwise the
219
+ `pptr() - pbase()` characters beginning at `pbase()`, followed by
220
+ - the empty sequence if `traits::eq_int_type(c, traits::eof())` returns
221
+ `true`, otherwise the sequence consisting of `c`.
222
+
223
  *Remarks:* The member functions `sputc()` and `sputn()` call this
224
  function in case that no room can be found in the put buffer enough to
225
  accommodate the argument character sequence.
226
 
227
  *Requires:* Every overriding definition of this virtual function shall
228
  obey the following constraints:
229
 
230
+ 1. The effect of consuming a character on the associated output
231
+ sequence is specified[^16]
232
+ 2. Let `r` be the number of characters in the pending sequence not
233
+ consumed. If `r` is nonzero then `pbase()` and `pptr()` shall be set
234
+ so that: `pptr() - pbase() == r` and the `r` characters starting at
235
+ `pbase()` are the associated output stream. In case `r` is zero (all
236
+ characters of the pending sequence have been consumed) then either
237
+ `pbase()` is set to `nullptr`, or `pbase()` and `pptr()` are both
238
+ set to the same non-null value.
239
+ 3. The function may fail if either appending some character to the
240
+ associated output stream fails or if it is unable to establish
241
+ `pbase()` and `pptr()` according to the above rules.
242
+
243
  *Returns:* `traits::eof()` or throws an exception if the function fails.
244
 
245
  Otherwise, returns some value other than `traits::eof()` to indicate
246
+ success.[^17]
247
 
248
  *Default behavior:* Returns `traits::eof()`.
249