33 #ifndef _GLIBXX_STREAMBUF 34 #define _GLIBXX_STREAMBUF 1 36 #pragma GCC system_header 45 namespace std _GLIBCXX_VISIBILITY(default)
47 _GLIBCXX_BEGIN_NAMESPACE_VERSION
49 #define _IsUnused __attribute__ ((__unused__)) 51 template<
typename _CharT,
typename _Traits>
53 __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>*,
54 basic_streambuf<_CharT, _Traits>*,
bool&);
121 template<
typename _CharT,
typename _Traits>
122 class basic_streambuf
143 friend class basic_ios<char_type, traits_type>;
152 template<
bool _IsMove,
typename _CharT2>
153 friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
158 template<
typename _CharT2>
159 friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
164 template<
typename _CharT2,
typename _Distance>
165 friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
169 template<
typename _CharT2,
typename _Traits2>
173 template<
typename _CharT2,
typename _Traits2,
typename _Alloc>
178 template<
typename _CharT2,
typename _Traits2,
typename _Alloc>
220 _M_buf_locale = __loc;
247 {
return this->
setbuf(__s, __n); }
260 {
return this->
seekoff(__off, __way, __mode); }
272 {
return this->
seekpos(__sp, __mode); }
294 return __ret ? __ret : this->
showmanyc();
307 int_type __ret = traits_type::eof();
308 if (__builtin_expect(!traits_type::eq_int_type(this->
sbumpc(),
310 __ret = this->
sgetc();
326 if (__builtin_expect(this->
gptr() < this->
egptr(),
true))
328 __ret = traits_type::to_int_type(*this->
gptr());
332 __ret = this->
uflow();
348 if (__builtin_expect(this->
gptr() < this->
egptr(),
true))
349 __ret = traits_type::to_int_type(*this->
gptr());
365 {
return this->
xsgetn(__s, __n); }
382 const bool __testpos = this->
eback() < this->
gptr();
383 if (__builtin_expect(!__testpos ||
384 !traits_type::eq(__c, this->
gptr()[-1]),
false))
385 __ret = this->
pbackfail(traits_type::to_int_type(__c));
389 __ret = traits_type::to_int_type(*this->
gptr());
407 if (__builtin_expect(this->
eback() < this->
gptr(),
true))
410 __ret = traits_type::to_int_type(*this->
gptr());
434 if (__builtin_expect(this->
pptr() < this->
epptr(),
true))
438 __ret = traits_type::to_int_type(__c);
441 __ret = this->
overflow(traits_type::to_int_type(__c));
458 {
return this->
xsputn(__s, __n); }
471 : _M_in_beg(0), _M_in_cur(0), _M_in_end(0),
472 _M_out_beg(0), _M_out_cur(0), _M_out_end(0),
505 gbump(
int __n) { _M_in_cur += __n; }
516 setg(char_type* __gbeg, char_type* __gnext, char_type* __gend)
552 pbump(
int __n) { _M_out_cur += __n; }
562 setp(char_type* __pbeg, char_type* __pend)
564 _M_out_beg = _M_out_cur = __pbeg;
695 {
return traits_type::eof(); }
709 int_type __ret = traits_type::eof();
710 const bool __testeof = traits_type::eq_int_type(this->
underflow(),
714 __ret = traits_type::to_int_type(*this->
gptr());
732 {
return traits_type::eof(); }
775 overflow(int_type __c _IsUnused = traits_type::eof())
776 {
return traits_type::eof(); }
778 #if _GLIBCXX_USE_DEPRECATED && __cplusplus <= 201402L 789 #if __cplusplus >= 201103L 790 [[__deprecated__(
"stossc is deprecated, use sbumpc instead")]]
804 __safe_gbump(
streamsize __n) { _M_in_cur += __n; }
807 __safe_pbump(
streamsize __n) { _M_out_cur += __n; }
809 #if __cplusplus < 201103L 817 operator=(
const basic_streambuf&);
819 #if __cplusplus >= 201103L 821 swap(basic_streambuf& __sb)
823 std::swap(_M_in_beg, __sb._M_in_beg);
824 std::swap(_M_in_cur, __sb._M_in_cur);
825 std::swap(_M_in_end, __sb._M_in_end);
826 std::swap(_M_out_beg, __sb._M_out_beg);
827 std::swap(_M_out_cur, __sb._M_out_cur);
828 std::swap(_M_out_end, __sb._M_out_end);
829 std::swap(_M_buf_locale, __sb._M_buf_locale);
834 #if __cplusplus >= 201103L 835 template<
typename _CharT,
typename _Traits>
839 template<
typename _CharT,
typename _Traits>
842 operator=(
const basic_streambuf&) =
default;
850 #ifdef _GLIBCXX_USE_WCHAR_T 859 _GLIBCXX_END_NAMESPACE_VERSION
void gbump(int __n)
Moving the read position.
virtual streamsize xsputn(const char_type *__s, streamsize __n)
Multiple character insertion.
int_type snextc()
Getting the next character.
Template class basic_istream.
virtual streamsize xsgetn(char_type *__s, streamsize __n)
Multiple character extraction.
char_type * _M_out_beg
Start of put area.
basic_streambuf * pubsetbuf(char_type *__s, streamsize __n)
Entry points for derived buffer functions.
traits_type::off_type off_type
char_type * _M_in_end
End of get area.
void setg(char_type *__gbeg, char_type *__gnext, char_type *__gend)
Setting the three read area pointers.
virtual int_type underflow()
Fetches more data from the controlled sequence.
virtual streamsize showmanyc()
Investigating the data available.
virtual int_type pbackfail(int_type __c __attribute__((__unused__))=traits_type::eof())
Tries to back up the input sequence.
int pubsync()
Calls virtual sync function.
locale getloc() const
Locale access.
pos_type pubseekpos(pos_type __sp, ios_base::openmode __mode=ios_base::in|ios_base::out)
Alters the stream position.
char_type * _M_in_cur
Current read area.
ISO C++ entities toplevel namespace is std.
char_type * gptr() const
Access to the get area.
virtual basic_streambuf< char_type, _Traits > * setbuf(char_type *, streamsize)
Manipulates the buffer.
int_type sungetc()
Moving backwards in the input stream.
streamsize sgetn(char_type *__s, streamsize __n)
Entry point for xsgetn.
int_type sgetc()
Getting the next character.
Managing sequences of characters and character-like objects.
char_type * pbase() const
Access to the put area.
The actual work of input and output (interface).
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.
static const openmode in
Open for input. Default for ifstream and fstream.
streamsize sputn(const char_type *__s, streamsize __n)
Entry point for all single-character output functions.
char_type * pptr() const
Access to the put area.
int_type sputc(char_type __c)
Entry point for all single-character output functions.
pos_type pubseekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode=ios_base::in|ios_base::out)
Alters the stream position.
char_type * _M_out_end
End of put area.
locale _M_buf_locale
Current locale setting.
Provides input iterator semantics for streambufs.
char_type * _M_out_cur
Current put area.
Template class basic_ostream.
traits_type::int_type int_type
Template class basic_ios, virtual base class for all stream classes.
char_type * epptr() const
Access to the put area.
int_type sputbackc(char_type __c)
Pushing characters back into the input stream.
void pbump(int __n)
Moving the write position.
char_type * egptr() const
Access to the get area.
virtual void imbue(const locale &__loc __attribute__((__unused__)))
Changes translations.
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, bitset< _Nb > &__x)
Global I/O operators for bitsets.
_GLIBCXX17_CONSTEXPR void advance(_InputIterator &__i, _Distance __n)
A generalization of pointer arithmetic.
basic_streambuf< char_type, traits_type > __streambuf_type
This is a non-standard type.
char_type * _M_in_beg
Start of get area.
Provides output iterator semantics for streambufs.
char_type * eback() const
Access to the get area.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
virtual int sync()
Synchronizes the buffer arrays with the controlled sequences.
virtual int_type uflow()
Fetches more data from the controlled sequence.
locale pubimbue(const locale &__loc)
Entry point for imbue().
void setp(char_type *__pbeg, char_type *__pend)
Setting the three write area pointers.
virtual int_type overflow(int_type __c __attribute__((__unused__))=traits_type::eof())
Consumes data from the buffer; writes to the controlled sequence.
int_type sbumpc()
Getting the next character.
traits_type::pos_type pos_type
virtual pos_type seekpos(pos_type, ios_base::openmode=ios_base::in|ios_base::out)
Alters the stream positions.
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.
streamsize in_avail()
Looking ahead into the stream.
virtual ~basic_streambuf()
Destructor deallocates no buffer space.
static const openmode out
Open for output. Default for ofstream and fstream.
basic_streambuf()
Base constructor.