35 #ifndef _GLIBCXX_FSTREAM
36 #define _GLIBCXX_FSTREAM 1
38 #pragma GCC system_header
45 #ifdef __GXX_EXPERIMENTAL_CXX0X__
49 namespace std _GLIBCXX_VISIBILITY(default)
51 _GLIBCXX_BEGIN_NAMESPACE_VERSION
68 template<
typename _CharT,
typename _Traits>
73 typedef _CharT char_type;
74 typedef _Traits traits_type;
75 typedef typename traits_type::int_type int_type;
76 typedef typename traits_type::pos_type pos_type;
77 typedef typename traits_type::off_type off_type;
81 typedef __basic_file<char> __file_type;
82 typedef typename traits_type::state_type __state_type;
99 __state_type _M_state_beg;
104 __state_type _M_state_cur;
108 __state_type _M_state_last;
121 bool _M_buf_allocated;
225 {
return _M_file.is_open(); }
267 open(
const char* __s, ios_base::openmode __mode);
269 #ifdef __GXX_EXPERIMENTAL_CXX0X__
298 _M_allocate_internal_buffer();
301 _M_destroy_internal_buffer() throw();
316 pbackfail(int_type __c = _Traits::eof());
326 overflow(int_type __c = _Traits::eof());
331 _M_convert_to_external(char_type*,
streamsize);
345 virtual __streambuf_type*
346 setbuf(char_type* __s, streamsize __n);
358 _M_seek(off_type __off,
ios_base::seekdir __way, __state_type __state);
361 _M_get_ext_pos(__state_type &__state);
370 xsgetn(char_type* __s, streamsize __n);
373 xsputn(const char_type* __s, streamsize __n);
377 _M_terminate_output();
397 if (__testin && __off > 0)
419 template<
typename _CharT,
typename _Traits>
424 typedef _CharT char_type;
425 typedef _Traits traits_type;
426 typedef typename traits_type::int_type int_type;
427 typedef typename traits_type::pos_type pos_type;
428 typedef typename traits_type::off_type off_type;
447 { this->
init(&_M_filebuf); }
463 this->
init(&_M_filebuf);
464 this->
open(__s, __mode);
467 #ifdef __GXX_EXPERIMENTAL_CXX0X__
480 this->
init(&_M_filebuf);
481 this->
open(__s, __mode);
511 {
return _M_filebuf.
is_open(); }
517 {
return _M_filebuf.
is_open(); }
541 #ifdef __GXX_EXPERIMENTAL_CXX0X__
571 if (!_M_filebuf.
close())
587 template<
typename _CharT,
typename _Traits>
592 typedef _CharT char_type;
593 typedef _Traits traits_type;
594 typedef typename traits_type::int_type int_type;
595 typedef typename traits_type::pos_type pos_type;
596 typedef typename traits_type::off_type off_type;
615 { this->
init(&_M_filebuf); }
633 this->
init(&_M_filebuf);
634 this->
open(__s, __mode);
637 #ifdef __GXX_EXPERIMENTAL_CXX0X__
651 this->
init(&_M_filebuf);
652 this->
open(__s, __mode);
682 {
return _M_filebuf.
is_open(); }
688 {
return _M_filebuf.
is_open(); }
713 #ifdef __GXX_EXPERIMENTAL_CXX0X__
744 if (!_M_filebuf.
close())
760 template<
typename _CharT,
typename _Traits>
765 typedef _CharT char_type;
766 typedef _Traits traits_type;
767 typedef typename traits_type::int_type int_type;
768 typedef typename traits_type::pos_type pos_type;
769 typedef typename traits_type::off_type off_type;
790 { this->
init(&_M_filebuf); }
805 this->
init(&_M_filebuf);
806 this->
open(__s, __mode);
809 #ifdef __GXX_EXPERIMENTAL_CXX0X__
820 this->
init(&_M_filebuf);
821 this->
open(__s, __mode);
851 {
return _M_filebuf.
is_open(); }
857 {
return _M_filebuf.
is_open(); }
874 if (!_M_filebuf.
open(__s, __mode))
882 #ifdef __GXX_EXPERIMENTAL_CXX0X__
895 if (!_M_filebuf.
open(__s, __mode))
913 if (!_M_filebuf.
close())
918 _GLIBCXX_END_NAMESPACE_VERSION
virtual int_type pbackfail(int_type __c=_Traits::eof())
Tries to back up the input sequence.
ios_base::openmode _M_mode
Place to stash in || out || in | out settings for current filebuf.
void open(const char *__s, ios_base::openmode __mode=ios_base::out|ios_base::trunc)
Opens an external file.
Primary class template codecvt.NB: Generic, mostly useless implementation.
basic_filebuf()
Does not open any files.
virtual void imbue(const locale &__loc)
Changes translations.
virtual streamsize xsputn(const char_type *__s, streamsize __n)
Multiple character insertion.
__filebuf_type * rdbuf() const
Accessing the underlying buffer.
Controlling input and output for files.This class supports reading from and writing to named files...
char_type * _M_pback_end_save
void setstate(iostate __state)
Sets additional flags in the error state.
void setp(char_type *__pbeg, char_type *__pend)
Setting the three write area pointers.
virtual __streambuf_type * setbuf(char_type *__s, streamsize __n)
Manipulates the buffer.
virtual ~basic_filebuf()
The destructor closes the file first.
basic_ofstream(const char *__s, ios_base::openmode __mode=ios_base::out|ios_base::trunc)
Create an output file stream.
char_type * eback() const
Access to the get area.
~basic_fstream()
The destructor does nothing.
Virtual base class for all stream classes.Most of the member functions called dispatched on stream ob...
const _CharT * c_str() const _GLIBCXX_NOEXCEPT
Return const pointer to null-terminated contents.
Template class basic_ostream.This is the base class for all output streams. It provides text formatti...
streamsize _M_ext_buf_size
void open(const char *__s, ios_base::openmode __mode=ios_base::in|ios_base::out)
Opens an external file.
void init(basic_streambuf< _CharT, _Traits > *__sb)
All setup is performed here.
bool is_open()
Wrapper to test for an open file.
void _M_set_buffer(streamsize __off)
virtual int sync()
Synchronizes the buffer arrays with the controlled sequences.
__filebuf_type * rdbuf() const
Accessing the underlying buffer.
virtual int_type underflow()
Fetches more data from the controlled sequence.
basic_ofstream()
Default constructor.
Container class for localization functionality.The locale class is first a class wrapper for C librar...
basic_fstream()
Default constructor.
basic_ifstream(const std::string &__s, ios_base::openmode __mode=ios_base::in)
Create an input file stream.
static const openmode out
Open for output. Default for ofstream and fstream.
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_ofstream(const std::string &__s, ios_base::openmode __mode=ios_base::out|ios_base::trunc)
Create an output file stream.
__filebuf_type * open(const char *__s, ios_base::openmode __mode)
Opens an external file.
__filebuf_type * close()
Closes the currently associated file.
Controlling output for files.This class supports reading from named files, using the inherited functi...
basic_fstream(const char *__s, ios_base::openmode __mode=ios_base::in|ios_base::out)
Create an input/output file stream.
bool is_open()
Wrapper to test for an open file.
The actual work of input and output (for files).This class associates both its input and output seque...
void setg(char_type *__gbeg, char_type *__gnext, char_type *__gend)
Setting the three read area pointers.
void close()
Close the file.
char_type * _M_buf
Pointer to the beginning of internal buffer.
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.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
Template class basic_istream.This is the base class for all input streams. It provides text formattin...
~basic_ofstream()
The destructor does nothing.
void open(const char *__s, ios_base::openmode __mode=ios_base::in)
Opens an external file.
void open(const std::string &__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.
__filebuf_type * rdbuf() const
Accessing the underlying buffer.
The base of the I/O class hierarchy.This class defines everything that can be defined about I/O that ...
__filebuf_type * open(const std::string &__s, ios_base::openmode __mode)
Opens an external file.
static const openmode trunc
Open for input. Default for ofstream.
void clear(iostate __state=goodbit)
[Re]sets the error state.
void close()
Close the file.
char_type * egptr() const
Access to the get area.
char_type * _M_pback_cur_save
char_type * gptr() const
Access to the get area.
virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode=ios_base::in|ios_base::out)
Alters the stream positions.
bool is_open() const
Returns true if the external file is open.
void close()
Close the file.
virtual int_type overflow(int_type __c=_Traits::eof())
Consumes data from the buffer; writes to the controlled sequence.
basic_ifstream()
Default constructor.
Controlling input for files.This class supports reading from named files, using the inherited functio...
~basic_ifstream()
The destructor does nothing.
The actual work of input and output (interface).This is a base class. Derived stream buffers each con...
virtual streamsize xsgetn(char_type *__s, streamsize __n)
Multiple character extraction.
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.
bool is_open()
Wrapper to test for an open file.
Template class basic_iostreamThis class multiply inherits from the input and output stream classes si...
basic_ifstream(const char *__s, ios_base::openmode __mode=ios_base::in)
Create an input file stream.