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