From Jason Turner

[ios]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp_b9rt290/{from.md → to.md} +52 -54
tmp/tmp_b9rt290/{from.md → to.md} RENAMED
@@ -61,28 +61,27 @@ namespace std {
61
 
62
  };
63
  }
64
  ```
65
 
66
- #### `basic_ios` constructors <a id="basic.ios.cons">[[basic.ios.cons]]</a>
67
 
68
  ``` cpp
69
  explicit basic_ios(basic_streambuf<charT, traits>* sb);
70
  ```
71
 
72
- *Effects:* Constructs an object of class `basic_ios`, assigning initial
73
- values to its member objects by calling `init(sb)`.
74
 
75
  ``` cpp
76
  basic_ios();
77
  ```
78
 
79
- *Effects:* Constructs an object of class
80
- `basic_ios` ([[ios.base.cons]]) leaving its member objects
81
- uninitialized. The object shall be initialized by calling
82
- `basic_ios::init` before its first use or before it is destroyed,
83
- whichever comes first; otherwise the behavior is undefined.
84
 
85
  ``` cpp
86
  ~basic_ios();
87
  ```
88
 
@@ -90,14 +89,14 @@ whichever comes first; otherwise the behavior is undefined.
90
 
91
  ``` cpp
92
  void init(basic_streambuf<charT, traits>* sb);
93
  ```
94
 
95
- *Postconditions:* The postconditions of this function are indicated in
96
- Table  [[tab:iostreams.basicios.init.effects]].
97
 
98
- **Table: `basic_ios::init()` effects** <a id="tab:iostreams.basicios.init.effects">[tab:iostreams.basicios.init.effects]</a>
99
 
100
  | Element | Value |
101
  | -------------- | ------------------------------------------------------------ |
102
  | `rdbuf()` | `sb` |
103
  | `tie()` | `0` |
@@ -123,15 +122,15 @@ sequence controlled by the stream buffer.
123
 
124
  ``` cpp
125
  basic_ostream<charT, traits>* tie(basic_ostream<charT, traits>* tiestr);
126
  ```
127
 
128
- *Requires:* If `tiestr` is not null, `tiestr` must not be reachable by
129
  traversing the linked list of tied stream objects starting from
130
  `tiestr->tie()`.
131
 
132
- *Postconditions:* `tiestr == tie()`.
133
 
134
  *Returns:* The previous value of `tie()`.
135
 
136
  ``` cpp
137
  basic_streambuf<charT, traits>* rdbuf() const;
@@ -141,22 +140,22 @@ basic_streambuf<charT, traits>* rdbuf() const;
141
 
142
  ``` cpp
143
  basic_streambuf<charT, traits>* rdbuf(basic_streambuf<charT, traits>* sb);
144
  ```
145
 
146
- *Postconditions:* `sb == rdbuf()`.
147
-
148
  *Effects:* Calls `clear()`.
149
 
 
 
150
  *Returns:* The previous value of `rdbuf()`.
151
 
152
  ``` cpp
153
  locale imbue(const locale& loc);
154
  ```
155
 
156
- *Effects:* Calls `ios_base::imbue(loc)` ([[ios.base.locales]]) and if
157
- `rdbuf() != 0` then `rdbuf()->pubimbue(loc)` ([[streambuf.locales]]).
158
 
159
  *Returns:* The prior value of `ios_base::imbue()`.
160
 
161
  ``` cpp
162
  char narrow(char_type c, char dfault) const;
@@ -179,45 +178,45 @@ specified field width.
179
 
180
  ``` cpp
181
  char_type fill(char_type fillch);
182
  ```
183
 
184
- *Postconditions:* `traits::eq(fillch, fill())`.
185
 
186
  *Returns:* The previous value of `fill()`.
187
 
188
  ``` cpp
189
  basic_ios& copyfmt(const basic_ios& rhs);
190
  ```
191
 
192
- *Effects:* If `(this == &rhs)` does nothing. Otherwise assigns to the
193
- member objects of `*this` the corresponding member objects of `rhs` as
194
- follows:
195
 
196
- 1. calls each registered callback pair `(fn, index)` as
197
- `(*fn)(erase_event, *this, index)`;
198
- 2. assigns to the member objects of `*this` the corresponding member
199
- objects of `rhs`, except that
200
  - `rdstate()`, `rdbuf()`, and `exceptions()` are left unchanged;
201
- - the contents of arrays pointed at by `pword` and `iword` are
202
- copied, not the pointers themselves;[^10] and
203
  - if any newly stored pointer values in `*this` point at objects
204
- stored outside the object `rhs` and those objects are destroyed
205
- when `rhs` is destroyed, the newly stored pointer values are
206
- altered to point at newly constructed copies of the objects;
207
- 3. calls each callback pair that was copied from `rhs` as
208
- `(*fn)(copyfmt_event, *this, index)`;
209
- 4. calls `exceptions(rhs.exceptions())`.
210
 
211
  [*Note 1*: The second pass through the callback pairs permits a copied
212
  `pword` value to be zeroed, or to have its referent deep copied or
213
  reference counted, or to have other special action taken. — *end note*]
214
 
215
- *Postconditions:* The postconditions of this function are indicated in
216
- Table  [[tab:iostreams.copyfmt.effects]].
217
 
218
- **Table: `basic_ios::copyfmt()` effects** <a id="tab:iostreams.copyfmt.effects">[tab:iostreams.copyfmt.effects]</a>
219
 
220
  | Element | Value |
221
  | -------------- | ------------------ |
222
  | `rdbuf()` | unchanged |
223
  | `tie()` | `rhs.tie()` |
@@ -235,39 +234,38 @@ Table  [[tab:iostreams.copyfmt.effects]].
235
  ``` cpp
236
  void move(basic_ios& rhs);
237
  void move(basic_ios&& rhs);
238
  ```
239
 
240
- *Postconditions:* `*this` shall have the state that `rhs` had before the
241
- function call, except that `rdbuf()` shall return 0. `rhs` shall be in a
242
- valid but unspecified state, except that `rhs.rdbuf()` shall return the
243
- same value as it returned before the function call, and `rhs.tie()`
244
- shall return 0.
245
 
246
  ``` cpp
247
  void swap(basic_ios& rhs) noexcept;
248
  ```
249
 
250
- *Effects:* The states of `*this` and `rhs` shall be exchanged, except
251
- that `rdbuf()` shall return the same value as it returned before the
252
- function call, and `rhs.rdbuf()` shall return the same value as it
253
- returned before the function call.
254
 
255
  ``` cpp
256
  void set_rdbuf(basic_streambuf<charT, traits>* sb);
257
  ```
258
 
259
- *Requires:* `sb != nullptr`.
260
 
261
  *Effects:* Associates the `basic_streambuf` object pointed to by `sb`
262
  with this stream without calling `clear()`.
263
 
264
- *Postconditions:* `rdbuf() == sb`.
265
 
266
  *Throws:* Nothing.
267
 
268
- #### `basic_ios` flags functions <a id="iostate.flags">[[iostate.flags]]</a>
269
 
270
  ``` cpp
271
  explicit operator bool() const;
272
  ```
273
 
@@ -287,25 +285,25 @@ iostate rdstate() const;
287
 
288
  ``` cpp
289
  void clear(iostate state = goodbit);
290
  ```
291
 
292
- *Postconditions:* If `rdbuf() != 0` then `state == rdstate()`; otherwise
293
  `rdstate() == (state | ios_base::badbit)`.
294
 
295
  *Effects:* If
296
  `((state | (rdbuf() ? goodbit : badbit)) & exceptions()) == 0`, returns.
297
- Otherwise, the function throws an object of class
298
- `basic_ios::failure` ([[ios::failure]]), constructed with
299
- *implementation-defined* argument values.
300
 
301
  ``` cpp
302
  void setstate(iostate state);
303
  ```
304
 
305
  *Effects:* Calls `clear(rdstate() | state)` (which may throw
306
- `basic_ios::failure` ([[ios::failure]])).
307
 
308
  ``` cpp
309
  bool good() const;
310
  ```
311
 
@@ -338,9 +336,9 @@ exceptions to be thrown.
338
 
339
  ``` cpp
340
  void exceptions(iostate except);
341
  ```
342
 
343
- *Postconditions:* `except == exceptions()`.
344
 
345
  *Effects:* Calls `clear(rdstate())`.
346
 
 
61
 
62
  };
63
  }
64
  ```
65
 
66
+ #### Constructors <a id="basic.ios.cons">[[basic.ios.cons]]</a>
67
 
68
  ``` cpp
69
  explicit basic_ios(basic_streambuf<charT, traits>* sb);
70
  ```
71
 
72
+ *Effects:* Assigns initial values to its member objects by calling
73
+ `init(sb)`.
74
 
75
  ``` cpp
76
  basic_ios();
77
  ```
78
 
79
+ *Effects:* Leaves its member objects uninitialized. The object shall be
80
+ initialized by calling `basic_ios::init` before its first use or before
81
+ it is destroyed, whichever comes first; otherwise the behavior is
82
+ undefined.
 
83
 
84
  ``` cpp
85
  ~basic_ios();
86
  ```
87
 
 
89
 
90
  ``` cpp
91
  void init(basic_streambuf<charT, traits>* sb);
92
  ```
93
 
94
+ *Ensures:* The postconditions of this function are indicated in
95
+ [[basic.ios.cons]].
96
 
97
+ **Table: `basic_ios::init()` effects** <a id="basic.ios.cons">[basic.ios.cons]</a>
98
 
99
  | Element | Value |
100
  | -------------- | ------------------------------------------------------------ |
101
  | `rdbuf()` | `sb` |
102
  | `tie()` | `0` |
 
122
 
123
  ``` cpp
124
  basic_ostream<charT, traits>* tie(basic_ostream<charT, traits>* tiestr);
125
  ```
126
 
127
+ *Preconditions:* If `tiestr` is not null, `tiestr` is not reachable by
128
  traversing the linked list of tied stream objects starting from
129
  `tiestr->tie()`.
130
 
131
+ *Ensures:* `tiestr == tie()`.
132
 
133
  *Returns:* The previous value of `tie()`.
134
 
135
  ``` cpp
136
  basic_streambuf<charT, traits>* rdbuf() const;
 
140
 
141
  ``` cpp
142
  basic_streambuf<charT, traits>* rdbuf(basic_streambuf<charT, traits>* sb);
143
  ```
144
 
 
 
145
  *Effects:* Calls `clear()`.
146
 
147
+ *Ensures:* `sb == rdbuf()`.
148
+
149
  *Returns:* The previous value of `rdbuf()`.
150
 
151
  ``` cpp
152
  locale imbue(const locale& loc);
153
  ```
154
 
155
+ *Effects:* Calls `ios_base::imbue(loc)` [[ios.base.locales]] and if
156
+ `rdbuf() != 0` then `rdbuf()->pubimbue(loc)` [[streambuf.locales]].
157
 
158
  *Returns:* The prior value of `ios_base::imbue()`.
159
 
160
  ``` cpp
161
  char narrow(char_type c, char dfault) const;
 
178
 
179
  ``` cpp
180
  char_type fill(char_type fillch);
181
  ```
182
 
183
+ *Ensures:* `traits::eq(fillch, fill())`.
184
 
185
  *Returns:* The previous value of `fill()`.
186
 
187
  ``` cpp
188
  basic_ios& copyfmt(const basic_ios& rhs);
189
  ```
190
 
191
+ *Effects:* If `(this == addressof(rhs))` is `true` does nothing.
192
+ Otherwise assigns to the member objects of `*this` the corresponding
193
+ member objects of `rhs` as follows:
194
 
195
+ - calls each registered callback pair `(fn, idx)` as
196
+ `(*fn)(erase_event, *this, idx)`;
197
+ - then, assigns to the member objects of `*this` the corresponding
198
+ member objects of `rhs`, except that
199
  - `rdstate()`, `rdbuf()`, and `exceptions()` are left unchanged;
200
+ - the contents of arrays pointed at by `pword` and `iword` are copied,
201
+ not the pointers themselves;[^10] and
202
  - if any newly stored pointer values in `*this` point at objects
203
+ stored outside the object `rhs` and those objects are destroyed when
204
+ `rhs` is destroyed, the newly stored pointer values are altered to
205
+ point at newly constructed copies of the objects;
206
+ - then, calls each callback pair that was copied from `rhs` as
207
+ `(*fn)(copyfmt_event, *this, idx)`;
208
+ - then, calls `exceptions(rhs.exceptions())`.
209
 
210
  [*Note 1*: The second pass through the callback pairs permits a copied
211
  `pword` value to be zeroed, or to have its referent deep copied or
212
  reference counted, or to have other special action taken. — *end note*]
213
 
214
+ *Ensures:* The postconditions of this function are indicated in
215
+ [[basic.ios.copyfmt]].
216
 
217
+ **Table: `basic_ios::copyfmt()` effects** <a id="basic.ios.copyfmt">[basic.ios.copyfmt]</a>
218
 
219
  | Element | Value |
220
  | -------------- | ------------------ |
221
  | `rdbuf()` | unchanged |
222
  | `tie()` | `rhs.tie()` |
 
234
  ``` cpp
235
  void move(basic_ios& rhs);
236
  void move(basic_ios&& rhs);
237
  ```
238
 
239
+ *Ensures:* `*this` has the state that `rhs` had before the function
240
+ call, except that `rdbuf()` returns `nullptr`. `rhs` is in a valid but
241
+ unspecified state, except that `rhs.rdbuf()` returns the same value as
242
+ it returned before the function call, and `rhs.tie()` returns `nullptr`.
 
243
 
244
  ``` cpp
245
  void swap(basic_ios& rhs) noexcept;
246
  ```
247
 
248
+ *Effects:* The states of `*this` and `rhs` are exchanged, except that
249
+ `rdbuf()` returns the same value as it returned before the function
250
+ call, and `rhs.rdbuf()` returns the same value as it returned before the
251
+ function call.
252
 
253
  ``` cpp
254
  void set_rdbuf(basic_streambuf<charT, traits>* sb);
255
  ```
256
 
257
+ *Preconditions:* `sb != nullptr` is `true`.
258
 
259
  *Effects:* Associates the `basic_streambuf` object pointed to by `sb`
260
  with this stream without calling `clear()`.
261
 
262
+ *Ensures:* `rdbuf() == sb` is `true`.
263
 
264
  *Throws:* Nothing.
265
 
266
+ #### Flags functions <a id="iostate.flags">[[iostate.flags]]</a>
267
 
268
  ``` cpp
269
  explicit operator bool() const;
270
  ```
271
 
 
285
 
286
  ``` cpp
287
  void clear(iostate state = goodbit);
288
  ```
289
 
290
+ *Ensures:* If `rdbuf() != 0` then `state == rdstate()`; otherwise
291
  `rdstate() == (state | ios_base::badbit)`.
292
 
293
  *Effects:* If
294
  `((state | (rdbuf() ? goodbit : badbit)) & exceptions()) == 0`, returns.
295
+ Otherwise, the function throws an object of class `ios_base::failure`
296
+ [[ios.failure]], constructed with *implementation-defined* argument
297
+ values.
298
 
299
  ``` cpp
300
  void setstate(iostate state);
301
  ```
302
 
303
  *Effects:* Calls `clear(rdstate() | state)` (which may throw
304
+ `ios_base::failure` [[ios.failure]]).
305
 
306
  ``` cpp
307
  bool good() const;
308
  ```
309
 
 
336
 
337
  ``` cpp
338
  void exceptions(iostate except);
339
  ```
340
 
341
+ *Ensures:* `except == exceptions()`.
342
 
343
  *Effects:* Calls `clear(rdstate())`.
344