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
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.
char_type * eback() const
Access to the get area.
void open(const std::string &__s, ios_base::openmode __mode=ios_base::out|ios_base::trunc)
Opens an external file.
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.
bool is_open() const
Returns true if the external file is open.
basic_ifstream()
Default constructor.
Controlling output.This is the base class for all output streams. It provides text formatting of all ...
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.
Controlling input for files.This class supports reading from named files, using the inherited functio...
__filebuf_type * rdbuf() const
Accessing the underlying buffer.
bool is_open()
Wrapper to test for an open file.
basic_fstream()
Default constructor.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
basic_filebuf()
Does not open any files.
void open(const std::string &__s, ios_base::openmode __mode=ios_base::in)
Opens an external file.
void close()
Close the file.
bool is_open()
Wrapper to test for an open file.
void clear(iostate __state=goodbit)
[Re]sets the error state.
Controlling input.This is the base class for all input streams. It provides text formatting of all bu...
virtual int sync()
Synchronizes the buffer arrays with the controlled sequences.
void setg(char_type *__gbeg, char_type *__gnext, char_type *__gend)
Setting the three read area pointers.
basic_ofstream(const char *__s, ios_base::openmode __mode=ios_base::out|ios_base::trunc)
Create an output file stream.
Controlling output for files.This class supports reading from named files, using the inherited functi...
virtual int_type underflow()
Fetches more data from the controlled sequence.
virtual __streambuf_type * setbuf(char_type *__s, streamsize __n)
Manipulates the buffer.
virtual streamsize xsgetn(char_type *__s, streamsize __n)
Multiple character extraction.
__filebuf_type * open(const char *__s, ios_base::openmode __mode)
Opens an external file.
virtual ~basic_filebuf()
The destructor closes the file first.
static const openmode trunc
Open for input. Default for ofstream.
~basic_ofstream()
The destructor does nothing.
Container class for localization functionality.The locale class is first a class wrapper for C librar...
virtual pos_type seekpos(pos_type __pos, 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::in|ios_base::out)
Opens an external file.
char_type * _M_pback_cur_save
__filebuf_type * open(const std::string &__s, ios_base::openmode __mode)
Opens an external file.
char_type * egptr() const
Access to the get area.
void _M_set_buffer(streamsize __off)
static const openmode in
Open for input. Default for ifstream and fstream.
virtual void imbue(const locale &__loc)
Changes translations.
~basic_ifstream()
The destructor does nothing.
char_type * gptr() const
Access to the get area.
~basic_fstream()
The destructor does nothing.
basic_ifstream(const std::string &__s, ios_base::openmode __mode=ios_base::in)
Create an input file stream.
void open(const char *__s, ios_base::openmode __mode=ios_base::in)
Opens an external file.
virtual int_type pbackfail(int_type __c=_Traits::eof())
Tries to back up the input sequence.
__filebuf_type * rdbuf() const
Accessing the underlying buffer.
char_type * _M_buf
Pointer to the beginning of internal buffer.
virtual streamsize showmanyc()
Investigating the data available.
Merging istream and ostream capabilities.This class multiply inherits from the input and output strea...
ios_base::openmode _M_mode
Place to stash in || out || in | out settings for current filebuf.
The actual work of input and output (for files).This class associates both its input and output seque...
basic_ofstream()
Default constructor.
static const openmode out
Open for output. Default for ofstream and fstream.
basic_fstream(const char *__s, ios_base::openmode __mode=ios_base::in|ios_base::out)
Create an input/output file stream.
void close()
Close the file.
void open(const std::string &__s, ios_base::openmode __mode=ios_base::in|ios_base::out)
Opens an external file.
The actual work of input and output (interface).This is a base class. Derived stream buffers each con...
__filebuf_type * rdbuf() const
Accessing the underlying buffer.
__filebuf_type * close()
Closes the currently associated file.
streamsize _M_ext_buf_size
void setstate(iostate __state)
Sets additional flags in the error state.
Primary class template codecvt.NB: Generic, mostly useless implementation.
void open(const char *__s, ios_base::openmode __mode=ios_base::out|ios_base::trunc)
Opens an external file.
void setp(char_type *__pbeg, char_type *__pend)
Setting the three write area pointers.
void init(basic_streambuf< _CharT, _Traits > *__sb)
All setup is performed here.
char_type * _M_pback_end_save
const _CharT * c_str() const
Return const pointer to null-terminated contents.
virtual int_type overflow(int_type __c=_Traits::eof())
Consumes data from the buffer; writes to the controlled sequence.
Virtual base class for all stream classes.Most of the member functions called dispatched on stream ob...
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.
static const iostate failbit
Indicates that an input operation failed to read the expected characters, or that an output operation...
Controlling input and output for files.This class supports reading from and writing to named files...
virtual streamsize xsputn(const char_type *__s, streamsize __n)
Multiple character insertion.