tmp/tmpsyutojht/{from.md → to.md}
RENAMED
|
@@ -4,14 +4,15 @@
|
|
| 4 |
namespace std {
|
| 5 |
template<class charT, class traits = char_traits<charT>>
|
| 6 |
class basic_filebuf : public basic_streambuf<charT, traits> {
|
| 7 |
public:
|
| 8 |
using char_type = charT;
|
| 9 |
-
using int_type =
|
| 10 |
-
using pos_type =
|
| 11 |
-
using off_type =
|
| 12 |
using traits_type = traits;
|
|
|
|
| 13 |
|
| 14 |
// [filebuf.cons], constructors/destructor
|
| 15 |
basic_filebuf();
|
| 16 |
basic_filebuf(const basic_filebuf&) = delete;
|
| 17 |
basic_filebuf(basic_filebuf&& rhs);
|
|
@@ -25,32 +26,30 @@ namespace std {
|
|
| 25 |
// [filebuf.members], members
|
| 26 |
bool is_open() const;
|
| 27 |
basic_filebuf* open(const char* s, ios_base::openmode mode);
|
| 28 |
basic_filebuf* open(const filesystem::path::value_type* s,
|
| 29 |
ios_base::openmode mode); // wide systems only; see [fstream.syn]
|
| 30 |
-
basic_filebuf* open(const string& s,
|
| 31 |
-
|
| 32 |
-
basic_filebuf* open(const filesystem::path& s,
|
| 33 |
-
ios_base::openmode mode);
|
| 34 |
basic_filebuf* close();
|
|
|
|
| 35 |
|
| 36 |
protected:
|
| 37 |
// [filebuf.virtuals], overridden virtual functions
|
| 38 |
streamsize showmanyc() override;
|
| 39 |
int_type underflow() override;
|
| 40 |
int_type uflow() override;
|
| 41 |
int_type pbackfail(int_type c = traits::eof()) override;
|
| 42 |
int_type overflow (int_type c = traits::eof()) override;
|
| 43 |
|
| 44 |
-
basic_streambuf<charT, traits>* setbuf(char_type* s,
|
| 45 |
-
|
| 46 |
pos_type seekoff(off_type off, ios_base::seekdir way,
|
| 47 |
-
ios_base::openmode which
|
| 48 |
-
= ios_base::in | ios_base::out) override;
|
| 49 |
pos_type seekpos(pos_type sp,
|
| 50 |
-
ios_base::openmode which
|
| 51 |
-
|
| 52 |
int sync() override;
|
| 53 |
void imbue(const locale& loc) override;
|
| 54 |
};
|
| 55 |
}
|
| 56 |
```
|
|
@@ -72,10 +71,19 @@ In particular:
|
|
| 72 |
|
| 73 |
An instance of `basic_filebuf` behaves as described in [[filebuf]]
|
| 74 |
provided `traits::pos_type` is `fpos<traits::{}state_type>`. Otherwise
|
| 75 |
the behavior is undefined.
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
In order to support file I/O and multibyte/wide character conversion,
|
| 78 |
conversions are performed using members of a facet, referred to as
|
| 79 |
`a_codecvt` in following subclauses, obtained as if by
|
| 80 |
|
| 81 |
``` cpp
|
|
|
|
| 4 |
namespace std {
|
| 5 |
template<class charT, class traits = char_traits<charT>>
|
| 6 |
class basic_filebuf : public basic_streambuf<charT, traits> {
|
| 7 |
public:
|
| 8 |
using char_type = charT;
|
| 9 |
+
using int_type = traits::int_type;
|
| 10 |
+
using pos_type = traits::pos_type;
|
| 11 |
+
using off_type = traits::off_type;
|
| 12 |
using traits_type = traits;
|
| 13 |
+
using native_handle_type = implementation-defined // type of native_handle_type; // see [file.native]
|
| 14 |
|
| 15 |
// [filebuf.cons], constructors/destructor
|
| 16 |
basic_filebuf();
|
| 17 |
basic_filebuf(const basic_filebuf&) = delete;
|
| 18 |
basic_filebuf(basic_filebuf&& rhs);
|
|
|
|
| 26 |
// [filebuf.members], members
|
| 27 |
bool is_open() const;
|
| 28 |
basic_filebuf* open(const char* s, ios_base::openmode mode);
|
| 29 |
basic_filebuf* open(const filesystem::path::value_type* s,
|
| 30 |
ios_base::openmode mode); // wide systems only; see [fstream.syn]
|
| 31 |
+
basic_filebuf* open(const string& s, ios_base::openmode mode);
|
| 32 |
+
basic_filebuf* open(const filesystem::path& s, ios_base::openmode mode);
|
|
|
|
|
|
|
| 33 |
basic_filebuf* close();
|
| 34 |
+
native_handle_type native_handle() const noexcept;
|
| 35 |
|
| 36 |
protected:
|
| 37 |
// [filebuf.virtuals], overridden virtual functions
|
| 38 |
streamsize showmanyc() override;
|
| 39 |
int_type underflow() override;
|
| 40 |
int_type uflow() override;
|
| 41 |
int_type pbackfail(int_type c = traits::eof()) override;
|
| 42 |
int_type overflow (int_type c = traits::eof()) override;
|
| 43 |
|
| 44 |
+
basic_streambuf<charT, traits>* setbuf(char_type* s, streamsize n) override;
|
| 45 |
+
|
| 46 |
pos_type seekoff(off_type off, ios_base::seekdir way,
|
| 47 |
+
ios_base::openmode which = ios_base::in | ios_base::out) override;
|
|
|
|
| 48 |
pos_type seekpos(pos_type sp,
|
| 49 |
+
ios_base::openmode which = ios_base::in | ios_base::out) override;
|
| 50 |
+
|
| 51 |
int sync() override;
|
| 52 |
void imbue(const locale& loc) override;
|
| 53 |
};
|
| 54 |
}
|
| 55 |
```
|
|
|
|
| 71 |
|
| 72 |
An instance of `basic_filebuf` behaves as described in [[filebuf]]
|
| 73 |
provided `traits::pos_type` is `fpos<traits::{}state_type>`. Otherwise
|
| 74 |
the behavior is undefined.
|
| 75 |
|
| 76 |
+
The file associated with a `basic_filebuf` has an associated value of
|
| 77 |
+
type `native_handle_type`, called the native handle [[file.native]] of
|
| 78 |
+
that file. This native handle can be obtained by calling the member
|
| 79 |
+
function `native_handle`.
|
| 80 |
+
|
| 81 |
+
For any opened `basic_filebuf f`, the native handle returned by
|
| 82 |
+
`f.native_handle()` is invalidated when `f.close()` is called, or `f` is
|
| 83 |
+
destroyed.
|
| 84 |
+
|
| 85 |
In order to support file I/O and multibyte/wide character conversion,
|
| 86 |
conversions are performed using members of a facet, referred to as
|
| 87 |
`a_codecvt` in following subclauses, obtained as if by
|
| 88 |
|
| 89 |
``` cpp
|