33 #ifndef _GLIBCXX_FSTREAM
34 #define _GLIBCXX_FSTREAM 1
36 #pragma GCC system_header
43 #if __cplusplus >= 201103L
47 namespace std _GLIBCXX_VISIBILITY(default)
49 _GLIBCXX_BEGIN_NAMESPACE_VERSION
71 template<
typename _CharT,
typename _Traits>
76 typedef _CharT char_type;
77 typedef _Traits traits_type;
78 typedef typename traits_type::int_type int_type;
79 typedef typename traits_type::pos_type pos_type;
80 typedef typename traits_type::off_type off_type;
84 typedef __basic_file<char> __file_type;
85 typedef typename traits_type::state_type __state_type;
102 __state_type _M_state_beg;
107 __state_type _M_state_cur;
111 __state_type _M_state_last;
124 bool _M_buf_allocated;
228 {
return _M_file.is_open(); }
272 open(
const char* __s, ios_base::openmode __mode);
274 #if __cplusplus >= 201103L
303 _M_allocate_internal_buffer();
306 _M_destroy_internal_buffer() throw();
321 pbackfail(int_type __c = _Traits::eof());
331 overflow(int_type __c = _Traits::eof());
336 _M_convert_to_external(char_type*,
streamsize);
350 virtual __streambuf_type*
351 setbuf(char_type* __s, streamsize __n);
363 _M_seek(off_type __off,
ios_base::seekdir __way, __state_type __state);
366 _M_get_ext_pos(__state_type &__state);
375 xsgetn(char_type* __s, streamsize __n);
378 xsputn(const char_type* __s, streamsize __n);
382 _M_terminate_output();
403 if (__testin && __off > 0)
429 template<
typename _CharT,
typename _Traits>
434 typedef _CharT char_type;
435 typedef _Traits traits_type;
436 typedef typename traits_type::int_type int_type;
437 typedef typename traits_type::pos_type pos_type;
438 typedef typename traits_type::off_type off_type;
457 { this->
init(&_M_filebuf); }
473 this->
init(&_M_filebuf);
474 this->
open(__s, __mode);
477 #if __cplusplus >= 201103L
490 this->
init(&_M_filebuf);
491 this->
open(__s, __mode);
521 {
return _M_filebuf.
is_open(); }
527 {
return _M_filebuf.
is_open(); }
551 #if __cplusplus >= 201103L
581 if (!_M_filebuf.
close())
601 template<
typename _CharT,
typename _Traits>
606 typedef _CharT char_type;
607 typedef _Traits traits_type;
608 typedef typename traits_type::int_type int_type;
609 typedef typename traits_type::pos_type pos_type;
610 typedef typename traits_type::off_type off_type;
629 { this->
init(&_M_filebuf); }
647 this->
init(&_M_filebuf);
648 this->
open(__s, __mode);
651 #if __cplusplus >= 201103L
665 this->
init(&_M_filebuf);
666 this->
open(__s, __mode);
696 {
return _M_filebuf.
is_open(); }
702 {
return _M_filebuf.
is_open(); }
727 #if __cplusplus >= 201103L
758 if (!_M_filebuf.
close())
778 template<
typename _CharT,
typename _Traits>
783 typedef _CharT char_type;
784 typedef _Traits traits_type;
785 typedef typename traits_type::int_type int_type;
786 typedef typename traits_type::pos_type pos_type;
787 typedef typename traits_type::off_type off_type;
808 { this->
init(&_M_filebuf); }
823 this->
init(&_M_filebuf);
824 this->
open(__s, __mode);
827 #if __cplusplus >= 201103L
838 this->
init(&_M_filebuf);
839 this->
open(__s, __mode);
869 {
return _M_filebuf.
is_open(); }
875 {
return _M_filebuf.
is_open(); }
892 if (!_M_filebuf.
open(__s, __mode))
900 #if __cplusplus >= 201103L
913 if (!_M_filebuf.
open(__s, __mode))
931 if (!_M_filebuf.
close())
936 _GLIBCXX_END_NAMESPACE_VERSION
static const openmode app
Seek to end before each write.
void setp(char_type *__pbeg, char_type *__pend)
Setting the three write area pointers.
virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode=ios_base::in|ios_base::out)
Alters the stream positions.
static const iostate failbit
Indicates that an input operation failed to read the expected characters, or that an output operation...
virtual __streambuf_type * setbuf(char_type *__s, streamsize __n)
Manipulates the buffer.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
basic_fstream(const std::string &__s, ios_base::openmode __mode=ios_base::in|ios_base::out)
Create an input/output file stream.
__filebuf_type * close()
Closes the currently associated file.
The actual work of input and output (for files).
virtual void imbue(const locale &__loc)
Changes translations.
The base of the I/O class hierarchy.This class defines everything that can be defined about I/O that ...
basic_ifstream(const char *__s, ios_base::openmode __mode=ios_base::in)
Create an input file stream.
Template class basic_istream.
__filebuf_type * rdbuf() const
Accessing the underlying buffer.
virtual int sync()
Synchronizes the buffer arrays with the controlled sequences.
static const openmode in
Open for input. Default for ifstream and fstream.
void open(const std::string &__s, ios_base::openmode __mode=ios_base::out|ios_base::trunc)
Opens an external file.
__filebuf_type * rdbuf() const
Accessing the underlying buffer.
virtual streamsize showmanyc()
Investigating the data available.
__filebuf_type * rdbuf() const
Accessing the underlying buffer.
virtual ~basic_filebuf()
The destructor closes the file first.
bool is_open()
Wrapper to test for an open file.
basic_ifstream(const std::string &__s, ios_base::openmode __mode=ios_base::in)
Create an input file stream.
static const openmode trunc
Open for input. Default for ofstream.
ios_base::openmode _M_mode
Place to stash in || out || in | out settings for current filebuf.
void init(basic_streambuf< _CharT, _Traits > *__sb)
All setup is performed here.
basic_fstream()
Default constructor.
Controlling input for files.
void close()
Close the file.
char_type * _M_pback_cur_save
__filebuf_type * open(const char *__s, ios_base::openmode __mode)
Opens an external file.
void clear(iostate __state=goodbit)
[Re]sets the error state.
void _M_set_buffer(streamsize __off)
char_type * _M_pback_end_save
bool is_open()
Wrapper to test for an open file.
Controlling output for files.
bool is_open()
Wrapper to test for an open file.
bool is_open() const
Returns true if the external file is open.
Container class for localization functionality.The locale class is first a class wrapper for C librar...
char_type * eback() const
Access to the get area.
virtual pos_type seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode=ios_base::in|ios_base::out)
Alters the stream positions.
void open(const std::string &__s, ios_base::openmode __mode=ios_base::in|ios_base::out)
Opens an external file.
streamsize _M_ext_buf_size
Template class basic_iostream.
~basic_ifstream()
The destructor does nothing.
char_type * gptr() const
Access to the get area.
Controlling input and output for files.
The actual work of input and output (interface).
void close()
Close the file.
basic_fstream(const char *__s, ios_base::openmode __mode=ios_base::in|ios_base::out)
Create an input/output file stream.
void open(const char *__s, ios_base::openmode __mode=ios_base::in|ios_base::out)
Opens an external file.
void setstate(iostate __state)
Sets additional flags in the error state.
basic_ofstream(const char *__s, ios_base::openmode __mode=ios_base::out|ios_base::trunc)
Create an output file stream.
char_type * _M_buf
Pointer to the beginning of internal buffer.
Primary class template codecvt.NB: Generic, mostly useless implementation.
static const openmode out
Open for output. Default for ofstream and fstream.
void setg(char_type *__gbeg, char_type *__gnext, char_type *__gend)
Setting the three read area pointers.
char_type * egptr() const
Access to the get area.
basic_filebuf()
Does not open any files.
basic_ifstream()
Default constructor.
virtual int_type underflow()
Fetches more data from the controlled sequence.
void open(const std::string &__s, ios_base::openmode __mode=ios_base::in)
Opens an external file.
~basic_fstream()
The destructor does nothing.
basic_ofstream(const std::string &__s, ios_base::openmode __mode=ios_base::out|ios_base::trunc)
Create an output file stream.
__filebuf_type * open(const std::string &__s, ios_base::openmode __mode)
Opens an external file.
basic_ofstream()
Default constructor.
void open(const char *__s, ios_base::openmode __mode=ios_base::in)
Opens an external file.
Template class basic_ostream.
void close()
Close the file.
virtual streamsize xsgetn(char_type *__s, streamsize __n)
Multiple character extraction.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
void open(const char *__s, ios_base::openmode __mode=ios_base::out|ios_base::trunc)
Opens an external file.
virtual streamsize xsputn(const char_type *__s, streamsize __n)
Multiple character insertion.
~basic_ofstream()
The destructor does nothing.
Template class basic_ios, virtual base class for all stream classes.