33 #ifndef _GLIBXX_STREAMBUF 34 #define _GLIBXX_STREAMBUF 1 36 #ifdef _GLIBCXX_SYSHDR 37 #pragma GCC system_header 49 namespace std _GLIBCXX_VISIBILITY(default)
51 _GLIBCXX_BEGIN_NAMESPACE_VERSION
53 #define _IsUnused __attribute__ ((__unused__)) 55 template<
typename _CharT,
typename _Traits>
57 __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>*,
58 basic_streambuf<_CharT, _Traits>*,
bool&);
125 template<
typename _CharT,
typename _Traits>
126 class basic_streambuf
147 friend class basic_ios<char_type, traits_type>;
156 template<
bool _IsMove,
typename _CharT2>
157 friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
162 template<
typename _CharT2>
163 friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
168 template<
typename _CharT2,
typename _Distance>
169 friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
175 template<
typename _CharT2,
typename _Traits2,
typename _Alloc>
180 template<
typename _CharT2,
typename _Traits2,
typename _Alloc>
222 _M_buf_locale = __loc;
249 {
return this->
setbuf(__s, __n); }
262 {
return this->
seekoff(__off, __way, __mode); }
274 {
return this->
seekpos(__sp, __mode); }
296 return __ret ? __ret : this->
showmanyc();
309 int_type __ret = traits_type::eof();
310 if (__builtin_expect(!traits_type::eq_int_type(this->
sbumpc(),
312 __ret = this->
sgetc();
328 if (__builtin_expect(this->
gptr() < this->
egptr(),
true))
330 __ret = traits_type::to_int_type(*this->
gptr());
334 __ret = this->
uflow();
350 if (__builtin_expect(this->
gptr() < this->
egptr(),
true))
351 __ret = traits_type::to_int_type(*this->
gptr());
367 {
return this->
xsgetn(__s, __n); }
384 const bool __testpos = this->
eback() < this->
gptr();
385 if (__builtin_expect(!__testpos ||
386 !traits_type::eq(__c, this->
gptr()[-1]),
false))
387 __ret = this->
pbackfail(traits_type::to_int_type(__c));
391 __ret = traits_type::to_int_type(*this->
gptr());
409 if (__builtin_expect(this->
eback() < this->
gptr(),
true))
412 __ret = traits_type::to_int_type(*this->
gptr());
436 if (__builtin_expect(this->
pptr() < this->
epptr(),
true))
440 __ret = traits_type::to_int_type(__c);
443 __ret = this->
overflow(traits_type::to_int_type(__c));
460 {
return this->
xsputn(__s, __n); }
473 : _M_in_beg(0), _M_in_cur(0), _M_in_end(0),
474 _M_out_beg(0), _M_out_cur(0), _M_out_end(0),
495 #pragma GCC diagnostic push 496 #pragma GCC diagnostic ignored "-Wnull-dereference" 511 gbump(
int __n) { _M_in_cur += __n; }
512 #pragma GCC diagnostic pop 523 setg(char_type* __gbeg, char_type* __gnext, char_type* __gend)
559 pbump(
int __n) { _M_out_cur += __n; }
569 setp(char_type* __pbeg, char_type* __pend)
571 _M_out_beg = _M_out_cur = __pbeg;
702 {
return traits_type::eof(); }
716 int_type __ret = traits_type::eof();
717 const bool __testeof = traits_type::eq_int_type(this->
underflow(),
721 __ret = traits_type::to_int_type(*this->
gptr());
739 {
return traits_type::eof(); }
782 overflow(int_type __c _IsUnused = traits_type::eof())
783 {
return traits_type::eof(); }
785 #if _GLIBCXX_USE_DEPRECATED && __cplusplus <= 201402L 796 _GLIBCXX_DEPRECATED_SUGGEST(
"std::basic_streambuf::sbumpc")
809 __safe_gbump(
streamsize __n) { _M_in_cur += __n; }
812 __safe_pbump(
streamsize __n) { _M_out_cur += __n; }
814 #if __cplusplus < 201103L 822 operator=(
const basic_streambuf&);
824 #if __cplusplus >= 201103L 826 swap(basic_streambuf& __sb)
828 std::swap(_M_in_beg, __sb._M_in_beg);
829 std::swap(_M_in_cur, __sb._M_in_cur);
830 std::swap(_M_in_end, __sb._M_in_end);
831 std::swap(_M_out_beg, __sb._M_out_beg);
832 std::swap(_M_out_cur, __sb._M_out_cur);
833 std::swap(_M_out_end, __sb._M_out_end);
834 std::swap(_M_buf_locale, __sb._M_buf_locale);
839 #if __cplusplus >= 201103L 840 template<
typename _CharT,
typename _Traits>
844 template<
typename _CharT,
typename _Traits>
847 operator=(
const basic_streambuf&) =
default;
855 #ifdef _GLIBCXX_USE_WCHAR_T 864 _GLIBCXX_END_NAMESPACE_VERSION
int pubsync()
Calls virtual sync function.
int_type snextc()
Getting the next character.
char_type * epptr() const
Access to the put area.
char_type * _M_out_end
End of put area.
char_type * egptr() const
Access to the get area.
streamsize sgetn(char_type *__s, streamsize __n)
Entry point for xsgetn.
char_type * eback() const
Access to the get area.
virtual int_type underflow()
Fetches more data from the controlled sequence.
char_type * _M_in_end
End of get area.
static const openmode in
Open for input. Default for ifstream and fstream.
virtual int_type uflow()
Fetches more data from the controlled sequence.
virtual streamsize xsputn(const char_type *__s, streamsize __n)
Multiple character insertion.
virtual void imbue(const locale &__loc)
Changes translations.
char_type * pbase() const
Access to the put area.
streamsize sputn(const char_type *__s, streamsize __n)
Entry point for all single-character output functions.
static const openmode out
Open for output. Default for ofstream and fstream.
locale getloc() const
Locale access.
virtual ~basic_streambuf()
Destructor deallocates no buffer space.
int_type sbumpc()
Getting the next character.
void gbump(int __n)
Moving the read position.
locale _M_buf_locale
Current locale setting.
virtual int_type overflow(int_type __c=traits_type::eof())
Consumes data from the buffer; writes to the controlled sequence.
virtual streamsize xsgetn(char_type *__s, streamsize __n)
Multiple character extraction.
streamsize in_avail()
Looking ahead into the stream.
basic_streambuf * pubsetbuf(char_type *__s, streamsize __n)
Entry points for derived buffer functions.
Template class basic_ostream.
basic_istream< _CharT, _Traits > & getline(basic_istream< _CharT, _Traits > &__is, basic_string< _CharT, _Traits, _Alloc > &__str, _CharT __delim)
Read a line from stream into a string.
traits_type::off_type off_type
int_type sungetc()
Moving backwards in the input stream.
ISO C++ entities toplevel namespace is std.
virtual int_type pbackfail(int_type __c=traits_type::eof())
Tries to back up the input sequence.
Container class for localization functionality.The locale class is first a class wrapper for C librar...
char_type * _M_in_cur
Current read area.
void pbump(int __n)
Moving the write position.
char_type * _M_out_cur
Current put area.
void setg(char_type *__gbeg, char_type *__gnext, char_type *__gend)
Setting the three read area pointers.
traits_type::int_type int_type
Template class basic_ios, virtual base class for all stream classes.
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
virtual pos_type seekoff(off_type, ios_base::seekdir, ios_base::openmode=ios_base::in|ios_base::out)
Alters the stream positions.
char_type * _M_in_beg
Start of get area.
locale pubimbue(const locale &__loc)
Entry point for imbue().
void setp(char_type *__pbeg, char_type *__pend)
Setting the three write area pointers.
int_type sgetc()
Getting the next character.
Template class basic_istream.
virtual int sync()
Synchronizes the buffer arrays with the controlled sequences.
virtual streamsize showmanyc()
Investigating the data available.
basic_streambuf< char_type, traits_type > __streambuf_type
This is a non-standard type.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
Provides output iterator semantics for streambufs.
char_type * _M_out_beg
Start of put area.
char_type * pptr() const
Access to the put area.
pos_type pubseekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode=ios_base::in|ios_base::out)
Alters the stream position.
int_type sputc(char_type __c)
Entry point for all single-character output functions.
The actual work of input and output (interface).
virtual basic_streambuf< char_type, _Traits > * setbuf(char_type *, streamsize)
Manipulates the buffer.
pos_type pubseekpos(pos_type __sp, ios_base::openmode __mode=ios_base::in|ios_base::out)
Alters the stream position.
Provides input iterator semantics for streambufs.
virtual pos_type seekpos(pos_type, ios_base::openmode=ios_base::in|ios_base::out)
Alters the stream positions.
basic_streambuf()
Base constructor.
Managing sequences of characters and character-like objects.
int_type sputbackc(char_type __c)
Pushing characters back into the input stream.
char_type * gptr() const
Access to the get area.