tmp/tmpfd6k145q/{from.md → to.md}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
#### Types <a id="ios.types">[[ios.types]]</a>
|
| 2 |
|
| 3 |
-
##### Class `ios_base::failure` <a id="ios
|
| 4 |
|
| 5 |
``` cpp
|
| 6 |
namespace std {
|
| 7 |
class ios_base::failure : public system_error {
|
| 8 |
public:
|
|
@@ -14,13 +14,13 @@ namespace std {
|
|
| 14 |
|
| 15 |
An implementation is permitted to define `ios_base::failure` as a
|
| 16 |
synonym for a class with equivalent functionality to class
|
| 17 |
`ios_base::failure` shown in this subclause.
|
| 18 |
|
| 19 |
-
[*Note 1*: When `ios_base::failure` is a synonym for another type
|
| 20 |
-
|
| 21 |
-
name. — *end note*]
|
| 22 |
|
| 23 |
The class `failure` defines the base class for the types of all objects
|
| 24 |
thrown as exceptions, by functions in the iostreams library, to report
|
| 25 |
errors detected during stream buffer operations.
|
| 26 |
|
|
@@ -37,31 +37,28 @@ iostream_category())`. — *end note*]
|
|
| 37 |
|
| 38 |
``` cpp
|
| 39 |
explicit failure(const string& msg, const error_code& ec = io_errc::stream);
|
| 40 |
```
|
| 41 |
|
| 42 |
-
*Effects:* Constructs
|
| 43 |
-
base class with `msg` and `ec`.
|
| 44 |
|
| 45 |
``` cpp
|
| 46 |
explicit failure(const char* msg, const error_code& ec = io_errc::stream);
|
| 47 |
```
|
| 48 |
|
| 49 |
-
*Effects:* Constructs
|
| 50 |
-
base class with `msg` and `ec`.
|
| 51 |
|
| 52 |
-
##### Type `ios_base::fmtflags` <a id="ios
|
| 53 |
|
| 54 |
``` cpp
|
| 55 |
using fmtflags = T1;
|
| 56 |
```
|
| 57 |
|
| 58 |
-
The type `fmtflags` is a bitmask type
|
| 59 |
-
elements has the effects indicated in
|
| 60 |
-
Table [[tab:iostreams.fmtflags.effects]].
|
| 61 |
|
| 62 |
-
**Table: `fmtflags` effects** <a id="
|
| 63 |
|
| 64 |
| Element | Effect(s) if set |
|
| 65 |
| ------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
|
| 66 |
| `boolalpha` | insert and extract `bool` type in alphabetic format |
|
| 67 |
| `dec` | converts integer input or generates integer output in decimal base |
|
|
@@ -79,31 +76,31 @@ Table [[tab:iostreams.fmtflags.effects]].
|
|
| 79 |
| `unitbuf` | flushes output after each output operation |
|
| 80 |
| `uppercase` | replaces certain lowercase letters with their uppercase equivalents in generated output |
|
| 81 |
|
| 82 |
|
| 83 |
Type `fmtflags` also defines the constants indicated in
|
| 84 |
-
|
| 85 |
|
| 86 |
-
**Table: `fmtflags` constants** <a id="
|
| 87 |
|
| 88 |
| Constant | Allowable values |
|
| 89 |
| ------------- | ------------------------- |
|
| 90 |
| `adjustfield` | `left | right | internal` |
|
| 91 |
| `basefield` | `dec | oct | hex` |
|
| 92 |
| `floatfield` | `scientific | fixed` |
|
| 93 |
|
| 94 |
|
| 95 |
-
##### Type `ios_base::iostate` <a id="ios
|
| 96 |
|
| 97 |
``` cpp
|
| 98 |
using iostate = T2;
|
| 99 |
```
|
| 100 |
|
| 101 |
-
The type `iostate` is a bitmask type
|
| 102 |
-
|
| 103 |
|
| 104 |
-
**Table: `iostate` effects** <a id="
|
| 105 |
|
| 106 |
| Element | Effect(s) if set |
|
| 107 |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
| 108 |
| `badbit` | indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error from a file); |
|
| 109 |
| `eofbit` | indicates that an input operation reached the end of an input sequence; |
|
|
@@ -112,20 +109,20 @@ the elements indicated in Table [[tab:iostreams.iostate.effects]].
|
|
| 112 |
|
| 113 |
Type `iostate` also defines the constant:
|
| 114 |
|
| 115 |
- `goodbit`, the value zero.
|
| 116 |
|
| 117 |
-
##### Type `ios_base::openmode` <a id="ios
|
| 118 |
|
| 119 |
``` cpp
|
| 120 |
using openmode = T3;
|
| 121 |
```
|
| 122 |
|
| 123 |
-
The type `openmode` is a bitmask type
|
| 124 |
-
|
| 125 |
|
| 126 |
-
**Table: `openmode` effects** <a id="
|
| 127 |
|
| 128 |
| Element | Effect(s) if set |
|
| 129 |
| -------- | ----------------------------------------------------------------- |
|
| 130 |
| `app` | seek to end before each write |
|
| 131 |
| `ate` | open and seek to end immediately after opening |
|
|
@@ -133,67 +130,65 @@ the elements indicated in Table [[tab:iostreams.openmode.effects]].
|
|
| 133 |
| `in` | open for input |
|
| 134 |
| `out` | open for output |
|
| 135 |
| `trunc` | truncate an existing stream when opening |
|
| 136 |
|
| 137 |
|
| 138 |
-
##### Type `ios_base::seekdir` <a id="ios
|
| 139 |
|
| 140 |
``` cpp
|
| 141 |
using seekdir = T4;
|
| 142 |
```
|
| 143 |
|
| 144 |
-
The type `seekdir` is an enumerated type
|
| 145 |
-
contains the elements indicated in
|
| 146 |
-
Table [[tab:iostreams.seekdir.effects]].
|
| 147 |
|
| 148 |
-
**Table: `seekdir` effects** <a id="
|
| 149 |
|
| 150 |
| Element | Meaning |
|
| 151 |
| ------- | --------------------------------------------------------------------------------------- |
|
| 152 |
| `beg` | request a seek (for subsequent input or output) relative to the beginning of the stream |
|
| 153 |
| `cur` | request a seek relative to the current position within the sequence |
|
| 154 |
| `end` | request a seek relative to the current end of the sequence |
|
| 155 |
|
| 156 |
|
| 157 |
-
##### Class `ios_base::Init` <a id="ios
|
| 158 |
|
| 159 |
``` cpp
|
| 160 |
namespace std {
|
| 161 |
class ios_base::Init {
|
| 162 |
public:
|
| 163 |
Init();
|
|
|
|
| 164 |
~Init();
|
|
|
|
| 165 |
private:
|
| 166 |
static int init_cnt; // exposition only
|
| 167 |
};
|
| 168 |
}
|
| 169 |
```
|
| 170 |
|
| 171 |
The class `Init` describes an object whose construction ensures the
|
| 172 |
-
construction of the eight objects declared in `<iostream>`
|
| 173 |
-
[[iostream.objects]]
|
| 174 |
-
standard C streams provided for by the functions declared in
|
| 175 |
-
`<cstdio>` ([[cstdio.syn]]).
|
| 176 |
|
| 177 |
For the sake of exposition, the maintained data is presented here as:
|
| 178 |
|
| 179 |
- `static int init_cnt`, counts the number of constructor and destructor
|
| 180 |
calls for class `Init`, initialized to zero.
|
| 181 |
|
| 182 |
``` cpp
|
| 183 |
Init();
|
| 184 |
```
|
| 185 |
|
| 186 |
-
*Effects:* Constructs
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
initialized.
|
| 190 |
|
| 191 |
``` cpp
|
| 192 |
~Init();
|
| 193 |
```
|
| 194 |
|
| 195 |
-
*Effects:*
|
| 196 |
-
|
| 197 |
-
`
|
| 198 |
-
`wclog.flush()`.
|
| 199 |
|
|
|
|
| 1 |
#### Types <a id="ios.types">[[ios.types]]</a>
|
| 2 |
|
| 3 |
+
##### Class `ios_base::failure` <a id="ios.failure">[[ios.failure]]</a>
|
| 4 |
|
| 5 |
``` cpp
|
| 6 |
namespace std {
|
| 7 |
class ios_base::failure : public system_error {
|
| 8 |
public:
|
|
|
|
| 14 |
|
| 15 |
An implementation is permitted to define `ios_base::failure` as a
|
| 16 |
synonym for a class with equivalent functionality to class
|
| 17 |
`ios_base::failure` shown in this subclause.
|
| 18 |
|
| 19 |
+
[*Note 1*: When `ios_base::failure` is a synonym for another type, that
|
| 20 |
+
type is required to provide a nested type `failure` to emulate the
|
| 21 |
+
injected-class-name. — *end note*]
|
| 22 |
|
| 23 |
The class `failure` defines the base class for the types of all objects
|
| 24 |
thrown as exceptions, by functions in the iostreams library, to report
|
| 25 |
errors detected during stream buffer operations.
|
| 26 |
|
|
|
|
| 37 |
|
| 38 |
``` cpp
|
| 39 |
explicit failure(const string& msg, const error_code& ec = io_errc::stream);
|
| 40 |
```
|
| 41 |
|
| 42 |
+
*Effects:* Constructs the base class with `msg` and `ec`.
|
|
|
|
| 43 |
|
| 44 |
``` cpp
|
| 45 |
explicit failure(const char* msg, const error_code& ec = io_errc::stream);
|
| 46 |
```
|
| 47 |
|
| 48 |
+
*Effects:* Constructs the base class with `msg` and `ec`.
|
|
|
|
| 49 |
|
| 50 |
+
##### Type `ios_base::fmtflags` <a id="ios.fmtflags">[[ios.fmtflags]]</a>
|
| 51 |
|
| 52 |
``` cpp
|
| 53 |
using fmtflags = T1;
|
| 54 |
```
|
| 55 |
|
| 56 |
+
The type `fmtflags` is a bitmask type [[bitmask.types]]. Setting its
|
| 57 |
+
elements has the effects indicated in [[ios.fmtflags]].
|
|
|
|
| 58 |
|
| 59 |
+
**Table: `fmtflags` effects** <a id="ios.fmtflags">[ios.fmtflags]</a>
|
| 60 |
|
| 61 |
| Element | Effect(s) if set |
|
| 62 |
| ------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
|
| 63 |
| `boolalpha` | insert and extract `bool` type in alphabetic format |
|
| 64 |
| `dec` | converts integer input or generates integer output in decimal base |
|
|
|
|
| 76 |
| `unitbuf` | flushes output after each output operation |
|
| 77 |
| `uppercase` | replaces certain lowercase letters with their uppercase equivalents in generated output |
|
| 78 |
|
| 79 |
|
| 80 |
Type `fmtflags` also defines the constants indicated in
|
| 81 |
+
[[ios.fmtflags.const]].
|
| 82 |
|
| 83 |
+
**Table: `fmtflags` constants** <a id="ios.fmtflags.const">[ios.fmtflags.const]</a>
|
| 84 |
|
| 85 |
| Constant | Allowable values |
|
| 86 |
| ------------- | ------------------------- |
|
| 87 |
| `adjustfield` | `left | right | internal` |
|
| 88 |
| `basefield` | `dec | oct | hex` |
|
| 89 |
| `floatfield` | `scientific | fixed` |
|
| 90 |
|
| 91 |
|
| 92 |
+
##### Type `ios_base::iostate` <a id="ios.iostate">[[ios.iostate]]</a>
|
| 93 |
|
| 94 |
``` cpp
|
| 95 |
using iostate = T2;
|
| 96 |
```
|
| 97 |
|
| 98 |
+
The type `iostate` is a bitmask type [[bitmask.types]] that contains the
|
| 99 |
+
elements indicated in [[ios.iostate]].
|
| 100 |
|
| 101 |
+
**Table: `iostate` effects** <a id="ios.iostate">[ios.iostate]</a>
|
| 102 |
|
| 103 |
| Element | Effect(s) if set |
|
| 104 |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
| 105 |
| `badbit` | indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error from a file); |
|
| 106 |
| `eofbit` | indicates that an input operation reached the end of an input sequence; |
|
|
|
|
| 109 |
|
| 110 |
Type `iostate` also defines the constant:
|
| 111 |
|
| 112 |
- `goodbit`, the value zero.
|
| 113 |
|
| 114 |
+
##### Type `ios_base::openmode` <a id="ios.openmode">[[ios.openmode]]</a>
|
| 115 |
|
| 116 |
``` cpp
|
| 117 |
using openmode = T3;
|
| 118 |
```
|
| 119 |
|
| 120 |
+
The type `openmode` is a bitmask type [[bitmask.types]]. It contains the
|
| 121 |
+
elements indicated in [[ios.openmode]].
|
| 122 |
|
| 123 |
+
**Table: `openmode` effects** <a id="ios.openmode">[ios.openmode]</a>
|
| 124 |
|
| 125 |
| Element | Effect(s) if set |
|
| 126 |
| -------- | ----------------------------------------------------------------- |
|
| 127 |
| `app` | seek to end before each write |
|
| 128 |
| `ate` | open and seek to end immediately after opening |
|
|
|
|
| 130 |
| `in` | open for input |
|
| 131 |
| `out` | open for output |
|
| 132 |
| `trunc` | truncate an existing stream when opening |
|
| 133 |
|
| 134 |
|
| 135 |
+
##### Type `ios_base::seekdir` <a id="ios.seekdir">[[ios.seekdir]]</a>
|
| 136 |
|
| 137 |
``` cpp
|
| 138 |
using seekdir = T4;
|
| 139 |
```
|
| 140 |
|
| 141 |
+
The type `seekdir` is an enumerated type [[enumerated.types]] that
|
| 142 |
+
contains the elements indicated in [[ios.seekdir]].
|
|
|
|
| 143 |
|
| 144 |
+
**Table: `seekdir` effects** <a id="ios.seekdir">[ios.seekdir]</a>
|
| 145 |
|
| 146 |
| Element | Meaning |
|
| 147 |
| ------- | --------------------------------------------------------------------------------------- |
|
| 148 |
| `beg` | request a seek (for subsequent input or output) relative to the beginning of the stream |
|
| 149 |
| `cur` | request a seek relative to the current position within the sequence |
|
| 150 |
| `end` | request a seek relative to the current end of the sequence |
|
| 151 |
|
| 152 |
|
| 153 |
+
##### Class `ios_base::Init` <a id="ios.init">[[ios.init]]</a>
|
| 154 |
|
| 155 |
``` cpp
|
| 156 |
namespace std {
|
| 157 |
class ios_base::Init {
|
| 158 |
public:
|
| 159 |
Init();
|
| 160 |
+
Init(const Init&) = default;
|
| 161 |
~Init();
|
| 162 |
+
Init& operator=(const Init&) = default;
|
| 163 |
private:
|
| 164 |
static int init_cnt; // exposition only
|
| 165 |
};
|
| 166 |
}
|
| 167 |
```
|
| 168 |
|
| 169 |
The class `Init` describes an object whose construction ensures the
|
| 170 |
+
construction of the eight objects declared in `<iostream>`
|
| 171 |
+
[[iostream.objects]] that associate file stream buffers with the
|
| 172 |
+
standard C streams provided for by the functions declared in `<cstdio>`.
|
|
|
|
| 173 |
|
| 174 |
For the sake of exposition, the maintained data is presented here as:
|
| 175 |
|
| 176 |
- `static int init_cnt`, counts the number of constructor and destructor
|
| 177 |
calls for class `Init`, initialized to zero.
|
| 178 |
|
| 179 |
``` cpp
|
| 180 |
Init();
|
| 181 |
```
|
| 182 |
|
| 183 |
+
*Effects:* Constructs and initializes the objects `cin`, `cout`, `cerr`,
|
| 184 |
+
`clog`, `wcin`, `wcout`, `wcerr`, and `wclog` if they have not already
|
| 185 |
+
been constructed and initialized.
|
|
|
|
| 186 |
|
| 187 |
``` cpp
|
| 188 |
~Init();
|
| 189 |
```
|
| 190 |
|
| 191 |
+
*Effects:* If there are no other instances of the class still in
|
| 192 |
+
existence, calls `cout.flush()`, `cerr.flush()`, `clog.flush()`,
|
| 193 |
+
`wcout.flush()`, `wcerr.flush()`, `wclog.flush()`.
|
|
|
|
| 194 |
|