35 #ifndef _GLIBCXX_FSTREAM
36 #define _GLIBCXX_FSTREAM 1
38 #pragma GCC system_header
45 #ifdef __GXX_EXPERIMENTAL_CXX0X__
49 _GLIBCXX_BEGIN_NAMESPACE(std)
66 template<typename _CharT, typename _Traits>
73 typedef typename traits_type::int_type
int_type;
74 typedef typename traits_type::pos_type
pos_type;
75 typedef typename traits_type::off_type
off_type;
79 typedef __basic_file<char> __file_type;
80 typedef typename traits_type::state_type __state_type;
97 __state_type _M_state_beg;
102 __state_type _M_state_cur;
106 __state_type _M_state_last;
119 bool _M_buf_allocated;
144 const __codecvt_type* _M_codecvt;
176 _M_pback_cur_save = this->gptr();
177 _M_pback_end_save = this->egptr();
178 this->setg(&_M_pback, &_M_pback, &_M_pback + 1);
179 _M_pback_init =
true;
189 _M_destroy_pback() throw()
194 _M_pback_cur_save += this->gptr() != this->eback();
195 this->setg(_M_buf, _M_pback_cur_save, _M_pback_end_save);
196 _M_pback_init =
false;
222 is_open()
const throw()
223 {
return _M_file.is_open(); }
265 open(
const char* __s, ios_base::openmode __mode);
267 #ifdef __GXX_EXPERIMENTAL_CXX0X__
295 _M_allocate_internal_buffer();
298 _M_destroy_internal_buffer() throw();
313 pbackfail(int_type __c = _Traits::eof());
323 overflow(int_type __c = _Traits::eof());
328 _M_convert_to_external(char_type*,
streamsize);
342 virtual __streambuf_type*
343 setbuf(char_type* __s, streamsize __n);
346 seekoff(off_type __off,
ios_base::seekdir __way,
350 seekpos(pos_type __pos,
355 _M_seek(off_type __off,
ios_base::seekdir __way, __state_type __state);
361 imbue(const
locale& __loc);
364 xsgetn(char_type* __s, streamsize __n);
367 xsputn(const char_type* __s, streamsize __n);
371 _M_terminate_output();
386 _M_set_buffer(streamsize __off)
388 const bool __testin = _M_mode & ios_base::in;
389 const bool __testout = _M_mode & ios_base::out;
391 if (__testin && __off > 0)
392 this->setg(_M_buf, _M_buf, _M_buf + __off);
394 this->setg(_M_buf, _M_buf, _M_buf);
396 if (__testout && __off == 0 && _M_buf_size > 1 )
397 this->setp(_M_buf, _M_buf + _M_buf_size - 1);
399 this->setp(NULL, NULL);
413 template<
typename _CharT,
typename _Traits>
441 { this->init(&_M_filebuf); }
457 this->init(&_M_filebuf);
458 this->open(__s, __mode);
461 #ifdef __GXX_EXPERIMENTAL_CXX0X__
471 ios_base::openmode __mode = ios_base::in)
474 this->init(&_M_filebuf);
475 this->open(__s, __mode);
505 {
return _M_filebuf.
is_open(); }
511 {
return _M_filebuf.is_open(); }
525 open(
const char* __s, ios_base::openmode __mode = ios_base::in)
527 if (!_M_filebuf.open(__s, __mode | ios_base::in))
528 this->setstate(ios_base::failbit);
535 #ifdef __GXX_EXPERIMENTAL_CXX0X__
545 open(
const std::string& __s, ios_base::openmode __mode = ios_base::in)
547 if (!_M_filebuf.open(__s, __mode | ios_base::in))
548 this->setstate(ios_base::failbit);
565 if (!_M_filebuf.close())
566 this->setstate(ios_base::failbit);
581 template<
typename _CharT,
typename _Traits>
609 { this->init(&_M_filebuf); }
624 ios_base::openmode __mode = ios_base::out|ios_base::trunc)
627 this->init(&_M_filebuf);
628 this->open(__s, __mode);
631 #ifdef __GXX_EXPERIMENTAL_CXX0X__
642 ios_base::openmode __mode = ios_base::out|ios_base::trunc)
645 this->init(&_M_filebuf);
646 this->open(__s, __mode);
676 {
return _M_filebuf.
is_open(); }
682 {
return _M_filebuf.is_open(); }
696 open(
const char* __s,
697 ios_base::openmode __mode = ios_base::out | ios_base::trunc)
699 if (!_M_filebuf.open(__s, __mode | ios_base::out))
700 this->setstate(ios_base::failbit);
707 #ifdef __GXX_EXPERIMENTAL_CXX0X__
718 ios_base::openmode __mode = ios_base::out | ios_base::trunc)
720 if (!_M_filebuf.open(__s, __mode | ios_base::out))
721 this->setstate(ios_base::failbit);
738 if (!_M_filebuf.close())
739 this->setstate(ios_base::failbit);
754 template<
typename _CharT,
typename _Traits>
784 { this->init(&_M_filebuf); }
796 ios_base::openmode __mode = ios_base::in | ios_base::out)
799 this->init(&_M_filebuf);
800 this->open(__s, __mode);
803 #ifdef __GXX_EXPERIMENTAL_CXX0X__
811 ios_base::openmode __mode = ios_base::in | ios_base::out)
814 this->init(&_M_filebuf);
815 this->open(__s, __mode);
845 {
return _M_filebuf.
is_open(); }
851 {
return _M_filebuf.is_open(); }
865 open(
const char* __s,
866 ios_base::openmode __mode = ios_base::in | ios_base::out)
868 if (!_M_filebuf.open(__s, __mode))
869 this->setstate(ios_base::failbit);
876 #ifdef __GXX_EXPERIMENTAL_CXX0X__
887 ios_base::openmode __mode = ios_base::in | ios_base::out)
889 if (!_M_filebuf.open(__s, __mode))
890 this->setstate(ios_base::failbit);
907 if (!_M_filebuf.close())
908 this->setstate(ios_base::failbit);
912 _GLIBCXX_END_NAMESPACE
914 #ifndef _GLIBCXX_EXPORT_TEMPLATE