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
~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.
Controlling input for files.
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.
__filebuf_type * rdbuf() const
Accessing the underlying buffer.
__filebuf_type * rdbuf() const
Accessing the underlying buffer.
Controlling output for files.
virtual __streambuf_type * setbuf(char_type *__s, streamsize __n)
Manipulates the buffer.
Container class for localization functionality.The locale class is first a class wrapper for C librar...
void open(const std::string &__s, ios_base::openmode __mode=ios_base::out|ios_base::trunc)
Opens an external file.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
~basic_ofstream()
The destructor does nothing.
__filebuf_type * rdbuf() const
Accessing the underlying buffer.
~basic_ifstream()
The destructor does nothing.
static const iostate failbit
Indicates that an input operation failed to read the expected characters, or that an output operation...
void open(const std::string &__s, ios_base::openmode __mode=ios_base::in)
Opens an external file.
basic_ifstream(const char *__s, ios_base::openmode __mode=ios_base::in)
Create an input 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 ...
Controlling input and output for files.
basic_fstream()
Default constructor.
Template class basic_istream.
virtual int sync()
Synchronizes the buffer arrays with the controlled sequences.
Primary class template codecvt.NB: Generic, mostly useless implementation.
static const openmode out
Open for output. Default for ofstream and fstream.
virtual streamsize showmanyc()
Investigating the data available.
basic_fstream(const std::string &__s, ios_base::openmode __mode=ios_base::in|ios_base::out)
Create an input/output file stream.
virtual ~basic_filebuf()
The destructor closes the file first.
basic_ifstream()
Default constructor.
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.
bool is_open()
Wrapper to test for an open file.
char_type * _M_pback_cur_save
__filebuf_type * open(const char *__s, ios_base::openmode __mode)
Opens an external file.
void close()
Close the file.
static const openmode trunc
Open for input. Default for ofstream.
void close()
Close the file.
void clear(iostate __state=goodbit)
[Re]sets the error state.
void _M_set_buffer(streamsize __off)
char_type * _M_pback_end_save
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.
bool is_open() const
Returns true if the external file is open.
basic_ofstream(const char *__s, ios_base::openmode __mode=ios_base::out|ios_base::trunc)
Create an output file stream.
static const openmode app
Seek to end before each write.
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.
streamsize _M_ext_buf_size
Template class basic_iostream.
basic_ifstream(const std::string &__s, ios_base::openmode __mode=ios_base::in)
Create an input file stream.
char_type * gptr() const
Access to the get area.
The actual work of input and output (interface).
basic_ofstream()
Default constructor.
bool is_open()
Wrapper to test for an open file.
void close()
Close the file.
void setstate(iostate __state)
Sets additional flags in the error state.
bool is_open()
Wrapper to test for an open file.
char_type * _M_buf
Pointer to the beginning of internal buffer.
void setg(char_type *__gbeg, char_type *__gnext, char_type *__gend)
Setting the three read area pointers.
void open(const char *__s, ios_base::openmode __mode=ios_base::out|ios_base::trunc)
Opens an external file.
void open(const char *__s, ios_base::openmode __mode=ios_base::in)
Opens an external file.
char_type * egptr() const
Access to the get area.
static const openmode in
Open for input. Default for ifstream and fstream.
basic_filebuf()
Does not open any files.
void open(const std::string &__s, ios_base::openmode __mode=ios_base::in|ios_base::out)
Opens an external file.
virtual int_type underflow()
Fetches more data from the controlled sequence.
virtual int_type overflow(int_type __c=_Traits::eof())
Consumes data from the buffer; writes to the controlled sequence.
__filebuf_type * open(const std::string &__s, ios_base::openmode __mode)
Opens an external file.
Template class basic_ostream.
virtual streamsize xsgetn(char_type *__s, streamsize __n)
Multiple character extraction.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
virtual streamsize xsputn(const char_type *__s, streamsize __n)
Multiple character insertion.
Template class basic_ios, virtual base class for all stream classes.
virtual int_type pbackfail(int_type __c=_Traits::eof())
Tries to back up the input sequence.