34 #ifndef _GLIBXX_STREAMBUF
35 #define _GLIBXX_STREAMBUF 1
37 #pragma GCC system_header
46 namespace std _GLIBCXX_VISIBILITY(default)
48 _GLIBCXX_BEGIN_NAMESPACE_VERSION
50 template<
typename _CharT,
typename _Traits>
52 __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>*,
53 basic_streambuf<_CharT, _Traits>*,
bool&);
116 template<
typename _CharT,
typename _Traits>
117 class basic_streambuf
147 template<
bool _IsMove,
typename _CharT2>
148 friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
153 template<
typename _CharT2>
154 friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
159 template<
typename _CharT2,
typename _Traits2>
163 template<
typename _CharT2,
typename _Traits2,
typename _Alloc>
168 template<
typename _CharT2,
typename _Traits2,
typename _Alloc>
237 {
return this->
setbuf(__s, __n); }
242 {
return this->
seekoff(__off, __way, __mode); }
247 {
return this->
seekpos(__sp, __mode); }
266 return __ret ? __ret : this->
showmanyc();
279 int_type __ret = traits_type::eof();
280 if (__builtin_expect(!traits_type::eq_int_type(this->
sbumpc(),
282 __ret = this->
sgetc();
298 if (__builtin_expect(this->
gptr() < this->
egptr(),
true))
300 __ret = traits_type::to_int_type(*this->
gptr());
304 __ret = this->
uflow();
320 if (__builtin_expect(this->
gptr() < this->
egptr(),
true))
321 __ret = traits_type::to_int_type(*this->
gptr());
337 {
return this->
xsgetn(__s, __n); }
354 const bool __testpos = this->
eback() < this->
gptr();
355 if (__builtin_expect(!__testpos ||
356 !traits_type::eq(__c, this->
gptr()[-1]),
false))
357 __ret = this->
pbackfail(traits_type::to_int_type(__c));
361 __ret = traits_type::to_int_type(*this->
gptr());
379 if (__builtin_expect(this->
eback() < this->
gptr(),
true))
382 __ret = traits_type::to_int_type(*this->
gptr());
406 if (__builtin_expect(this->
pptr() < this->
epptr(),
true))
410 __ret = traits_type::to_int_type(__c);
413 __ret = this->
overflow(traits_type::to_int_type(__c));
430 {
return this->
xsputn(__s, __n); }
443 : _M_in_beg(0), _M_in_cur(0), _M_in_end(0),
444 _M_out_beg(0), _M_out_cur(0), _M_out_end(0),
464 gptr()
const {
return _M_in_cur; }
477 gbump(
int __n) { _M_in_cur += __n; }
508 pbase()
const {
return _M_out_beg; }
511 pptr()
const {
return _M_out_cur; }
514 epptr()
const {
return _M_out_end; }
524 pbump(
int __n) { _M_out_cur += __n; }
536 _M_out_beg = _M_out_cur = __pbeg;
667 {
return traits_type::eof(); }
681 int_type __ret = traits_type::eof();
682 const bool __testeof = traits_type::eq_int_type(this->
underflow(),
686 __ret = traits_type::to_int_type(*this->
gptr());
704 {
return traits_type::eof(); }
748 {
return traits_type::eof(); }
750 #if _GLIBCXX_USE_DEPRECATED
773 __safe_gbump(
streamsize __n) { _M_in_cur += __n; }
776 __safe_pbump(
streamsize __n) { _M_out_cur += __n; }
782 : _M_in_beg(__sb._M_in_beg), _M_in_cur(__sb._M_in_cur),
783 _M_in_end(__sb._M_in_end), _M_out_beg(__sb._M_out_beg),
784 _M_out_cur(__sb._M_out_cur), _M_out_end(__sb._M_out_cur),
795 __copy_streambufs_eof(basic_streambuf<char>* __sbin,
796 basic_streambuf<char>* __sbout,
bool& __ineof);
797 #ifdef _GLIBCXX_USE_WCHAR_T
800 __copy_streambufs_eof(basic_streambuf<wchar_t>* __sbin,
801 basic_streambuf<wchar_t>* __sbout,
bool& __ineof);
804 _GLIBCXX_END_NAMESPACE_VERSION
int pubsync()
Entry points for derived buffer functions.
21.1.3.1 char_traits specializations
char_type * eback() const
Access to the get area.
pos_type pubseekpos(pos_type __sp, ios_base::openmode __mode=ios_base::in|ios_base::out)
Entry points for derived buffer functions.
char_type * pbase() const
Access to the put area.
locale getloc() const
Locale access.
basic_streambuf< char_type, traits_type > __streambuf_type
This is a non-standard type.
Controlling output.This is the base class for all output streams. It provides text formatting of all ...
int_type sgetc()
Getting the next character.
virtual int_type overflow(int_type=traits_type::eof())
Consumes data from the buffer; writes to the controlled sequence.
virtual streamsize xsgetn(char_type *__s, streamsize __n)
Multiple character extraction.
virtual int_type pbackfail(int_type=traits_type::eof())
Tries to back up the input sequence.
int_type sputc(char_type __c)
Entry point for all single-character output functions.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
virtual int_type underflow()
Fetches more data from the controlled sequence.
basic_streambuf()
Base constructor.
int_type sungetc()
Moving backwards in the input stream.
traits_type::off_type off_type
virtual pos_type seekpos(pos_type, ios_base::openmode=ios_base::in|ios_base::out)
Alters the stream positions.
bitset< _Nb > operator>>(size_t __position) const
Self-explanatory.
virtual streamsize showmanyc()
Investigating the data available.
Class representing stream positions.
pos_type pubseekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode=ios_base::in|ios_base::out)
Entry points for derived buffer functions.
Controlling input.This is the base class for all input streams. It provides text formatting of all bu...
void setg(char_type *__gbeg, char_type *__gnext, char_type *__gend)
Setting the three read area pointers.
Provides input iterator semantics for streambufs.
streamsize sputn(const char_type *__s, streamsize __n)
Entry point for all single-character output functions.
virtual streamsize xsputn(const char_type *__s, streamsize __n)
Multiple character insertion.
Container class for localization functionality.The locale class is first a class wrapper for C librar...
virtual pos_type seekoff(off_type, ios_base::seekdir, ios_base::openmode=ios_base::in|ios_base::out)
Alters the stream positions.
void pbump(int __n)
Moving the write position.
virtual ~basic_streambuf()
Destructor deallocates no buffer space.
int_type sputbackc(char_type __c)
Pushing characters back into the input stream.
char_type * egptr() const
Access to the get area.
static const openmode in
Open for input. Default for ifstream and fstream.
Managing sequences of characters and character-like objects.
virtual void imbue(const locale &)
Changes translations.
char_type * gptr() const
Access to the get area.
virtual int_type uflow()
Fetches more data from the controlled sequence.
__streambuf_type * pubsetbuf(char_type *__s, streamsize __n)
Entry points for derived buffer functions.
virtual int sync()
Synchronizes the buffer arrays with the controlled sequences.
Provides output iterator semantics for streambufs.
traits_type::int_type int_type
static const openmode out
Open for output. Default for ofstream and fstream.
The actual work of input and output (interface).This is a base class. Derived stream buffers each con...
void setp(char_type *__pbeg, char_type *__pend)
Setting the three write area pointers.
locale _M_buf_locale
Current locale setting.
virtual basic_streambuf< char_type, _Traits > * setbuf(char_type *, streamsize)
Manipulates the buffer.
int_type sbumpc()
Getting the next character.
char_type * pptr() const
Access to the put area.
Virtual base class for all stream classes.Most of the member functions called dispatched on stream ob...
void gbump(int __n)
Moving the read position.
int_type snextc()
Getting the next character.
streamsize sgetn(char_type *__s, streamsize __n)
Entry point for xsgetn.
char_type * epptr() const
Access to the put area.
streamsize in_avail()
Looking ahead into the stream.
traits_type::pos_type pos_type
locale pubimbue(const locale &__loc)
Entry point for imbue().