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(); }
270 open(
const char* __s, ios_base::openmode __mode);
272 #if __cplusplus >= 201103L
301 _M_allocate_internal_buffer();
304 _M_destroy_internal_buffer() throw();
319 pbackfail(int_type __c = _Traits::eof());
329 overflow(int_type __c = _Traits::eof());
334 _M_convert_to_external(char_type*,
streamsize);
348 virtual __streambuf_type*
349 setbuf(char_type* __s, streamsize __n);
361 _M_seek(off_type __off,
ios_base::seekdir __way, __state_type __state);
364 _M_get_ext_pos(__state_type &__state);
373 xsgetn(char_type* __s, streamsize __n);
376 xsputn(const char_type* __s, streamsize __n);
380 _M_terminate_output();
400 if (__testin && __off > 0)
426 template<
typename _CharT,
typename _Traits>
431 typedef _CharT char_type;
432 typedef _Traits traits_type;
433 typedef typename traits_type::int_type int_type;
434 typedef typename traits_type::pos_type pos_type;
435 typedef typename traits_type::off_type off_type;
454 { this->
init(&_M_filebuf); }
470 this->
init(&_M_filebuf);
471 this->
open(__s, __mode);
474 #if __cplusplus >= 201103L
487 this->
init(&_M_filebuf);
488 this->
open(__s, __mode);
518 {
return _M_filebuf.
is_open(); }
524 {
return _M_filebuf.
is_open(); }
548 #if __cplusplus >= 201103L
578 if (!_M_filebuf.
close())
598 template<
typename _CharT,
typename _Traits>
603 typedef _CharT char_type;
604 typedef _Traits traits_type;
605 typedef typename traits_type::int_type int_type;
606 typedef typename traits_type::pos_type pos_type;
607 typedef typename traits_type::off_type off_type;
626 { this->
init(&_M_filebuf); }
644 this->
init(&_M_filebuf);
645 this->
open(__s, __mode);
648 #if __cplusplus >= 201103L
662 this->
init(&_M_filebuf);
663 this->
open(__s, __mode);
693 {
return _M_filebuf.
is_open(); }
699 {
return _M_filebuf.
is_open(); }
724 #if __cplusplus >= 201103L
755 if (!_M_filebuf.
close())
775 template<
typename _CharT,
typename _Traits>
780 typedef _CharT char_type;
781 typedef _Traits traits_type;
782 typedef typename traits_type::int_type int_type;
783 typedef typename traits_type::pos_type pos_type;
784 typedef typename traits_type::off_type off_type;
805 { this->
init(&_M_filebuf); }
820 this->
init(&_M_filebuf);
821 this->
open(__s, __mode);
824 #if __cplusplus >= 201103L
835 this->
init(&_M_filebuf);
836 this->
open(__s, __mode);
866 {
return _M_filebuf.
is_open(); }
872 {
return _M_filebuf.
is_open(); }
889 if (!_M_filebuf.
open(__s, __mode))
897 #if __cplusplus >= 201103L
910 if (!_M_filebuf.
open(__s, __mode))
928 if (!_M_filebuf.
close())
933 _GLIBCXX_END_NAMESPACE_VERSION
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.
~basic_fstream()
The destructor does nothing.
static const openmode out
Open for output. Default for ofstream and fstream.
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.
The base of the I/O class hierarchy.This class defines everything that can be defined about I/O that ...
virtual __streambuf_type * setbuf(char_type *__s, streamsize __n)
Manipulates the buffer.
basic_ifstream()
Default constructor.
__filebuf_type * rdbuf() const
Accessing the underlying buffer.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
Controlling input and output for files.
bool is_open()
Wrapper to test for an open file.
basic_ofstream(const std::string &__s, ios_base::openmode __mode=ios_base::out|ios_base::trunc)
Create an output file stream.
void close()
Close the file.
__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.
Template class basic_istream.
virtual int sync()
Synchronizes the buffer arrays with the controlled sequences.
~basic_ofstream()
The destructor does nothing.
basic_fstream(const std::string &__s, ios_base::openmode __mode=ios_base::in|ios_base::out)
Create an input/output file stream.
__filebuf_type * rdbuf() const
Accessing the underlying buffer.
~basic_ifstream()
The destructor does nothing.
virtual streamsize showmanyc()
Investigating the data available.
Controlling input for files.
void open(const std::string &__s, ios_base::openmode __mode=ios_base::in|ios_base::out)
Opens an external file.
virtual ~basic_filebuf()
The destructor closes the file first.
void open(const char *__s, ios_base::openmode __mode=ios_base::in)
Opens an external file.
void close()
Close the file.
void open(const char *__s, ios_base::openmode __mode=ios_base::in|ios_base::out)
Opens an external file.
ios_base::openmode _M_mode
Place to stash in || out || in | out settings for current filebuf.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
void init(basic_streambuf< _CharT, _Traits > *__sb)
All setup is performed here.
Container class for localization functionality.The locale class is first a class wrapper for C librar...
basic_fstream(const char *__s, ios_base::openmode __mode=ios_base::in|ios_base::out)
Create an input/output file stream.
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.
basic_ofstream(const char *__s, ios_base::openmode __mode=ios_base::out|ios_base::trunc)
Create an output file stream.
void _M_set_buffer(streamsize __off)
char_type * _M_pback_end_save
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.
bool is_open() const
Returns true if the external file is open.
Controlling output for files.
bool is_open()
Wrapper to test for an open file.
char_type * eback() const
Access to the get area.
static const iostate failbit
Indicates that an input operation failed to read the expected characters, or that an output operation...
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 char *__s, ios_base::openmode __mode=ios_base::out|ios_base::trunc)
Opens an external file.
static const openmode in
Open for input. Default for ifstream and fstream.
streamsize _M_ext_buf_size
Template class basic_iostream.
char_type * gptr() const
Access to the get area.
The actual work of input and output (interface).
void setstate(iostate __state)
Sets additional flags in the error state.
basic_ofstream()
Default constructor.
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.
char_type * egptr() const
Access to the get area.
Primary class template codecvt.NB: Generic, mostly useless implementation.
basic_filebuf()
Does not open any files.
virtual int_type underflow()
Fetches more data from the controlled sequence.
basic_fstream()
Default constructor.
__filebuf_type * open(const std::string &__s, ios_base::openmode __mode)
Opens an external file.
Template class basic_ostream.
static const openmode trunc
Open for input. Default for ofstream.
virtual streamsize xsgetn(char_type *__s, streamsize __n)
Multiple character extraction.
void close()
Close the file.
virtual streamsize xsputn(const char_type *__s, streamsize __n)
Multiple character insertion.
Template class basic_ios, virtual base class for all stream classes.
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.