tmp/tmpxo75j_en/{from.md → to.md}
RENAMED
|
@@ -1,7 +1,9 @@
|
|
| 1 |
### Class template `basic_ofstream` <a id="ofstream">[[ofstream]]</a>
|
| 2 |
|
|
|
|
|
|
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
template<class charT, class traits = char_traits<charT>>
|
| 6 |
class basic_ofstream : public basic_ostream<charT, traits> {
|
| 7 |
public:
|
|
@@ -17,18 +19,19 @@ namespace std {
|
|
| 17 |
ios_base::openmode mode = ios_base::out);
|
| 18 |
explicit basic_ofstream(const filesystem::path::value_type* s, // wide systems only; see [fstream.syn]
|
| 19 |
ios_base::openmode mode = ios_base::out);
|
| 20 |
explicit basic_ofstream(const string& s,
|
| 21 |
ios_base::openmode mode = ios_base::out);
|
| 22 |
-
|
| 23 |
-
|
| 24 |
basic_ofstream(const basic_ofstream&) = delete;
|
| 25 |
basic_ofstream(basic_ofstream&& rhs);
|
| 26 |
|
| 27 |
-
// [ofstream.assign], assign and swap
|
| 28 |
basic_ofstream& operator=(const basic_ofstream&) = delete;
|
| 29 |
basic_ofstream& operator=(basic_ofstream&& rhs);
|
|
|
|
|
|
|
| 30 |
void swap(basic_ofstream& rhs);
|
| 31 |
|
| 32 |
// [ofstream.members], members
|
| 33 |
basic_filebuf<charT, traits>* rdbuf() const;
|
| 34 |
|
|
@@ -37,17 +40,14 @@ namespace std {
|
|
| 37 |
void open(const filesystem::path::value_type* s,
|
| 38 |
ios_base::openmode mode = ios_base::out); // wide systems only; see [fstream.syn]
|
| 39 |
void open(const string& s, ios_base::openmode mode = ios_base::out);
|
| 40 |
void open(const filesystem::path& s, ios_base::openmode mode = ios_base::out);
|
| 41 |
void close();
|
|
|
|
| 42 |
private:
|
| 43 |
basic_filebuf<charT, traits> sb; // exposition only
|
| 44 |
};
|
| 45 |
-
|
| 46 |
-
template<class charT, class traits>
|
| 47 |
-
void swap(basic_ofstream<charT, traits>& x,
|
| 48 |
-
basic_ofstream<charT, traits>& y);
|
| 49 |
}
|
| 50 |
```
|
| 51 |
|
| 52 |
The class `basic_ofstream<charT, traits>` supports writing to named
|
| 53 |
files. It uses a `basic_filebuf<{}charT, traits>` object to control the
|
|
@@ -80,38 +80,44 @@ with `basic_filebuf<charT, traits>()` [[filebuf.cons]], then calls
|
|
| 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 |
-
explicit basic_ofstream(const filesystem::path& 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 |
basic_ofstream(basic_ofstream&& rhs);
|
| 93 |
```
|
| 94 |
|
| 95 |
*Effects:* Move constructs the base class, and the contained
|
| 96 |
`basic_filebuf`. Then calls
|
| 97 |
`basic_ostream<charT, traits>::set_rdbuf(addressof(sb))` to install the
|
| 98 |
contained `basic_filebuf`.
|
| 99 |
|
| 100 |
-
####
|
| 101 |
|
| 102 |
``` cpp
|
| 103 |
void swap(basic_ofstream& rhs);
|
| 104 |
```
|
| 105 |
|
| 106 |
*Effects:* Exchanges the state of `*this` and `rhs` by calling
|
| 107 |
`basic_ostream<charT, traits>::swap(rhs)` and `sb.swap(rhs.sb)`.
|
| 108 |
|
| 109 |
``` cpp
|
| 110 |
template<class charT, class traits>
|
| 111 |
-
void swap(basic_ofstream<charT, traits>& x,
|
| 112 |
-
basic_ofstream<charT, traits>& y);
|
| 113 |
```
|
| 114 |
|
| 115 |
*Effects:* Equivalent to: `x.swap(y)`.
|
| 116 |
|
| 117 |
#### Member functions <a id="ofstream.members">[[ofstream.members]]</a>
|
|
|
|
| 1 |
### Class template `basic_ofstream` <a id="ofstream">[[ofstream]]</a>
|
| 2 |
|
| 3 |
+
#### General <a id="ofstream.general">[[ofstream.general]]</a>
|
| 4 |
+
|
| 5 |
``` cpp
|
| 6 |
namespace std {
|
| 7 |
template<class charT, class traits = char_traits<charT>>
|
| 8 |
class basic_ofstream : public basic_ostream<charT, traits> {
|
| 9 |
public:
|
|
|
|
| 19 |
ios_base::openmode mode = ios_base::out);
|
| 20 |
explicit basic_ofstream(const filesystem::path::value_type* s, // wide systems only; see [fstream.syn]
|
| 21 |
ios_base::openmode mode = ios_base::out);
|
| 22 |
explicit basic_ofstream(const string& s,
|
| 23 |
ios_base::openmode mode = ios_base::out);
|
| 24 |
+
template<class T>
|
| 25 |
+
explicit basic_ofstream(const T& s, ios_base::openmode mode = ios_base::out);
|
| 26 |
basic_ofstream(const basic_ofstream&) = delete;
|
| 27 |
basic_ofstream(basic_ofstream&& rhs);
|
| 28 |
|
|
|
|
| 29 |
basic_ofstream& operator=(const basic_ofstream&) = delete;
|
| 30 |
basic_ofstream& operator=(basic_ofstream&& rhs);
|
| 31 |
+
|
| 32 |
+
// [ofstream.swap], swap
|
| 33 |
void swap(basic_ofstream& rhs);
|
| 34 |
|
| 35 |
// [ofstream.members], members
|
| 36 |
basic_filebuf<charT, traits>* rdbuf() const;
|
| 37 |
|
|
|
|
| 40 |
void open(const filesystem::path::value_type* s,
|
| 41 |
ios_base::openmode mode = ios_base::out); // wide systems only; see [fstream.syn]
|
| 42 |
void open(const string& s, ios_base::openmode mode = ios_base::out);
|
| 43 |
void open(const filesystem::path& s, ios_base::openmode mode = ios_base::out);
|
| 44 |
void close();
|
| 45 |
+
|
| 46 |
private:
|
| 47 |
basic_filebuf<charT, traits> sb; // exposition only
|
| 48 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
}
|
| 50 |
```
|
| 51 |
|
| 52 |
The class `basic_ofstream<charT, traits>` supports writing to named
|
| 53 |
files. It uses a `basic_filebuf<{}charT, traits>` object to control the
|
|
|
|
| 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: `basic_ofstream(s.c_str(), mode)`.
|
| 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: `basic_ofstream(s.c_str(), mode)`.
|
| 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 install the
|
| 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 `sb.swap(rhs.sb)`.
|
| 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: `x.swap(y)`.
|
| 122 |
|
| 123 |
#### Member functions <a id="ofstream.members">[[ofstream.members]]</a>
|