tmp/tmpp84ccuet/{from.md → to.md}
RENAMED
|
@@ -6,14 +6,15 @@
|
|
| 6 |
namespace std {
|
| 7 |
template<class charT, class traits = char_traits<charT>>
|
| 8 |
class basic_fstream : public basic_iostream<charT, traits> {
|
| 9 |
public:
|
| 10 |
using char_type = charT;
|
| 11 |
-
using int_type =
|
| 12 |
-
using pos_type =
|
| 13 |
-
using off_type =
|
| 14 |
using traits_type = traits;
|
|
|
|
| 15 |
|
| 16 |
// [fstream.cons], constructors
|
| 17 |
basic_fstream();
|
| 18 |
explicit basic_fstream(
|
| 19 |
const char* s,
|
|
@@ -35,10 +36,12 @@ namespace std {
|
|
| 35 |
// [fstream.swap], swap
|
| 36 |
void swap(basic_fstream& rhs);
|
| 37 |
|
| 38 |
// [fstream.members], members
|
| 39 |
basic_filebuf<charT, traits>* rdbuf() const;
|
|
|
|
|
|
|
| 40 |
bool is_open() const;
|
| 41 |
void open(
|
| 42 |
const char* s,
|
| 43 |
ios_base::openmode mode = ios_base::in | ios_base::out);
|
| 44 |
void open(
|
|
@@ -61,21 +64,21 @@ namespace std {
|
|
| 61 |
The class template `basic_fstream<charT, traits>` supports reading and
|
| 62 |
writing from named files. It uses a `basic_filebuf<charT, traits>`
|
| 63 |
object to control the associated sequences. For the sake of exposition,
|
| 64 |
the maintained data is presented here as:
|
| 65 |
|
| 66 |
-
- `sb`, the `basic_filebuf` object.
|
| 67 |
|
| 68 |
#### Constructors <a id="fstream.cons">[[fstream.cons]]</a>
|
| 69 |
|
| 70 |
``` cpp
|
| 71 |
basic_fstream();
|
| 72 |
```
|
| 73 |
|
| 74 |
*Effects:* Initializes the base class with
|
| 75 |
-
`basic_iostream<charT, traits>(addressof(sb))` [[iostream.cons]]
|
| 76 |
-
|
| 77 |
|
| 78 |
``` cpp
|
| 79 |
explicit basic_fstream(
|
| 80 |
const char* s,
|
| 81 |
ios_base::openmode mode = ios_base::in | ios_base::out);
|
|
@@ -83,65 +86,73 @@ explicit basic_fstream(
|
|
| 83 |
const filesystem::path::value_type* s,
|
| 84 |
ios_base::openmode mode = ios_base::in | ios_base::out); // wide systems only; see [fstream.syn]
|
| 85 |
```
|
| 86 |
|
| 87 |
*Effects:* Initializes the base class with
|
| 88 |
-
`basic_iostream<charT, traits>(addressof(sb))` [[iostream.cons]]
|
| 89 |
-
|
| 90 |
`rdbuf()->open(s, mode)`. If that function returns a null pointer, calls
|
| 91 |
`setstate(failbit)`.
|
| 92 |
|
| 93 |
``` cpp
|
| 94 |
explicit basic_fstream(
|
| 95 |
const string& s,
|
| 96 |
ios_base::openmode mode = ios_base::in | ios_base::out);
|
| 97 |
```
|
| 98 |
|
| 99 |
-
*Effects:* Equivalent to
|
| 100 |
|
| 101 |
``` cpp
|
| 102 |
template<class T>
|
| 103 |
explicit basic_fstream(const T& s, ios_base::openmode mode = ios_base::in | ios_base::out);
|
| 104 |
```
|
| 105 |
|
| 106 |
*Constraints:* `is_same_v<T, filesystem::path>` is `true`.
|
| 107 |
|
| 108 |
-
*Effects:* Equivalent to
|
| 109 |
|
| 110 |
``` cpp
|
| 111 |
basic_fstream(basic_fstream&& rhs);
|
| 112 |
```
|
| 113 |
|
| 114 |
*Effects:* Move constructs the base class, and the contained
|
| 115 |
`basic_filebuf`. Then calls
|
| 116 |
-
`basic_istream<charT, traits>::set_rdbuf(addressof(sb))` to
|
| 117 |
-
contained `basic_filebuf`.
|
| 118 |
|
| 119 |
#### Swap <a id="fstream.swap">[[fstream.swap]]</a>
|
| 120 |
|
| 121 |
``` cpp
|
| 122 |
void swap(basic_fstream& rhs);
|
| 123 |
```
|
| 124 |
|
| 125 |
*Effects:* Exchanges the state of `*this` and `rhs` by calling
|
| 126 |
-
`basic_iostream<charT,traits>::swap(rhs)` and
|
|
|
|
| 127 |
|
| 128 |
``` cpp
|
| 129 |
template<class charT, class traits>
|
| 130 |
void swap(basic_fstream<charT, traits>& x,
|
| 131 |
basic_fstream<charT, traits>& y);
|
| 132 |
```
|
| 133 |
|
| 134 |
-
*Effects:* Equivalent to
|
| 135 |
|
| 136 |
#### Member functions <a id="fstream.members">[[fstream.members]]</a>
|
| 137 |
|
| 138 |
``` cpp
|
| 139 |
basic_filebuf<charT, traits>* rdbuf() const;
|
| 140 |
```
|
| 141 |
|
| 142 |
-
*Returns:*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
|
| 144 |
``` cpp
|
| 145 |
bool is_open() const;
|
| 146 |
```
|
| 147 |
|
|
|
|
| 6 |
namespace std {
|
| 7 |
template<class charT, class traits = char_traits<charT>>
|
| 8 |
class basic_fstream : public basic_iostream<charT, traits> {
|
| 9 |
public:
|
| 10 |
using char_type = charT;
|
| 11 |
+
using int_type = traits::int_type;
|
| 12 |
+
using pos_type = traits::pos_type;
|
| 13 |
+
using off_type = traits::off_type;
|
| 14 |
using traits_type = traits;
|
| 15 |
+
using native_handle_type = basic_filebuf<charT, traits>::native_handle_type;
|
| 16 |
|
| 17 |
// [fstream.cons], constructors
|
| 18 |
basic_fstream();
|
| 19 |
explicit basic_fstream(
|
| 20 |
const char* s,
|
|
|
|
| 36 |
// [fstream.swap], swap
|
| 37 |
void swap(basic_fstream& rhs);
|
| 38 |
|
| 39 |
// [fstream.members], members
|
| 40 |
basic_filebuf<charT, traits>* rdbuf() const;
|
| 41 |
+
native_handle_type native_handle() const noexcept;
|
| 42 |
+
|
| 43 |
bool is_open() const;
|
| 44 |
void open(
|
| 45 |
const char* s,
|
| 46 |
ios_base::openmode mode = ios_base::in | ios_base::out);
|
| 47 |
void open(
|
|
|
|
| 64 |
The class template `basic_fstream<charT, traits>` supports reading and
|
| 65 |
writing from named files. It uses a `basic_filebuf<charT, traits>`
|
| 66 |
object to control the associated sequences. For the sake of exposition,
|
| 67 |
the maintained data is presented here as:
|
| 68 |
|
| 69 |
+
- *`sb`*, the `basic_filebuf` object.
|
| 70 |
|
| 71 |
#### Constructors <a id="fstream.cons">[[fstream.cons]]</a>
|
| 72 |
|
| 73 |
``` cpp
|
| 74 |
basic_fstream();
|
| 75 |
```
|
| 76 |
|
| 77 |
*Effects:* Initializes the base class with
|
| 78 |
+
`basic_iostream<charT, traits>(addressof(`*`sb`*`))` [[iostream.cons]]
|
| 79 |
+
and *sb* with `basic_filebuf<charT, traits>()`.
|
| 80 |
|
| 81 |
``` cpp
|
| 82 |
explicit basic_fstream(
|
| 83 |
const char* s,
|
| 84 |
ios_base::openmode mode = ios_base::in | ios_base::out);
|
|
|
|
| 86 |
const filesystem::path::value_type* s,
|
| 87 |
ios_base::openmode mode = ios_base::in | ios_base::out); // wide systems only; see [fstream.syn]
|
| 88 |
```
|
| 89 |
|
| 90 |
*Effects:* Initializes the base class with
|
| 91 |
+
`basic_iostream<charT, traits>(addressof(`*`sb`*`))` [[iostream.cons]]
|
| 92 |
+
and *sb* with `basic_filebuf<charT, traits>()`. Then calls
|
| 93 |
`rdbuf()->open(s, mode)`. If that function returns a null pointer, calls
|
| 94 |
`setstate(failbit)`.
|
| 95 |
|
| 96 |
``` cpp
|
| 97 |
explicit basic_fstream(
|
| 98 |
const string& s,
|
| 99 |
ios_base::openmode mode = ios_base::in | ios_base::out);
|
| 100 |
```
|
| 101 |
|
| 102 |
+
*Effects:* Equivalent to `basic_fstream(s.c_str(), mode)`.
|
| 103 |
|
| 104 |
``` cpp
|
| 105 |
template<class T>
|
| 106 |
explicit basic_fstream(const T& s, ios_base::openmode mode = ios_base::in | ios_base::out);
|
| 107 |
```
|
| 108 |
|
| 109 |
*Constraints:* `is_same_v<T, filesystem::path>` is `true`.
|
| 110 |
|
| 111 |
+
*Effects:* Equivalent to `basic_fstream(s.c_str(), mode)`.
|
| 112 |
|
| 113 |
``` cpp
|
| 114 |
basic_fstream(basic_fstream&& rhs);
|
| 115 |
```
|
| 116 |
|
| 117 |
*Effects:* Move constructs the base class, and the contained
|
| 118 |
`basic_filebuf`. Then calls
|
| 119 |
+
`basic_istream<charT, traits>::set_rdbuf(addressof(`*`sb`*`))` to
|
| 120 |
+
install the contained `basic_filebuf`.
|
| 121 |
|
| 122 |
#### Swap <a id="fstream.swap">[[fstream.swap]]</a>
|
| 123 |
|
| 124 |
``` cpp
|
| 125 |
void swap(basic_fstream& rhs);
|
| 126 |
```
|
| 127 |
|
| 128 |
*Effects:* Exchanges the state of `*this` and `rhs` by calling
|
| 129 |
+
`basic_iostream<charT,traits>::swap(rhs)` and
|
| 130 |
+
*`sb`*`.swap(rhs.`*`sb`*`)`.
|
| 131 |
|
| 132 |
``` cpp
|
| 133 |
template<class charT, class traits>
|
| 134 |
void swap(basic_fstream<charT, traits>& x,
|
| 135 |
basic_fstream<charT, traits>& y);
|
| 136 |
```
|
| 137 |
|
| 138 |
+
*Effects:* Equivalent to `x.swap(y)`.
|
| 139 |
|
| 140 |
#### Member functions <a id="fstream.members">[[fstream.members]]</a>
|
| 141 |
|
| 142 |
``` cpp
|
| 143 |
basic_filebuf<charT, traits>* rdbuf() const;
|
| 144 |
```
|
| 145 |
|
| 146 |
+
*Returns:*
|
| 147 |
+
`const_cast<basic_filebuf<charT, traits>*>(addressof(`*`sb`*`))`.
|
| 148 |
+
|
| 149 |
+
``` cpp
|
| 150 |
+
native_handle_type native_handle() const noexcept;
|
| 151 |
+
```
|
| 152 |
+
|
| 153 |
+
*Effects:* Equivalent to: `return rdbuf()->native_handle();`
|
| 154 |
|
| 155 |
``` cpp
|
| 156 |
bool is_open() const;
|
| 157 |
```
|
| 158 |
|