tmp/tmpbum2ggr4/{from.md → to.md}
RENAMED
|
@@ -6,14 +6,15 @@
|
|
| 6 |
namespace std {
|
| 7 |
template<class charT, class traits = char_traits<charT>>
|
| 8 |
class basic_ofstream : public basic_ostream<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 |
// [ofstream.cons], constructors
|
| 17 |
basic_ofstream();
|
| 18 |
explicit basic_ofstream(const char* s,
|
| 19 |
ios_base::openmode mode = ios_base::out);
|
|
@@ -32,10 +33,11 @@ namespace std {
|
|
| 32 |
// [ofstream.swap], swap
|
| 33 |
void swap(basic_ofstream& rhs);
|
| 34 |
|
| 35 |
// [ofstream.members], members
|
| 36 |
basic_filebuf<charT, traits>* rdbuf() const;
|
|
|
|
| 37 |
|
| 38 |
bool is_open() const;
|
| 39 |
void open(const char* s, ios_base::openmode mode = ios_base::out);
|
| 40 |
void open(const filesystem::path::value_type* s,
|
| 41 |
ios_base::openmode mode = ios_base::out); // wide systems only; see [fstream.syn]
|
|
@@ -52,83 +54,91 @@ namespace std {
|
|
| 52 |
The class `basic_ofstream<charT, traits>` supports writing to named
|
| 53 |
files. It uses a `basic_filebuf<{}charT, traits>` object to control the
|
| 54 |
associated sequence. For the sake of exposition, the maintained data is
|
| 55 |
presented here as:
|
| 56 |
|
| 57 |
-
- `sb`, the `filebuf` object.
|
| 58 |
|
| 59 |
#### Constructors <a id="ofstream.cons">[[ofstream.cons]]</a>
|
| 60 |
|
| 61 |
``` cpp
|
| 62 |
basic_ofstream();
|
| 63 |
```
|
| 64 |
|
| 65 |
*Effects:* Initializes the base class with
|
| 66 |
-
`basic_ostream<charT, traits>(addressof(sb))` [[ostream.cons]] and
|
| 67 |
-
with `basic_filebuf<charT, traits>()` [[filebuf.cons]].
|
| 68 |
|
| 69 |
``` cpp
|
| 70 |
explicit basic_ofstream(const char* s,
|
| 71 |
ios_base::openmode mode = ios_base::out);
|
| 72 |
explicit basic_ofstream(const filesystem::path::value_type* s,
|
| 73 |
ios_base::openmode mode = ios_base::out); // wide systems only; see [fstream.syn]
|
| 74 |
```
|
| 75 |
|
| 76 |
*Effects:* Initializes the base class with
|
| 77 |
-
`basic_ostream<charT, traits>(addressof(sb))` [[ostream.cons]] and
|
| 78 |
-
with `basic_filebuf<charT, traits>()` [[filebuf.cons]], then calls
|
| 79 |
`rdbuf()->open(s, mode | ios_base::out)`. If that function returns a
|
| 80 |
null pointer, calls `setstate(failbit)`.
|
| 81 |
|
| 82 |
``` cpp
|
| 83 |
explicit basic_ofstream(const string& s,
|
| 84 |
ios_base::openmode mode = ios_base::out);
|
| 85 |
```
|
| 86 |
|
| 87 |
-
*Effects:* Equivalent to
|
| 88 |
|
| 89 |
``` cpp
|
| 90 |
template<class T>
|
| 91 |
explicit basic_ofstream(const T& s, ios_base::openmode mode = ios_base::out);
|
| 92 |
```
|
| 93 |
|
| 94 |
*Constraints:* `is_same_v<T, filesystem::path>` is `true`.
|
| 95 |
|
| 96 |
-
*Effects:* Equivalent to
|
| 97 |
|
| 98 |
``` cpp
|
| 99 |
basic_ofstream(basic_ofstream&& rhs);
|
| 100 |
```
|
| 101 |
|
| 102 |
*Effects:* Move constructs the base class, and the contained
|
| 103 |
`basic_filebuf`. Then calls
|
| 104 |
-
`basic_ostream<charT, traits>::set_rdbuf(addressof(sb))` to
|
| 105 |
-
contained `basic_filebuf`.
|
| 106 |
|
| 107 |
#### Swap <a id="ofstream.swap">[[ofstream.swap]]</a>
|
| 108 |
|
| 109 |
``` cpp
|
| 110 |
void swap(basic_ofstream& rhs);
|
| 111 |
```
|
| 112 |
|
| 113 |
*Effects:* Exchanges the state of `*this` and `rhs` by calling
|
| 114 |
-
`basic_ostream<charT, traits>::swap(rhs)` and
|
|
|
|
| 115 |
|
| 116 |
``` cpp
|
| 117 |
template<class charT, class traits>
|
| 118 |
void swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);
|
| 119 |
```
|
| 120 |
|
| 121 |
-
*Effects:* Equivalent to
|
| 122 |
|
| 123 |
#### Member functions <a id="ofstream.members">[[ofstream.members]]</a>
|
| 124 |
|
| 125 |
``` cpp
|
| 126 |
basic_filebuf<charT, traits>* rdbuf() const;
|
| 127 |
```
|
| 128 |
|
| 129 |
-
*Returns:*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
|
| 131 |
``` cpp
|
| 132 |
bool is_open() const;
|
| 133 |
```
|
| 134 |
|
|
|
|
| 6 |
namespace std {
|
| 7 |
template<class charT, class traits = char_traits<charT>>
|
| 8 |
class basic_ofstream : public basic_ostream<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 |
// [ofstream.cons], constructors
|
| 18 |
basic_ofstream();
|
| 19 |
explicit basic_ofstream(const char* s,
|
| 20 |
ios_base::openmode mode = ios_base::out);
|
|
|
|
| 33 |
// [ofstream.swap], swap
|
| 34 |
void swap(basic_ofstream& rhs);
|
| 35 |
|
| 36 |
// [ofstream.members], members
|
| 37 |
basic_filebuf<charT, traits>* rdbuf() const;
|
| 38 |
+
native_handle_type native_handle() const noexcept;
|
| 39 |
|
| 40 |
bool is_open() const;
|
| 41 |
void open(const char* s, ios_base::openmode mode = ios_base::out);
|
| 42 |
void open(const filesystem::path::value_type* s,
|
| 43 |
ios_base::openmode mode = ios_base::out); // wide systems only; see [fstream.syn]
|
|
|
|
| 54 |
The class `basic_ofstream<charT, traits>` supports writing to named
|
| 55 |
files. It uses a `basic_filebuf<{}charT, traits>` object to control the
|
| 56 |
associated sequence. For the sake of exposition, the maintained data is
|
| 57 |
presented here as:
|
| 58 |
|
| 59 |
+
- *`sb`*, the `filebuf` object.
|
| 60 |
|
| 61 |
#### Constructors <a id="ofstream.cons">[[ofstream.cons]]</a>
|
| 62 |
|
| 63 |
``` cpp
|
| 64 |
basic_ofstream();
|
| 65 |
```
|
| 66 |
|
| 67 |
*Effects:* Initializes the base class with
|
| 68 |
+
`basic_ostream<charT, traits>(addressof(`*`sb`*`))` [[ostream.cons]] and
|
| 69 |
+
*sb* with `basic_filebuf<charT, traits>()` [[filebuf.cons]].
|
| 70 |
|
| 71 |
``` cpp
|
| 72 |
explicit basic_ofstream(const char* s,
|
| 73 |
ios_base::openmode mode = ios_base::out);
|
| 74 |
explicit basic_ofstream(const filesystem::path::value_type* s,
|
| 75 |
ios_base::openmode mode = ios_base::out); // wide systems only; see [fstream.syn]
|
| 76 |
```
|
| 77 |
|
| 78 |
*Effects:* Initializes the base class with
|
| 79 |
+
`basic_ostream<charT, traits>(addressof(`*`sb`*`))` [[ostream.cons]] and
|
| 80 |
+
*sb* with `basic_filebuf<charT, traits>()` [[filebuf.cons]], then calls
|
| 81 |
`rdbuf()->open(s, mode | ios_base::out)`. If that function returns a
|
| 82 |
null pointer, calls `setstate(failbit)`.
|
| 83 |
|
| 84 |
``` cpp
|
| 85 |
explicit basic_ofstream(const string& s,
|
| 86 |
ios_base::openmode mode = ios_base::out);
|
| 87 |
```
|
| 88 |
|
| 89 |
+
*Effects:* Equivalent to `basic_ofstream(s.c_str(), mode)`.
|
| 90 |
|
| 91 |
``` cpp
|
| 92 |
template<class T>
|
| 93 |
explicit basic_ofstream(const T& s, ios_base::openmode mode = ios_base::out);
|
| 94 |
```
|
| 95 |
|
| 96 |
*Constraints:* `is_same_v<T, filesystem::path>` is `true`.
|
| 97 |
|
| 98 |
+
*Effects:* Equivalent to `basic_ofstream(s.c_str(), mode)`.
|
| 99 |
|
| 100 |
``` cpp
|
| 101 |
basic_ofstream(basic_ofstream&& rhs);
|
| 102 |
```
|
| 103 |
|
| 104 |
*Effects:* Move constructs the base class, and the contained
|
| 105 |
`basic_filebuf`. Then calls
|
| 106 |
+
`basic_ostream<charT, traits>::set_rdbuf(addressof(`*`sb`*`))` to
|
| 107 |
+
install the contained `basic_filebuf`.
|
| 108 |
|
| 109 |
#### Swap <a id="ofstream.swap">[[ofstream.swap]]</a>
|
| 110 |
|
| 111 |
``` cpp
|
| 112 |
void swap(basic_ofstream& rhs);
|
| 113 |
```
|
| 114 |
|
| 115 |
*Effects:* Exchanges the state of `*this` and `rhs` by calling
|
| 116 |
+
`basic_ostream<charT, traits>::swap(rhs)` and
|
| 117 |
+
*`sb`*`.swap(rhs.`*`sb`*`)`.
|
| 118 |
|
| 119 |
``` cpp
|
| 120 |
template<class charT, class traits>
|
| 121 |
void swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);
|
| 122 |
```
|
| 123 |
|
| 124 |
+
*Effects:* Equivalent to `x.swap(y)`.
|
| 125 |
|
| 126 |
#### Member functions <a id="ofstream.members">[[ofstream.members]]</a>
|
| 127 |
|
| 128 |
``` cpp
|
| 129 |
basic_filebuf<charT, traits>* rdbuf() const;
|
| 130 |
```
|
| 131 |
|
| 132 |
+
*Returns:*
|
| 133 |
+
`const_cast<basic_filebuf<charT, traits>*>(addressof(`*`sb`*`))`.
|
| 134 |
+
|
| 135 |
+
``` cpp
|
| 136 |
+
native_handle_type native_handle() const noexcept;
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
*Effects:* Equivalent to: `return rdbuf()->native_handle();`
|
| 140 |
|
| 141 |
``` cpp
|
| 142 |
bool is_open() const;
|
| 143 |
```
|
| 144 |
|