From Jason Turner

[streambuf.virtuals]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmps7icqqxf/{from.md → to.md} +18 -18
tmp/tmps7icqqxf/{from.md → to.md} RENAMED
@@ -1,6 +1,6 @@
1
- #### `basic_streambuf` virtual functions <a id="streambuf.virtuals">[[streambuf.virtuals]]</a>
2
 
3
  ##### Locales <a id="streambuf.virt.locales">[[streambuf.virt.locales]]</a>
4
 
5
  ``` cpp
6
  void imbue(const locale&);
@@ -61,11 +61,11 @@ int sync();
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
 
@@ -102,11 +102,11 @@ to `sbumpc()` would return `traits::eof()`.
102
  ``` cpp
103
  int_type underflow();
104
  ```
105
 
106
  *Remarks:* The public members of `basic_streambuf` call this virtual
107
- function only if `gptr()` is null or `gptr() >= egptr()`
108
 
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.
@@ -144,13 +144,13 @@ that either
144
 
145
  ``` cpp
146
  int_type uflow();
147
  ```
148
 
149
- *Requires:* The constraints are the same as for `underflow()`, except
150
- that the result character shall be transferred from the pending sequence
151
- to the backup sequence, and the pending sequence shall not be empty
152
  before the transfer.
153
 
154
  *Default behavior:* Calls `underflow()`. If `underflow()` returns
155
  `traits::eof()`, returns `traits::eof()`. Otherwise, returns the value
156
  of `traits::to_int_type(*gptr())` and increment the value of the next
@@ -177,11 +177,11 @@ modifications that
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.
@@ -213,32 +213,32 @@ 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
 
 
1
+ #### Virtual functions <a id="streambuf.virtuals">[[streambuf.virtuals]]</a>
2
 
3
  ##### Locales <a id="streambuf.virt.locales">[[streambuf.virt.locales]]</a>
4
 
5
  ``` cpp
6
  void imbue(const locale&);
 
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
 
 
102
  ``` cpp
103
  int_type underflow();
104
  ```
105
 
106
  *Remarks:* The public members of `basic_streambuf` call this virtual
107
+ function only if `gptr()` is null or `gptr() >= egptr()`.
108
 
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.
 
144
 
145
  ``` cpp
146
  int_type uflow();
147
  ```
148
 
149
+ *Preconditions:* The constraints are the same as for `underflow()`,
150
+ except that the result character is transferred from the pending
151
+ sequence to the backup sequence, and the pending sequence is not empty
152
  before the transfer.
153
 
154
  *Default behavior:* Calls `underflow()`. If `underflow()` returns
155
  `traits::eof()`, returns `traits::eof()`. Otherwise, returns the value
156
  of `traits::to_int_type(*gptr())` and increment the value of the next
 
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
+ *Ensures:* 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.
 
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 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
+ *Preconditions:* Every overriding definition of this virtual function
228
+ obeys the following constraints:
229
 
230
+ - The effect of consuming a character on the associated output sequence
231
+ is specified.[^16]
232
+ - Let `r` be the number of characters in the pending sequence not
233
+ consumed. If `r` is nonzero then `pbase()` and `pptr()` are set so
234
+ 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 set
238
+ to the same non-null value.
239
+ - 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