34 #ifndef _GLIBXX_STREAMBUF
35 #define _GLIBXX_STREAMBUF 1
37 #pragma GCC system_header
46 _GLIBCXX_BEGIN_NAMESPACE(std)
48 template<typename _CharT, typename _Traits>
50 __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>*,
51 basic_streambuf<_CharT, _Traits>*,
bool&);
113 template<typename _CharT, typename _Traits>
114 class basic_streambuf
135 friend class basic_ios<char_type, traits_type>;
142 __copy_streambufs_eof<>(__streambuf_type*, __streambuf_type*,
bool&);
144 template<
bool _IsMove,
typename _CharT2>
145 friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
150 template<
typename _CharT2>
151 friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
156 template<
typename _CharT2,
typename _Traits2>
160 template<
typename _CharT2,
typename _Traits2,
typename _Alloc>
165 template<
typename _CharT2,
typename _Traits2,
typename _Alloc>
206 locale __tmp(this->getloc());
208 _M_buf_locale = __loc;
222 {
return _M_buf_locale; }
235 {
return this->setbuf(__s, __n); }
239 ios_base::openmode __mode = ios_base::in | ios_base::out)
240 {
return this->seekoff(__off, __way, __mode); }
244 ios_base::openmode __mode = ios_base::in | ios_base::out)
245 {
return this->seekpos(__sp, __mode); }
263 const streamsize __ret = this->egptr() - this->gptr();
264 return __ret ? __ret : this->showmanyc();
277 int_type __ret = traits_type::eof();
278 if (__builtin_expect(!traits_type::eq_int_type(this->sbumpc(),
280 __ret = this->sgetc();
296 if (__builtin_expect(this->gptr() < this->egptr(),
true))
298 __ret = traits_type::to_int_type(*this->gptr());
302 __ret = this->uflow();
318 if (__builtin_expect(this->gptr() < this->egptr(),
true))
319 __ret = traits_type::to_int_type(*this->gptr());
321 __ret = this->underflow();
335 {
return this->xsgetn(__s, __n); }
351 const bool __testpos = this->eback() < this->gptr();
352 if (__builtin_expect(!__testpos ||
353 !traits_type::eq(__c, this->gptr()[-1]),
false))
354 __ret = this->pbackfail(traits_type::to_int_type(__c));
358 __ret = traits_type::to_int_type(*this->gptr());
376 if (__builtin_expect(this->eback() < this->gptr(),
true))
379 __ret = traits_type::to_int_type(*this->gptr());
382 __ret = this->pbackfail();
403 if (__builtin_expect(this->pptr() < this->epptr(),
true))
407 __ret = traits_type::to_int_type(__c);
410 __ret = this->overflow(traits_type::to_int_type(__c));
427 {
return this->xsputn(__s, __n); }
440 : _M_in_beg(0), _M_in_cur(0), _M_in_end(0),
441 _M_out_beg(0), _M_out_cur(0), _M_out_end(0),
461 gptr()
const {
return _M_in_cur; }
474 gbump(
int __n) { _M_in_cur += __n; }
485 setg(char_type* __gbeg, char_type* __gnext, char_type* __gend)
505 pbase()
const {
return _M_out_beg; }
508 pptr()
const {
return _M_out_cur; }
511 epptr()
const {
return _M_out_end; }
521 pbump(
int __n) { _M_out_cur += __n; }
531 setp(char_type* __pbeg, char_type* __pend)
533 _M_out_beg = _M_out_cur = __pbeg;
579 ios_base::openmode = ios_base::in | ios_base::out)
580 {
return pos_type(off_type(-1)); }
591 ios_base::openmode = ios_base::in | ios_base::out)
592 {
return pos_type(off_type(-1)); }
664 {
return traits_type::eof(); }
678 int_type __ret = traits_type::eof();
679 const bool __testeof = traits_type::eq_int_type(this->underflow(),
683 __ret = traits_type::to_int_type(*this->gptr());
701 {
return traits_type::eof(); }
744 {
return traits_type::eof(); }
746 #if _GLIBCXX_DEPRECATED
760 if (this->gptr() < this->egptr())
770 basic_streambuf(
const __streambuf_type& __sb)
771 : _M_in_beg(__sb._M_in_beg), _M_in_cur(__sb._M_in_cur),
772 _M_in_end(__sb._M_in_end), _M_out_beg(__sb._M_out_beg),
773 _M_out_cur(__sb._M_out_cur), _M_out_end(__sb._M_out_cur),
774 _M_buf_locale(__sb._M_buf_locale)
778 operator=(
const __streambuf_type&) {
return *
this; };
784 __copy_streambufs_eof(basic_streambuf<char>* __sbin,
785 basic_streambuf<char>* __sbout,
bool& __ineof);
786 #ifdef _GLIBCXX_USE_WCHAR_T
789 __copy_streambufs_eof(basic_streambuf<wchar_t>* __sbin,
790 basic_streambuf<wchar_t>* __sbout,
bool& __ineof);
793 _GLIBCXX_END_NAMESPACE
795 #ifndef _GLIBCXX_EXPORT_TEMPLATE
char_type * _M_in_cur
Entry point for imbue().
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
__streambuf_type * pubsetbuf(char_type *__s, streamsize __n)
Entry points for derived buffer functions.
virtual pos_type seekoff(off_type, ios_base::seekdir, ios_base::openmode=ios_base::in|ios_base::out)
Alters the stream positions.
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, bitset< _Nb > &__x)
Global I/O operators for bitsets.
traits_type::pos_type pos_type
char_type * _M_out_end
Entry point for imbue().
char_type * _M_in_end
Entry point for imbue().
void gbump(int __n)
Moving the read position.
int_type sbumpc()
Getting the next character.
void pbump(int __n)
Moving the write position.
char_type * _M_out_beg
Entry point for imbue().
Class representing stream positions.
The actual work of input and output (interface).
virtual ~basic_streambuf()
Destructor deallocates no buffer space.
locale pubimbue(const locale &__loc)
Entry point for imbue().
char_type * gptr() const
Access to the get area.
virtual basic_streambuf< char_type, _Traits > * setbuf(char_type *, streamsize)
Manipulates the buffer.
virtual int sync()
Synchronizes the buffer arrays with the controlled sequences.
basic_streambuf< char_type, traits_type > __streambuf_type
This is a non-standard type.
virtual int_type overflow(int_type=traits_type::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...
int_type sungetc()
Moving backwards in the input stream.
virtual int_type pbackfail(int_type=traits_type::eof())
Tries to back up the input sequence.
char_type * egptr() const
Access to the get area.
Controlling output.This is the base class for all output streams. It provides text formatting of all ...
traits_type::off_type off_type
Provides input iterator semantics for streambufs.
char_type * pptr() const
Access to the put area.
int_type sgetc()
Getting the next character.
streamsize sputn(const char_type *__s, streamsize __n)
Entry point for all single-character output functions.
char_type * epptr() const
Access to the put area.
int pubsync()
Entry point for imbue().
basic_streambuf()
Base constructor.
virtual void imbue(const locale &)
Changes translations.
streamsize in_avail()
Looking ahead into the stream.
int_type sputc(char_type __c)
Entry point for all single-character output functions.
virtual int_type underflow()
Fetches more data from the controlled sequence.
pos_type pubseekpos(pos_type __sp, ios_base::openmode __mode=ios_base::in|ios_base::out)
Entry point for imbue().
char_type * eback() const
Access to the get area.
Container class for localization functionality.
Provides output iterator semantics for streambufs.
locale _M_buf_locale
Current locale setting.
locale getloc() const
Locale access.
void stossc()
Tosses a character.
virtual pos_type seekpos(pos_type, ios_base::openmode=ios_base::in|ios_base::out)
Alters the stream positions.
virtual int_type uflow()
Fetches more data from the controlled sequence.
virtual streamsize showmanyc()
Investigating the data available.
pos_type pubseekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode=ios_base::in|ios_base::out)
Entry point for imbue().
void setp(char_type *__pbeg, char_type *__pend)
Setting the three write area pointers.
void setg(char_type *__gbeg, char_type *__gnext, char_type *__gend)
Setting the three read area pointers.
int_type sputbackc(char_type __c)
Pushing characters back into the input stream.
Controlling input.This is the base class for all input streams. It provides text formatting of all bu...
char_type * _M_out_cur
Entry point for imbue().
traits_type::int_type int_type
streamsize sgetn(char_type *__s, streamsize __n)
Entry point for xsgetn.
int_type snextc()
Getting the next character.
Managing sequences of characters and character-like objects.
char_type * pbase() const
Access to the put area.