From Jason Turner

[filebuf.virtuals]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp3mw8zkyy/{from.md → to.md} +27 -24
tmp/tmp3mw8zkyy/{from.md → to.md} RENAMED
@@ -1,27 +1,27 @@
1
  #### Overridden virtual functions <a id="filebuf.virtuals">[[filebuf.virtuals]]</a>
2
 
3
  ``` cpp
4
- streamsize showmanyc();
5
  ```
6
 
7
  *Effects:* Behaves the same as
8
  `basic_streambuf::showmanyc()` ([[streambuf.virtuals]]).
9
 
10
  *Remarks:* An implementation might well provide an overriding definition
11
  for this function signature if it can determine that more characters can
12
  be read from the input sequence.
13
 
14
  ``` cpp
15
- int_type underflow();
16
  ```
17
 
18
  *Effects:* Behaves according to the description of
19
  `basic_streambuf<charT, traits>::underflow()`, with the specialization
20
  that a sequence of characters is read from the input sequence as if by
21
  reading from the associated file into an internal buffer (`extern_buf`)
22
- and then as if by doing
23
 
24
  ``` cpp
25
  char extern_buf[XSIZE];
26
  char* extern_end;
27
  charT intern_buf[ISIZE];
@@ -35,20 +35,20 @@ This shall be done in such a way that the class can recover the position
35
  (`fpos_t`) corresponding to each character between `intern_buf` and
36
  `intern_end`. If the value of `r` indicates that `a_codecvt.in()` ran
37
  out of space in `intern_buf`, retry with a larger `intern_buf`.
38
 
39
  ``` cpp
40
- int_type uflow();
41
  ```
42
 
43
  *Effects:* Behaves according to the description of
44
- `basic_streambuf<charT,traits>::uflow()`, with the specialization that a
45
- sequence of characters is read from the input with the same method as
46
  used by `underflow`.
47
 
48
  ``` cpp
49
- int_type pbackfail(int_type c = traits::eof());
50
  ```
51
 
52
  *Effects:* Puts back the character designated by `c` to the input
53
  sequence, if possible, in one of three ways:
54
 
@@ -76,11 +76,11 @@ sequence.
76
  If the function can succeed in more than one of these ways, it is
77
  unspecified which way is chosen. The function can alter the number of
78
  putback positions available as a result of any call.
79
 
80
  ``` cpp
81
- int_type overflow(int_type c = traits::eof());
82
  ```
83
 
84
  *Effects:* Behaves according to the description of
85
  `basic_streambuf<charT, traits>::overflow(c)`, except that the behavior
86
  of “consuming characters” is performed by first converting as if by:
@@ -109,31 +109,32 @@ and then
109
 
110
  *Returns:* `traits::not_eof(c)` to indicate success, and `traits::eof()`
111
  to indicate failure. If `is_open() == false`, the function always fails.
112
 
113
  ``` cpp
114
- basic_streambuf* setbuf(char_type* s, streamsize n);
115
  ```
116
 
117
  *Effects:* If `setbuf(0, 0)` is called on a stream before any I/O has
118
  occurred on that stream, the stream becomes unbuffered. Otherwise the
119
  results are *implementation-defined*. “Unbuffered” means that `pbase()`
120
  and `pptr()` always return null and output to the file should appear as
121
  soon as possible.
122
 
123
  ``` cpp
124
  pos_type seekoff(off_type off, ios_base::seekdir way,
125
- ios_base::openmode which = ios_base::in | ios_base::out);
 
126
  ```
127
 
128
  *Effects:* Let `width` denote `a_codecvt.encoding()`. If
129
  `is_open() == false`, or `off != 0 && width <= 0`, then the positioning
130
  operation fails. Otherwise, if `way != basic_ios::cur` or `off != 0`,
131
  and if the last operation was output, then update the output sequence
132
  and write any unshift sequence. Next, seek to the new position: if
133
- `width > 0`, call `std::fseek(file, width * off, whence)`, otherwise
134
- call `std::fseek(file, 0, whence)`.
135
 
136
  *Remarks:* “The last operation was output” means either the last virtual
137
  operation was overflow or the put buffer is non-empty. “Write any
138
  unshift sequence” means, if `width` if less than zero then call
139
  `a_codecvt.unshift(state, xbuf, xbuf+XSIZE, xbuf_end)` and output the
@@ -155,52 +156,54 @@ resultant stream position, if possible. If the positioning operation
155
  fails, or if the object cannot represent the resultant stream position,
156
  returns `pos_type(off_type(-1))`.
157
 
158
  ``` cpp
159
  pos_type seekpos(pos_type sp,
160
- ios_base::openmode which = ios_base::in | ios_base::out);
 
161
  ```
162
 
163
  Alters the file position, if possible, to correspond to the position
164
  stored in `sp` (as described below). Altering the file position performs
165
  as follows:
166
 
167
  1. if `(om & ios_base::out) != 0`, then update the output sequence and
168
  write any unshift sequence;
169
- 2. set the file position to `sp`;
170
  3. if `(om & ios_base::in) != 0`, then update the input sequence;
171
 
172
  where `om` is the open mode passed to the last call to `open()`. The
173
- operation fails if `is_open()` returns false.
174
 
175
  If `sp` is an invalid stream position, or if the function positions
176
  neither sequence, the positioning operation fails. If `sp` has not been
177
  obtained by a previous successful call to one of the positioning
178
  functions (`seekoff` or `seekpos`) on the same file the effects are
179
  undefined.
180
 
181
  *Returns:* `sp` on success. Otherwise returns `pos_type(off_type(-1))`.
182
 
183
  ``` cpp
184
- int sync();
185
  ```
186
 
187
  *Effects:* If a put area exists, calls `filebuf::overflow` to write the
188
- characters to the file. If a get area exists, the effect is
 
189
  *implementation-defined*.
190
 
191
  ``` cpp
192
- void imbue(const locale& loc);
193
  ```
194
 
195
- If the file is not positioned at its beginning and the encoding of the
196
- current locale as determined by `a_codecvt.encoding()` is
197
- state-dependent ([[locale.codecvt.virtuals]]) then that facet is the
198
  same as the corresponding facet of `loc`.
199
 
200
  *Effects:* Causes characters inserted or extracted after this call to be
201
  converted according to `loc` until another call of `imbue`.
202
 
203
- This may require reconversion of previously converted characters. This
204
- in turn may require the implementation to be able to reconstruct the
205
- original contents of the file.
206
 
 
1
  #### Overridden virtual functions <a id="filebuf.virtuals">[[filebuf.virtuals]]</a>
2
 
3
  ``` cpp
4
+ streamsize showmanyc() override;
5
  ```
6
 
7
  *Effects:* Behaves the same as
8
  `basic_streambuf::showmanyc()` ([[streambuf.virtuals]]).
9
 
10
  *Remarks:* An implementation might well provide an overriding definition
11
  for this function signature if it can determine that more characters can
12
  be read from the input sequence.
13
 
14
  ``` cpp
15
+ int_type underflow() override;
16
  ```
17
 
18
  *Effects:* Behaves according to the description of
19
  `basic_streambuf<charT, traits>::underflow()`, with the specialization
20
  that a sequence of characters is read from the input sequence as if by
21
  reading from the associated file into an internal buffer (`extern_buf`)
22
+ and then as if by doing:
23
 
24
  ``` cpp
25
  char extern_buf[XSIZE];
26
  char* extern_end;
27
  charT intern_buf[ISIZE];
 
35
  (`fpos_t`) corresponding to each character between `intern_buf` and
36
  `intern_end`. If the value of `r` indicates that `a_codecvt.in()` ran
37
  out of space in `intern_buf`, retry with a larger `intern_buf`.
38
 
39
  ``` cpp
40
+ int_type uflow() override;
41
  ```
42
 
43
  *Effects:* Behaves according to the description of
44
+ `basic_streambuf<charT, traits>::uflow()`, with the specialization that
45
+ a sequence of characters is read from the input with the same method as
46
  used by `underflow`.
47
 
48
  ``` cpp
49
+ int_type pbackfail(int_type c = traits::eof()) override;
50
  ```
51
 
52
  *Effects:* Puts back the character designated by `c` to the input
53
  sequence, if possible, in one of three ways:
54
 
 
76
  If the function can succeed in more than one of these ways, it is
77
  unspecified which way is chosen. The function can alter the number of
78
  putback positions available as a result of any call.
79
 
80
  ``` cpp
81
+ int_type overflow(int_type c = traits::eof()) override;
82
  ```
83
 
84
  *Effects:* Behaves according to the description of
85
  `basic_streambuf<charT, traits>::overflow(c)`, except that the behavior
86
  of “consuming characters” is performed by first converting as if by:
 
109
 
110
  *Returns:* `traits::not_eof(c)` to indicate success, and `traits::eof()`
111
  to indicate failure. If `is_open() == false`, the function always fails.
112
 
113
  ``` cpp
114
+ basic_streambuf* setbuf(char_type* s, streamsize n) override;
115
  ```
116
 
117
  *Effects:* If `setbuf(0, 0)` is called on a stream before any I/O has
118
  occurred on that stream, the stream becomes unbuffered. Otherwise the
119
  results are *implementation-defined*. “Unbuffered” means that `pbase()`
120
  and `pptr()` always return null and output to the file should appear as
121
  soon as possible.
122
 
123
  ``` cpp
124
  pos_type seekoff(off_type off, ios_base::seekdir way,
125
+ ios_base::openmode which
126
+ = ios_base::in | ios_base::out) override;
127
  ```
128
 
129
  *Effects:* Let `width` denote `a_codecvt.encoding()`. If
130
  `is_open() == false`, or `off != 0 && width <= 0`, then the positioning
131
  operation fails. Otherwise, if `way != basic_ios::cur` or `off != 0`,
132
  and if the last operation was output, then update the output sequence
133
  and write any unshift sequence. Next, seek to the new position: if
134
+ `width > 0`, call `fseek(file, width * off, whence)`, otherwise call
135
+ `fseek(file, 0, whence)`.
136
 
137
  *Remarks:* “The last operation was output” means either the last virtual
138
  operation was overflow or the put buffer is non-empty. “Write any
139
  unshift sequence” means, if `width` if less than zero then call
140
  `a_codecvt.unshift(state, xbuf, xbuf+XSIZE, xbuf_end)` and output the
 
156
  fails, or if the object cannot represent the resultant stream position,
157
  returns `pos_type(off_type(-1))`.
158
 
159
  ``` cpp
160
  pos_type seekpos(pos_type sp,
161
+ ios_base::openmode which
162
+ = ios_base::in | ios_base::out) override;
163
  ```
164
 
165
  Alters the file position, if possible, to correspond to the position
166
  stored in `sp` (as described below). Altering the file position performs
167
  as follows:
168
 
169
  1. if `(om & ios_base::out) != 0`, then update the output sequence and
170
  write any unshift sequence;
171
+ 2. set the file position to `sp` as if by a call to `fsetpos`;
172
  3. if `(om & ios_base::in) != 0`, then update the input sequence;
173
 
174
  where `om` is the open mode passed to the last call to `open()`. The
175
+ operation fails if `is_open()` returns `false`.
176
 
177
  If `sp` is an invalid stream position, or if the function positions
178
  neither sequence, the positioning operation fails. If `sp` has not been
179
  obtained by a previous successful call to one of the positioning
180
  functions (`seekoff` or `seekpos`) on the same file the effects are
181
  undefined.
182
 
183
  *Returns:* `sp` on success. Otherwise returns `pos_type(off_type(-1))`.
184
 
185
  ``` cpp
186
+ int sync() override;
187
  ```
188
 
189
  *Effects:* If a put area exists, calls `filebuf::overflow` to write the
190
+ characters to the file, then flushes the file as if by calling
191
+ `fflush(file)`. If a get area exists, the effect is
192
  *implementation-defined*.
193
 
194
  ``` cpp
195
+ void imbue(const locale& loc) override;
196
  ```
197
 
198
+ *Requires:* If the file is not positioned at its beginning and the
199
+ encoding of the current locale as determined by `a_codecvt.encoding()`
200
+ is state-dependent ([[locale.codecvt.virtuals]]) then that facet is the
201
  same as the corresponding facet of `loc`.
202
 
203
  *Effects:* Causes characters inserted or extracted after this call to be
204
  converted according to `loc` until another call of `imbue`.
205
 
206
+ *Remarks:* This may require reconversion of previously converted
207
+ characters. This in turn may require the implementation to be able to
208
+ reconstruct the original contents of the file.
209