1*58b9f456SAndroid Build Coastguard Worker// -*- C++ -*- 2*58b9f456SAndroid Build Coastguard Worker//===------------------------- streambuf ----------------------------------===// 3*58b9f456SAndroid Build Coastguard Worker// 4*58b9f456SAndroid Build Coastguard Worker// The LLVM Compiler Infrastructure 5*58b9f456SAndroid Build Coastguard Worker// 6*58b9f456SAndroid Build Coastguard Worker// This file is dual licensed under the MIT and the University of Illinois Open 7*58b9f456SAndroid Build Coastguard Worker// Source Licenses. See LICENSE.TXT for details. 8*58b9f456SAndroid Build Coastguard Worker// 9*58b9f456SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===// 10*58b9f456SAndroid Build Coastguard Worker 11*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_STEAMBUF 12*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_STEAMBUF 13*58b9f456SAndroid Build Coastguard Worker 14*58b9f456SAndroid Build Coastguard Worker/* 15*58b9f456SAndroid Build Coastguard Worker streambuf synopsis 16*58b9f456SAndroid Build Coastguard Worker 17*58b9f456SAndroid Build Coastguard Workernamespace std 18*58b9f456SAndroid Build Coastguard Worker{ 19*58b9f456SAndroid Build Coastguard Worker 20*58b9f456SAndroid Build Coastguard Workertemplate <class charT, class traits = char_traits<charT> > 21*58b9f456SAndroid Build Coastguard Workerclass basic_streambuf 22*58b9f456SAndroid Build Coastguard Worker{ 23*58b9f456SAndroid Build Coastguard Workerpublic: 24*58b9f456SAndroid Build Coastguard Worker // types: 25*58b9f456SAndroid Build Coastguard Worker typedef charT char_type; 26*58b9f456SAndroid Build Coastguard Worker typedef traits traits_type; 27*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::int_type int_type; 28*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::pos_type pos_type; 29*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::off_type off_type; 30*58b9f456SAndroid Build Coastguard Worker 31*58b9f456SAndroid Build Coastguard Worker virtual ~basic_streambuf(); 32*58b9f456SAndroid Build Coastguard Worker 33*58b9f456SAndroid Build Coastguard Worker // 27.6.2.2.1 locales: 34*58b9f456SAndroid Build Coastguard Worker locale pubimbue(const locale& loc); 35*58b9f456SAndroid Build Coastguard Worker locale getloc() const; 36*58b9f456SAndroid Build Coastguard Worker 37*58b9f456SAndroid Build Coastguard Worker // 27.6.2.2.2 buffer and positioning: 38*58b9f456SAndroid Build Coastguard Worker basic_streambuf* pubsetbuf(char_type* s, streamsize n); 39*58b9f456SAndroid Build Coastguard Worker pos_type pubseekoff(off_type off, ios_base::seekdir way, 40*58b9f456SAndroid Build Coastguard Worker ios_base::openmode which = ios_base::in | ios_base::out); 41*58b9f456SAndroid Build Coastguard Worker pos_type pubseekpos(pos_type sp, 42*58b9f456SAndroid Build Coastguard Worker ios_base::openmode which = ios_base::in | ios_base::out); 43*58b9f456SAndroid Build Coastguard Worker int pubsync(); 44*58b9f456SAndroid Build Coastguard Worker 45*58b9f456SAndroid Build Coastguard Worker // Get and put areas: 46*58b9f456SAndroid Build Coastguard Worker // 27.6.2.2.3 Get area: 47*58b9f456SAndroid Build Coastguard Worker streamsize in_avail(); 48*58b9f456SAndroid Build Coastguard Worker int_type snextc(); 49*58b9f456SAndroid Build Coastguard Worker int_type sbumpc(); 50*58b9f456SAndroid Build Coastguard Worker int_type sgetc(); 51*58b9f456SAndroid Build Coastguard Worker streamsize sgetn(char_type* s, streamsize n); 52*58b9f456SAndroid Build Coastguard Worker 53*58b9f456SAndroid Build Coastguard Worker // 27.6.2.2.4 Putback: 54*58b9f456SAndroid Build Coastguard Worker int_type sputbackc(char_type c); 55*58b9f456SAndroid Build Coastguard Worker int_type sungetc(); 56*58b9f456SAndroid Build Coastguard Worker 57*58b9f456SAndroid Build Coastguard Worker // 27.6.2.2.5 Put area: 58*58b9f456SAndroid Build Coastguard Worker int_type sputc(char_type c); 59*58b9f456SAndroid Build Coastguard Worker streamsize sputn(const char_type* s, streamsize n); 60*58b9f456SAndroid Build Coastguard Worker 61*58b9f456SAndroid Build Coastguard Workerprotected: 62*58b9f456SAndroid Build Coastguard Worker basic_streambuf(); 63*58b9f456SAndroid Build Coastguard Worker basic_streambuf(const basic_streambuf& rhs); 64*58b9f456SAndroid Build Coastguard Worker basic_streambuf& operator=(const basic_streambuf& rhs); 65*58b9f456SAndroid Build Coastguard Worker void swap(basic_streambuf& rhs); 66*58b9f456SAndroid Build Coastguard Worker 67*58b9f456SAndroid Build Coastguard Worker // 27.6.2.3.2 Get area: 68*58b9f456SAndroid Build Coastguard Worker char_type* eback() const; 69*58b9f456SAndroid Build Coastguard Worker char_type* gptr() const; 70*58b9f456SAndroid Build Coastguard Worker char_type* egptr() const; 71*58b9f456SAndroid Build Coastguard Worker void gbump(int n); 72*58b9f456SAndroid Build Coastguard Worker void setg(char_type* gbeg, char_type* gnext, char_type* gend); 73*58b9f456SAndroid Build Coastguard Worker 74*58b9f456SAndroid Build Coastguard Worker // 27.6.2.3.3 Put area: 75*58b9f456SAndroid Build Coastguard Worker char_type* pbase() const; 76*58b9f456SAndroid Build Coastguard Worker char_type* pptr() const; 77*58b9f456SAndroid Build Coastguard Worker char_type* epptr() const; 78*58b9f456SAndroid Build Coastguard Worker void pbump(int n); 79*58b9f456SAndroid Build Coastguard Worker void setp(char_type* pbeg, char_type* pend); 80*58b9f456SAndroid Build Coastguard Worker 81*58b9f456SAndroid Build Coastguard Worker // 27.6.2.4 virtual functions: 82*58b9f456SAndroid Build Coastguard Worker // 27.6.2.4.1 Locales: 83*58b9f456SAndroid Build Coastguard Worker virtual void imbue(const locale& loc); 84*58b9f456SAndroid Build Coastguard Worker 85*58b9f456SAndroid Build Coastguard Worker // 27.6.2.4.2 Buffer management and positioning: 86*58b9f456SAndroid Build Coastguard Worker virtual basic_streambuf* setbuf(char_type* s, streamsize n); 87*58b9f456SAndroid Build Coastguard Worker virtual pos_type seekoff(off_type off, ios_base::seekdir way, 88*58b9f456SAndroid Build Coastguard Worker ios_base::openmode which = ios_base::in | ios_base::out); 89*58b9f456SAndroid Build Coastguard Worker virtual pos_type seekpos(pos_type sp, 90*58b9f456SAndroid Build Coastguard Worker ios_base::openmode which = ios_base::in | ios_base::out); 91*58b9f456SAndroid Build Coastguard Worker virtual int sync(); 92*58b9f456SAndroid Build Coastguard Worker 93*58b9f456SAndroid Build Coastguard Worker // 27.6.2.4.3 Get area: 94*58b9f456SAndroid Build Coastguard Worker virtual streamsize showmanyc(); 95*58b9f456SAndroid Build Coastguard Worker virtual streamsize xsgetn(char_type* s, streamsize n); 96*58b9f456SAndroid Build Coastguard Worker virtual int_type underflow(); 97*58b9f456SAndroid Build Coastguard Worker virtual int_type uflow(); 98*58b9f456SAndroid Build Coastguard Worker 99*58b9f456SAndroid Build Coastguard Worker // 27.6.2.4.4 Putback: 100*58b9f456SAndroid Build Coastguard Worker virtual int_type pbackfail(int_type c = traits_type::eof()); 101*58b9f456SAndroid Build Coastguard Worker 102*58b9f456SAndroid Build Coastguard Worker // 27.6.2.4.5 Put area: 103*58b9f456SAndroid Build Coastguard Worker virtual streamsize xsputn(const char_type* s, streamsize n); 104*58b9f456SAndroid Build Coastguard Worker virtual int_type overflow (int_type c = traits_type::eof()); 105*58b9f456SAndroid Build Coastguard Worker}; 106*58b9f456SAndroid Build Coastguard Worker 107*58b9f456SAndroid Build Coastguard Worker} // std 108*58b9f456SAndroid Build Coastguard Worker 109*58b9f456SAndroid Build Coastguard Worker*/ 110*58b9f456SAndroid Build Coastguard Worker 111*58b9f456SAndroid Build Coastguard Worker#include <__config> 112*58b9f456SAndroid Build Coastguard Worker#include <iosfwd> 113*58b9f456SAndroid Build Coastguard Worker#include <ios> 114*58b9f456SAndroid Build Coastguard Worker 115*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 116*58b9f456SAndroid Build Coastguard Worker#pragma GCC system_header 117*58b9f456SAndroid Build Coastguard Worker#endif 118*58b9f456SAndroid Build Coastguard Worker 119*58b9f456SAndroid Build Coastguard Worker_LIBCPP_PUSH_MACROS 120*58b9f456SAndroid Build Coastguard Worker#include <__undef_macros> 121*58b9f456SAndroid Build Coastguard Worker 122*58b9f456SAndroid Build Coastguard Worker_LIBCPP_BEGIN_NAMESPACE_STD 123*58b9f456SAndroid Build Coastguard Worker 124*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits> 125*58b9f456SAndroid Build Coastguard Workerclass _LIBCPP_TEMPLATE_VIS basic_streambuf 126*58b9f456SAndroid Build Coastguard Worker{ 127*58b9f456SAndroid Build Coastguard Workerpublic: 128*58b9f456SAndroid Build Coastguard Worker // types: 129*58b9f456SAndroid Build Coastguard Worker typedef _CharT char_type; 130*58b9f456SAndroid Build Coastguard Worker typedef _Traits traits_type; 131*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::int_type int_type; 132*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::pos_type pos_type; 133*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::off_type off_type; 134*58b9f456SAndroid Build Coastguard Worker 135*58b9f456SAndroid Build Coastguard Worker static_assert((is_same<_CharT, typename traits_type::char_type>::value), 136*58b9f456SAndroid Build Coastguard Worker "traits_type::char_type must be the same type as CharT"); 137*58b9f456SAndroid Build Coastguard Worker 138*58b9f456SAndroid Build Coastguard Worker virtual ~basic_streambuf(); 139*58b9f456SAndroid Build Coastguard Worker 140*58b9f456SAndroid Build Coastguard Worker // 27.6.2.2.1 locales: 141*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 142*58b9f456SAndroid Build Coastguard Worker locale pubimbue(const locale& __loc) { 143*58b9f456SAndroid Build Coastguard Worker imbue(__loc); 144*58b9f456SAndroid Build Coastguard Worker locale __r = __loc_; 145*58b9f456SAndroid Build Coastguard Worker __loc_ = __loc; 146*58b9f456SAndroid Build Coastguard Worker return __r; 147*58b9f456SAndroid Build Coastguard Worker } 148*58b9f456SAndroid Build Coastguard Worker 149*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 150*58b9f456SAndroid Build Coastguard Worker locale getloc() const { return __loc_; } 151*58b9f456SAndroid Build Coastguard Worker 152*58b9f456SAndroid Build Coastguard Worker // 27.6.2.2.2 buffer and positioning: 153*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 154*58b9f456SAndroid Build Coastguard Worker basic_streambuf* pubsetbuf(char_type* __s, streamsize __n) 155*58b9f456SAndroid Build Coastguard Worker { return setbuf(__s, __n); } 156*58b9f456SAndroid Build Coastguard Worker 157*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 158*58b9f456SAndroid Build Coastguard Worker pos_type pubseekoff(off_type __off, ios_base::seekdir __way, 159*58b9f456SAndroid Build Coastguard Worker ios_base::openmode __which = ios_base::in | ios_base::out) 160*58b9f456SAndroid Build Coastguard Worker { return seekoff(__off, __way, __which); } 161*58b9f456SAndroid Build Coastguard Worker 162*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 163*58b9f456SAndroid Build Coastguard Worker pos_type pubseekpos(pos_type __sp, 164*58b9f456SAndroid Build Coastguard Worker ios_base::openmode __which = ios_base::in | ios_base::out) 165*58b9f456SAndroid Build Coastguard Worker { return seekpos(__sp, __which); } 166*58b9f456SAndroid Build Coastguard Worker 167*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 168*58b9f456SAndroid Build Coastguard Worker int pubsync() { return sync(); } 169*58b9f456SAndroid Build Coastguard Worker 170*58b9f456SAndroid Build Coastguard Worker // Get and put areas: 171*58b9f456SAndroid Build Coastguard Worker // 27.6.2.2.3 Get area: 172*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 173*58b9f456SAndroid Build Coastguard Worker streamsize in_avail() { 174*58b9f456SAndroid Build Coastguard Worker if (__ninp_ < __einp_) 175*58b9f456SAndroid Build Coastguard Worker return static_cast<streamsize>(__einp_ - __ninp_); 176*58b9f456SAndroid Build Coastguard Worker return showmanyc(); 177*58b9f456SAndroid Build Coastguard Worker } 178*58b9f456SAndroid Build Coastguard Worker 179*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 180*58b9f456SAndroid Build Coastguard Worker int_type snextc() { 181*58b9f456SAndroid Build Coastguard Worker if (sbumpc() == traits_type::eof()) 182*58b9f456SAndroid Build Coastguard Worker return traits_type::eof(); 183*58b9f456SAndroid Build Coastguard Worker return sgetc(); 184*58b9f456SAndroid Build Coastguard Worker } 185*58b9f456SAndroid Build Coastguard Worker 186*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 187*58b9f456SAndroid Build Coastguard Worker int_type sbumpc() { 188*58b9f456SAndroid Build Coastguard Worker if (__ninp_ == __einp_) 189*58b9f456SAndroid Build Coastguard Worker return uflow(); 190*58b9f456SAndroid Build Coastguard Worker return traits_type::to_int_type(*__ninp_++); 191*58b9f456SAndroid Build Coastguard Worker } 192*58b9f456SAndroid Build Coastguard Worker 193*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 194*58b9f456SAndroid Build Coastguard Worker int_type sgetc() { 195*58b9f456SAndroid Build Coastguard Worker if (__ninp_ == __einp_) 196*58b9f456SAndroid Build Coastguard Worker return underflow(); 197*58b9f456SAndroid Build Coastguard Worker return traits_type::to_int_type(*__ninp_); 198*58b9f456SAndroid Build Coastguard Worker } 199*58b9f456SAndroid Build Coastguard Worker 200*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 201*58b9f456SAndroid Build Coastguard Worker streamsize sgetn(char_type* __s, streamsize __n) 202*58b9f456SAndroid Build Coastguard Worker { return xsgetn(__s, __n); } 203*58b9f456SAndroid Build Coastguard Worker 204*58b9f456SAndroid Build Coastguard Worker // 27.6.2.2.4 Putback: 205*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 206*58b9f456SAndroid Build Coastguard Worker int_type sputbackc(char_type __c) { 207*58b9f456SAndroid Build Coastguard Worker if (__binp_ == __ninp_ || !traits_type::eq(__c, __ninp_[-1])) 208*58b9f456SAndroid Build Coastguard Worker return pbackfail(traits_type::to_int_type(__c)); 209*58b9f456SAndroid Build Coastguard Worker return traits_type::to_int_type(*--__ninp_); 210*58b9f456SAndroid Build Coastguard Worker } 211*58b9f456SAndroid Build Coastguard Worker 212*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 213*58b9f456SAndroid Build Coastguard Worker int_type sungetc() { 214*58b9f456SAndroid Build Coastguard Worker if (__binp_ == __ninp_) 215*58b9f456SAndroid Build Coastguard Worker return pbackfail(); 216*58b9f456SAndroid Build Coastguard Worker return traits_type::to_int_type(*--__ninp_); 217*58b9f456SAndroid Build Coastguard Worker } 218*58b9f456SAndroid Build Coastguard Worker 219*58b9f456SAndroid Build Coastguard Worker // 27.6.2.2.5 Put area: 220*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 221*58b9f456SAndroid Build Coastguard Worker int_type sputc(char_type __c) { 222*58b9f456SAndroid Build Coastguard Worker if (__nout_ == __eout_) 223*58b9f456SAndroid Build Coastguard Worker return overflow(traits_type::to_int_type(__c)); 224*58b9f456SAndroid Build Coastguard Worker *__nout_++ = __c; 225*58b9f456SAndroid Build Coastguard Worker return traits_type::to_int_type(__c); 226*58b9f456SAndroid Build Coastguard Worker } 227*58b9f456SAndroid Build Coastguard Worker 228*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 229*58b9f456SAndroid Build Coastguard Worker streamsize sputn(const char_type* __s, streamsize __n) 230*58b9f456SAndroid Build Coastguard Worker { return xsputn(__s, __n); } 231*58b9f456SAndroid Build Coastguard Worker 232*58b9f456SAndroid Build Coastguard Workerprotected: 233*58b9f456SAndroid Build Coastguard Worker basic_streambuf(); 234*58b9f456SAndroid Build Coastguard Worker basic_streambuf(const basic_streambuf& __rhs); 235*58b9f456SAndroid Build Coastguard Worker basic_streambuf& operator=(const basic_streambuf& __rhs); 236*58b9f456SAndroid Build Coastguard Worker void swap(basic_streambuf& __rhs); 237*58b9f456SAndroid Build Coastguard Worker 238*58b9f456SAndroid Build Coastguard Worker // 27.6.2.3.2 Get area: 239*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY char_type* eback() const {return __binp_;} 240*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY char_type* gptr() const {return __ninp_;} 241*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY char_type* egptr() const {return __einp_;} 242*58b9f456SAndroid Build Coastguard Worker 243*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 244*58b9f456SAndroid Build Coastguard Worker void gbump(int __n) { __ninp_ += __n; } 245*58b9f456SAndroid Build Coastguard Worker 246*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 247*58b9f456SAndroid Build Coastguard Worker void setg(char_type* __gbeg, char_type* __gnext, char_type* __gend) { 248*58b9f456SAndroid Build Coastguard Worker __binp_ = __gbeg; 249*58b9f456SAndroid Build Coastguard Worker __ninp_ = __gnext; 250*58b9f456SAndroid Build Coastguard Worker __einp_ = __gend; 251*58b9f456SAndroid Build Coastguard Worker } 252*58b9f456SAndroid Build Coastguard Worker 253*58b9f456SAndroid Build Coastguard Worker // 27.6.2.3.3 Put area: 254*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY char_type* pbase() const {return __bout_;} 255*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY char_type* pptr() const {return __nout_;} 256*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY char_type* epptr() const {return __eout_;} 257*58b9f456SAndroid Build Coastguard Worker 258*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 259*58b9f456SAndroid Build Coastguard Worker void pbump(int __n) { __nout_ += __n; } 260*58b9f456SAndroid Build Coastguard Worker 261*58b9f456SAndroid Build Coastguard Worker _LIBCPP_INLINE_VISIBILITY 262*58b9f456SAndroid Build Coastguard Worker void __pbump(streamsize __n) { __nout_ += __n; } 263*58b9f456SAndroid Build Coastguard Worker 264*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 265*58b9f456SAndroid Build Coastguard Worker void setp(char_type* __pbeg, char_type* __pend) { 266*58b9f456SAndroid Build Coastguard Worker __bout_ = __nout_ = __pbeg; 267*58b9f456SAndroid Build Coastguard Worker __eout_ = __pend; 268*58b9f456SAndroid Build Coastguard Worker } 269*58b9f456SAndroid Build Coastguard Worker 270*58b9f456SAndroid Build Coastguard Worker // 27.6.2.4 virtual functions: 271*58b9f456SAndroid Build Coastguard Worker // 27.6.2.4.1 Locales: 272*58b9f456SAndroid Build Coastguard Worker virtual void imbue(const locale& __loc); 273*58b9f456SAndroid Build Coastguard Worker 274*58b9f456SAndroid Build Coastguard Worker // 27.6.2.4.2 Buffer management and positioning: 275*58b9f456SAndroid Build Coastguard Worker virtual basic_streambuf* setbuf(char_type* __s, streamsize __n); 276*58b9f456SAndroid Build Coastguard Worker virtual pos_type seekoff(off_type __off, ios_base::seekdir __way, 277*58b9f456SAndroid Build Coastguard Worker ios_base::openmode __which = ios_base::in | ios_base::out); 278*58b9f456SAndroid Build Coastguard Worker virtual pos_type seekpos(pos_type __sp, 279*58b9f456SAndroid Build Coastguard Worker ios_base::openmode __which = ios_base::in | ios_base::out); 280*58b9f456SAndroid Build Coastguard Worker virtual int sync(); 281*58b9f456SAndroid Build Coastguard Worker 282*58b9f456SAndroid Build Coastguard Worker // 27.6.2.4.3 Get area: 283*58b9f456SAndroid Build Coastguard Worker virtual streamsize showmanyc(); 284*58b9f456SAndroid Build Coastguard Worker virtual streamsize xsgetn(char_type* __s, streamsize __n); 285*58b9f456SAndroid Build Coastguard Worker virtual int_type underflow(); 286*58b9f456SAndroid Build Coastguard Worker virtual int_type uflow(); 287*58b9f456SAndroid Build Coastguard Worker 288*58b9f456SAndroid Build Coastguard Worker // 27.6.2.4.4 Putback: 289*58b9f456SAndroid Build Coastguard Worker virtual int_type pbackfail(int_type __c = traits_type::eof()); 290*58b9f456SAndroid Build Coastguard Worker 291*58b9f456SAndroid Build Coastguard Worker // 27.6.2.4.5 Put area: 292*58b9f456SAndroid Build Coastguard Worker virtual streamsize xsputn(const char_type* __s, streamsize __n); 293*58b9f456SAndroid Build Coastguard Worker virtual int_type overflow(int_type __c = traits_type::eof()); 294*58b9f456SAndroid Build Coastguard Worker 295*58b9f456SAndroid Build Coastguard Workerprivate: 296*58b9f456SAndroid Build Coastguard Worker locale __loc_; 297*58b9f456SAndroid Build Coastguard Worker char_type* __binp_; 298*58b9f456SAndroid Build Coastguard Worker char_type* __ninp_; 299*58b9f456SAndroid Build Coastguard Worker char_type* __einp_; 300*58b9f456SAndroid Build Coastguard Worker char_type* __bout_; 301*58b9f456SAndroid Build Coastguard Worker char_type* __nout_; 302*58b9f456SAndroid Build Coastguard Worker char_type* __eout_; 303*58b9f456SAndroid Build Coastguard Worker}; 304*58b9f456SAndroid Build Coastguard Worker 305*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits> 306*58b9f456SAndroid Build Coastguard Workerbasic_streambuf<_CharT, _Traits>::~basic_streambuf() 307*58b9f456SAndroid Build Coastguard Worker{ 308*58b9f456SAndroid Build Coastguard Worker} 309*58b9f456SAndroid Build Coastguard Worker 310*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits> 311*58b9f456SAndroid Build Coastguard Workerbasic_streambuf<_CharT, _Traits>::basic_streambuf() 312*58b9f456SAndroid Build Coastguard Worker : __binp_(0), 313*58b9f456SAndroid Build Coastguard Worker __ninp_(0), 314*58b9f456SAndroid Build Coastguard Worker __einp_(0), 315*58b9f456SAndroid Build Coastguard Worker __bout_(0), 316*58b9f456SAndroid Build Coastguard Worker __nout_(0), 317*58b9f456SAndroid Build Coastguard Worker __eout_(0) 318*58b9f456SAndroid Build Coastguard Worker{ 319*58b9f456SAndroid Build Coastguard Worker} 320*58b9f456SAndroid Build Coastguard Worker 321*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits> 322*58b9f456SAndroid Build Coastguard Workerbasic_streambuf<_CharT, _Traits>::basic_streambuf(const basic_streambuf& __sb) 323*58b9f456SAndroid Build Coastguard Worker : __loc_(__sb.__loc_), 324*58b9f456SAndroid Build Coastguard Worker __binp_(__sb.__binp_), 325*58b9f456SAndroid Build Coastguard Worker __ninp_(__sb.__ninp_), 326*58b9f456SAndroid Build Coastguard Worker __einp_(__sb.__einp_), 327*58b9f456SAndroid Build Coastguard Worker __bout_(__sb.__bout_), 328*58b9f456SAndroid Build Coastguard Worker __nout_(__sb.__nout_), 329*58b9f456SAndroid Build Coastguard Worker __eout_(__sb.__eout_) 330*58b9f456SAndroid Build Coastguard Worker{ 331*58b9f456SAndroid Build Coastguard Worker} 332*58b9f456SAndroid Build Coastguard Worker 333*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits> 334*58b9f456SAndroid Build Coastguard Workerbasic_streambuf<_CharT, _Traits>& 335*58b9f456SAndroid Build Coastguard Workerbasic_streambuf<_CharT, _Traits>::operator=(const basic_streambuf& __sb) 336*58b9f456SAndroid Build Coastguard Worker{ 337*58b9f456SAndroid Build Coastguard Worker __loc_ = __sb.__loc_; 338*58b9f456SAndroid Build Coastguard Worker __binp_ = __sb.__binp_; 339*58b9f456SAndroid Build Coastguard Worker __ninp_ = __sb.__ninp_; 340*58b9f456SAndroid Build Coastguard Worker __einp_ = __sb.__einp_; 341*58b9f456SAndroid Build Coastguard Worker __bout_ = __sb.__bout_; 342*58b9f456SAndroid Build Coastguard Worker __nout_ = __sb.__nout_; 343*58b9f456SAndroid Build Coastguard Worker __eout_ = __sb.__eout_; 344*58b9f456SAndroid Build Coastguard Worker return *this; 345*58b9f456SAndroid Build Coastguard Worker} 346*58b9f456SAndroid Build Coastguard Worker 347*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits> 348*58b9f456SAndroid Build Coastguard Workervoid 349*58b9f456SAndroid Build Coastguard Workerbasic_streambuf<_CharT, _Traits>::swap(basic_streambuf& __sb) 350*58b9f456SAndroid Build Coastguard Worker{ 351*58b9f456SAndroid Build Coastguard Worker _VSTD::swap(__loc_, __sb.__loc_); 352*58b9f456SAndroid Build Coastguard Worker _VSTD::swap(__binp_, __sb.__binp_); 353*58b9f456SAndroid Build Coastguard Worker _VSTD::swap(__ninp_, __sb.__ninp_); 354*58b9f456SAndroid Build Coastguard Worker _VSTD::swap(__einp_, __sb.__einp_); 355*58b9f456SAndroid Build Coastguard Worker _VSTD::swap(__bout_, __sb.__bout_); 356*58b9f456SAndroid Build Coastguard Worker _VSTD::swap(__nout_, __sb.__nout_); 357*58b9f456SAndroid Build Coastguard Worker _VSTD::swap(__eout_, __sb.__eout_); 358*58b9f456SAndroid Build Coastguard Worker} 359*58b9f456SAndroid Build Coastguard Worker 360*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits> 361*58b9f456SAndroid Build Coastguard Workervoid 362*58b9f456SAndroid Build Coastguard Workerbasic_streambuf<_CharT, _Traits>::imbue(const locale&) 363*58b9f456SAndroid Build Coastguard Worker{ 364*58b9f456SAndroid Build Coastguard Worker} 365*58b9f456SAndroid Build Coastguard Worker 366*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits> 367*58b9f456SAndroid Build Coastguard Workerbasic_streambuf<_CharT, _Traits>* 368*58b9f456SAndroid Build Coastguard Workerbasic_streambuf<_CharT, _Traits>::setbuf(char_type*, streamsize) 369*58b9f456SAndroid Build Coastguard Worker{ 370*58b9f456SAndroid Build Coastguard Worker return this; 371*58b9f456SAndroid Build Coastguard Worker} 372*58b9f456SAndroid Build Coastguard Worker 373*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits> 374*58b9f456SAndroid Build Coastguard Workertypename basic_streambuf<_CharT, _Traits>::pos_type 375*58b9f456SAndroid Build Coastguard Workerbasic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir, 376*58b9f456SAndroid Build Coastguard Worker ios_base::openmode) 377*58b9f456SAndroid Build Coastguard Worker{ 378*58b9f456SAndroid Build Coastguard Worker return pos_type(off_type(-1)); 379*58b9f456SAndroid Build Coastguard Worker} 380*58b9f456SAndroid Build Coastguard Worker 381*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits> 382*58b9f456SAndroid Build Coastguard Workertypename basic_streambuf<_CharT, _Traits>::pos_type 383*58b9f456SAndroid Build Coastguard Workerbasic_streambuf<_CharT, _Traits>::seekpos(pos_type, ios_base::openmode) 384*58b9f456SAndroid Build Coastguard Worker{ 385*58b9f456SAndroid Build Coastguard Worker return pos_type(off_type(-1)); 386*58b9f456SAndroid Build Coastguard Worker} 387*58b9f456SAndroid Build Coastguard Worker 388*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits> 389*58b9f456SAndroid Build Coastguard Workerint 390*58b9f456SAndroid Build Coastguard Workerbasic_streambuf<_CharT, _Traits>::sync() 391*58b9f456SAndroid Build Coastguard Worker{ 392*58b9f456SAndroid Build Coastguard Worker return 0; 393*58b9f456SAndroid Build Coastguard Worker} 394*58b9f456SAndroid Build Coastguard Worker 395*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits> 396*58b9f456SAndroid Build Coastguard Workerstreamsize 397*58b9f456SAndroid Build Coastguard Workerbasic_streambuf<_CharT, _Traits>::showmanyc() 398*58b9f456SAndroid Build Coastguard Worker{ 399*58b9f456SAndroid Build Coastguard Worker return 0; 400*58b9f456SAndroid Build Coastguard Worker} 401*58b9f456SAndroid Build Coastguard Worker 402*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits> 403*58b9f456SAndroid Build Coastguard Workerstreamsize 404*58b9f456SAndroid Build Coastguard Workerbasic_streambuf<_CharT, _Traits>::xsgetn(char_type* __s, streamsize __n) 405*58b9f456SAndroid Build Coastguard Worker{ 406*58b9f456SAndroid Build Coastguard Worker const int_type __eof = traits_type::eof(); 407*58b9f456SAndroid Build Coastguard Worker int_type __c; 408*58b9f456SAndroid Build Coastguard Worker streamsize __i = 0; 409*58b9f456SAndroid Build Coastguard Worker while(__i < __n) 410*58b9f456SAndroid Build Coastguard Worker { 411*58b9f456SAndroid Build Coastguard Worker if (__ninp_ < __einp_) 412*58b9f456SAndroid Build Coastguard Worker { 413*58b9f456SAndroid Build Coastguard Worker const streamsize __len = _VSTD::min(static_cast<streamsize>(INT_MAX), 414*58b9f456SAndroid Build Coastguard Worker _VSTD::min(__einp_ - __ninp_, __n - __i)); 415*58b9f456SAndroid Build Coastguard Worker traits_type::copy(__s, __ninp_, __len); 416*58b9f456SAndroid Build Coastguard Worker __s += __len; 417*58b9f456SAndroid Build Coastguard Worker __i += __len; 418*58b9f456SAndroid Build Coastguard Worker this->gbump(__len); 419*58b9f456SAndroid Build Coastguard Worker } 420*58b9f456SAndroid Build Coastguard Worker else if ((__c = uflow()) != __eof) 421*58b9f456SAndroid Build Coastguard Worker { 422*58b9f456SAndroid Build Coastguard Worker *__s = traits_type::to_char_type(__c); 423*58b9f456SAndroid Build Coastguard Worker ++__s; 424*58b9f456SAndroid Build Coastguard Worker ++__i; 425*58b9f456SAndroid Build Coastguard Worker } 426*58b9f456SAndroid Build Coastguard Worker else 427*58b9f456SAndroid Build Coastguard Worker break; 428*58b9f456SAndroid Build Coastguard Worker } 429*58b9f456SAndroid Build Coastguard Worker return __i; 430*58b9f456SAndroid Build Coastguard Worker} 431*58b9f456SAndroid Build Coastguard Worker 432*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits> 433*58b9f456SAndroid Build Coastguard Workertypename basic_streambuf<_CharT, _Traits>::int_type 434*58b9f456SAndroid Build Coastguard Workerbasic_streambuf<_CharT, _Traits>::underflow() 435*58b9f456SAndroid Build Coastguard Worker{ 436*58b9f456SAndroid Build Coastguard Worker return traits_type::eof(); 437*58b9f456SAndroid Build Coastguard Worker} 438*58b9f456SAndroid Build Coastguard Worker 439*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits> 440*58b9f456SAndroid Build Coastguard Workertypename basic_streambuf<_CharT, _Traits>::int_type 441*58b9f456SAndroid Build Coastguard Workerbasic_streambuf<_CharT, _Traits>::uflow() 442*58b9f456SAndroid Build Coastguard Worker{ 443*58b9f456SAndroid Build Coastguard Worker if (underflow() == traits_type::eof()) 444*58b9f456SAndroid Build Coastguard Worker return traits_type::eof(); 445*58b9f456SAndroid Build Coastguard Worker return traits_type::to_int_type(*__ninp_++); 446*58b9f456SAndroid Build Coastguard Worker} 447*58b9f456SAndroid Build Coastguard Worker 448*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits> 449*58b9f456SAndroid Build Coastguard Workertypename basic_streambuf<_CharT, _Traits>::int_type 450*58b9f456SAndroid Build Coastguard Workerbasic_streambuf<_CharT, _Traits>::pbackfail(int_type) 451*58b9f456SAndroid Build Coastguard Worker{ 452*58b9f456SAndroid Build Coastguard Worker return traits_type::eof(); 453*58b9f456SAndroid Build Coastguard Worker} 454*58b9f456SAndroid Build Coastguard Worker 455*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits> 456*58b9f456SAndroid Build Coastguard Workerstreamsize 457*58b9f456SAndroid Build Coastguard Workerbasic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n) 458*58b9f456SAndroid Build Coastguard Worker{ 459*58b9f456SAndroid Build Coastguard Worker streamsize __i = 0; 460*58b9f456SAndroid Build Coastguard Worker int_type __eof = traits_type::eof(); 461*58b9f456SAndroid Build Coastguard Worker while( __i < __n) 462*58b9f456SAndroid Build Coastguard Worker { 463*58b9f456SAndroid Build Coastguard Worker if (__nout_ >= __eout_) 464*58b9f456SAndroid Build Coastguard Worker { 465*58b9f456SAndroid Build Coastguard Worker if (overflow(traits_type::to_int_type(*__s)) == __eof) 466*58b9f456SAndroid Build Coastguard Worker break; 467*58b9f456SAndroid Build Coastguard Worker ++__s; 468*58b9f456SAndroid Build Coastguard Worker ++__i; 469*58b9f456SAndroid Build Coastguard Worker } 470*58b9f456SAndroid Build Coastguard Worker else 471*58b9f456SAndroid Build Coastguard Worker { 472*58b9f456SAndroid Build Coastguard Worker streamsize __chunk_size = _VSTD::min(__eout_ - __nout_, __n - __i); 473*58b9f456SAndroid Build Coastguard Worker traits_type::copy(__nout_, __s, __chunk_size); 474*58b9f456SAndroid Build Coastguard Worker __nout_ += __chunk_size; 475*58b9f456SAndroid Build Coastguard Worker __s += __chunk_size; 476*58b9f456SAndroid Build Coastguard Worker __i += __chunk_size; 477*58b9f456SAndroid Build Coastguard Worker } 478*58b9f456SAndroid Build Coastguard Worker } 479*58b9f456SAndroid Build Coastguard Worker return __i; 480*58b9f456SAndroid Build Coastguard Worker} 481*58b9f456SAndroid Build Coastguard Worker 482*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits> 483*58b9f456SAndroid Build Coastguard Workertypename basic_streambuf<_CharT, _Traits>::int_type 484*58b9f456SAndroid Build Coastguard Workerbasic_streambuf<_CharT, _Traits>::overflow(int_type) 485*58b9f456SAndroid Build Coastguard Worker{ 486*58b9f456SAndroid Build Coastguard Worker return traits_type::eof(); 487*58b9f456SAndroid Build Coastguard Worker} 488*58b9f456SAndroid Build Coastguard Worker 489*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_DO_NOT_ASSUME_STREAMS_EXPLICIT_INSTANTIATION_IN_DYLIB 490*58b9f456SAndroid Build Coastguard Worker_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<char>) 491*58b9f456SAndroid Build Coastguard Worker_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<wchar_t>) 492*58b9f456SAndroid Build Coastguard Worker 493*58b9f456SAndroid Build Coastguard Worker_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<char>) 494*58b9f456SAndroid Build Coastguard Worker_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<wchar_t>) 495*58b9f456SAndroid Build Coastguard Worker#endif 496*58b9f456SAndroid Build Coastguard Worker 497*58b9f456SAndroid Build Coastguard Worker_LIBCPP_END_NAMESPACE_STD 498*58b9f456SAndroid Build Coastguard Worker 499*58b9f456SAndroid Build Coastguard Worker_LIBCPP_POP_MACROS 500*58b9f456SAndroid Build Coastguard Worker 501*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_STEAMBUF 502