1*58b9f456SAndroid Build Coastguard Worker// -*- C++ -*- 2*58b9f456SAndroid Build Coastguard Worker//===--------------------------- sstream ----------------------------------===// 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_SSTREAM 12*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_SSTREAM 13*58b9f456SAndroid Build Coastguard Worker 14*58b9f456SAndroid Build Coastguard Worker/* 15*58b9f456SAndroid Build Coastguard Worker sstream synopsis 16*58b9f456SAndroid Build Coastguard Worker 17*58b9f456SAndroid Build Coastguard Workertemplate <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > 18*58b9f456SAndroid Build Coastguard Workerclass basic_stringbuf 19*58b9f456SAndroid Build Coastguard Worker : public basic_streambuf<charT, traits> 20*58b9f456SAndroid Build Coastguard Worker{ 21*58b9f456SAndroid Build Coastguard Workerpublic: 22*58b9f456SAndroid Build Coastguard Worker typedef charT char_type; 23*58b9f456SAndroid Build Coastguard Worker typedef traits traits_type; 24*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::int_type int_type; 25*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::pos_type pos_type; 26*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::off_type off_type; 27*58b9f456SAndroid Build Coastguard Worker typedef Allocator allocator_type; 28*58b9f456SAndroid Build Coastguard Worker 29*58b9f456SAndroid Build Coastguard Worker // 27.8.1.1 Constructors: 30*58b9f456SAndroid Build Coastguard Worker explicit basic_stringbuf(ios_base::openmode which = ios_base::in | ios_base::out); 31*58b9f456SAndroid Build Coastguard Worker explicit basic_stringbuf(const basic_string<char_type, traits_type, allocator_type>& str, 32*58b9f456SAndroid Build Coastguard Worker ios_base::openmode which = ios_base::in | ios_base::out); 33*58b9f456SAndroid Build Coastguard Worker basic_stringbuf(basic_stringbuf&& rhs); 34*58b9f456SAndroid Build Coastguard Worker 35*58b9f456SAndroid Build Coastguard Worker // 27.8.1.2 Assign and swap: 36*58b9f456SAndroid Build Coastguard Worker basic_stringbuf& operator=(basic_stringbuf&& rhs); 37*58b9f456SAndroid Build Coastguard Worker void swap(basic_stringbuf& rhs); 38*58b9f456SAndroid Build Coastguard Worker 39*58b9f456SAndroid Build Coastguard Worker // 27.8.1.3 Get and set: 40*58b9f456SAndroid Build Coastguard Worker basic_string<char_type, traits_type, allocator_type> str() const; 41*58b9f456SAndroid Build Coastguard Worker void str(const basic_string<char_type, traits_type, allocator_type>& s); 42*58b9f456SAndroid Build Coastguard Worker 43*58b9f456SAndroid Build Coastguard Workerprotected: 44*58b9f456SAndroid Build Coastguard Worker // 27.8.1.4 Overridden virtual functions: 45*58b9f456SAndroid Build Coastguard Worker virtual int_type underflow(); 46*58b9f456SAndroid Build Coastguard Worker virtual int_type pbackfail(int_type c = traits_type::eof()); 47*58b9f456SAndroid Build Coastguard Worker virtual int_type overflow (int_type c = traits_type::eof()); 48*58b9f456SAndroid Build Coastguard Worker virtual basic_streambuf<char_type, traits_type>* setbuf(char_type*, streamsize); 49*58b9f456SAndroid Build Coastguard Worker virtual pos_type seekoff(off_type off, ios_base::seekdir way, 50*58b9f456SAndroid Build Coastguard Worker ios_base::openmode which = ios_base::in | ios_base::out); 51*58b9f456SAndroid Build Coastguard Worker virtual pos_type seekpos(pos_type sp, 52*58b9f456SAndroid Build Coastguard Worker ios_base::openmode which = ios_base::in | ios_base::out); 53*58b9f456SAndroid Build Coastguard Worker}; 54*58b9f456SAndroid Build Coastguard Worker 55*58b9f456SAndroid Build Coastguard Workertemplate <class charT, class traits, class Allocator> 56*58b9f456SAndroid Build Coastguard Worker void swap(basic_stringbuf<charT, traits, Allocator>& x, 57*58b9f456SAndroid Build Coastguard Worker basic_stringbuf<charT, traits, Allocator>& y); 58*58b9f456SAndroid Build Coastguard Worker 59*58b9f456SAndroid Build Coastguard Workertypedef basic_stringbuf<char> stringbuf; 60*58b9f456SAndroid Build Coastguard Workertypedef basic_stringbuf<wchar_t> wstringbuf; 61*58b9f456SAndroid Build Coastguard Worker 62*58b9f456SAndroid Build Coastguard Workertemplate <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > 63*58b9f456SAndroid Build Coastguard Workerclass basic_istringstream 64*58b9f456SAndroid Build Coastguard Worker : public basic_istream<charT, traits> 65*58b9f456SAndroid Build Coastguard Worker{ 66*58b9f456SAndroid Build Coastguard Workerpublic: 67*58b9f456SAndroid Build Coastguard Worker typedef charT char_type; 68*58b9f456SAndroid Build Coastguard Worker typedef traits traits_type; 69*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::int_type int_type; 70*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::pos_type pos_type; 71*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::off_type off_type; 72*58b9f456SAndroid Build Coastguard Worker typedef Allocator allocator_type; 73*58b9f456SAndroid Build Coastguard Worker 74*58b9f456SAndroid Build Coastguard Worker // 27.8.2.1 Constructors: 75*58b9f456SAndroid Build Coastguard Worker explicit basic_istringstream(ios_base::openmode which = ios_base::in); 76*58b9f456SAndroid Build Coastguard Worker explicit basic_istringstream(const basic_string<char_type, traits_type,allocator_type>& str, 77*58b9f456SAndroid Build Coastguard Worker ios_base::openmode which = ios_base::in); 78*58b9f456SAndroid Build Coastguard Worker basic_istringstream(basic_istringstream&& rhs); 79*58b9f456SAndroid Build Coastguard Worker 80*58b9f456SAndroid Build Coastguard Worker // 27.8.2.2 Assign and swap: 81*58b9f456SAndroid Build Coastguard Worker basic_istringstream& operator=(basic_istringstream&& rhs); 82*58b9f456SAndroid Build Coastguard Worker void swap(basic_istringstream& rhs); 83*58b9f456SAndroid Build Coastguard Worker 84*58b9f456SAndroid Build Coastguard Worker // 27.8.2.3 Members: 85*58b9f456SAndroid Build Coastguard Worker basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; 86*58b9f456SAndroid Build Coastguard Worker basic_string<char_type, traits_type, allocator_type> str() const; 87*58b9f456SAndroid Build Coastguard Worker void str(const basic_string<char_type, traits_type, allocator_type>& s); 88*58b9f456SAndroid Build Coastguard Worker}; 89*58b9f456SAndroid Build Coastguard Worker 90*58b9f456SAndroid Build Coastguard Workertemplate <class charT, class traits, class Allocator> 91*58b9f456SAndroid Build Coastguard Worker void swap(basic_istringstream<charT, traits, Allocator>& x, 92*58b9f456SAndroid Build Coastguard Worker basic_istringstream<charT, traits, Allocator>& y); 93*58b9f456SAndroid Build Coastguard Worker 94*58b9f456SAndroid Build Coastguard Workertypedef basic_istringstream<char> istringstream; 95*58b9f456SAndroid Build Coastguard Workertypedef basic_istringstream<wchar_t> wistringstream; 96*58b9f456SAndroid Build Coastguard Worker 97*58b9f456SAndroid Build Coastguard Workertemplate <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > 98*58b9f456SAndroid Build Coastguard Workerclass basic_ostringstream 99*58b9f456SAndroid Build Coastguard Worker : public basic_ostream<charT, traits> 100*58b9f456SAndroid Build Coastguard Worker{ 101*58b9f456SAndroid Build Coastguard Workerpublic: 102*58b9f456SAndroid Build Coastguard Worker // types: 103*58b9f456SAndroid Build Coastguard Worker typedef charT char_type; 104*58b9f456SAndroid Build Coastguard Worker typedef traits traits_type; 105*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::int_type int_type; 106*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::pos_type pos_type; 107*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::off_type off_type; 108*58b9f456SAndroid Build Coastguard Worker typedef Allocator allocator_type; 109*58b9f456SAndroid Build Coastguard Worker 110*58b9f456SAndroid Build Coastguard Worker // 27.8.3.1 Constructors/destructor: 111*58b9f456SAndroid Build Coastguard Worker explicit basic_ostringstream(ios_base::openmode which = ios_base::out); 112*58b9f456SAndroid Build Coastguard Worker explicit basic_ostringstream(const basic_string<char_type, traits_type, allocator_type>& str, 113*58b9f456SAndroid Build Coastguard Worker ios_base::openmode which = ios_base::out); 114*58b9f456SAndroid Build Coastguard Worker basic_ostringstream(basic_ostringstream&& rhs); 115*58b9f456SAndroid Build Coastguard Worker 116*58b9f456SAndroid Build Coastguard Worker // 27.8.3.2 Assign/swap: 117*58b9f456SAndroid Build Coastguard Worker basic_ostringstream& operator=(basic_ostringstream&& rhs); 118*58b9f456SAndroid Build Coastguard Worker void swap(basic_ostringstream& rhs); 119*58b9f456SAndroid Build Coastguard Worker 120*58b9f456SAndroid Build Coastguard Worker // 27.8.3.3 Members: 121*58b9f456SAndroid Build Coastguard Worker basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; 122*58b9f456SAndroid Build Coastguard Worker basic_string<char_type, traits_type, allocator_type> str() const; 123*58b9f456SAndroid Build Coastguard Worker void str(const basic_string<char_type, traits_type, allocator_type>& s); 124*58b9f456SAndroid Build Coastguard Worker}; 125*58b9f456SAndroid Build Coastguard Worker 126*58b9f456SAndroid Build Coastguard Workertemplate <class charT, class traits, class Allocator> 127*58b9f456SAndroid Build Coastguard Worker void swap(basic_ostringstream<charT, traits, Allocator>& x, 128*58b9f456SAndroid Build Coastguard Worker basic_ostringstream<charT, traits, Allocator>& y); 129*58b9f456SAndroid Build Coastguard Worker 130*58b9f456SAndroid Build Coastguard Workertypedef basic_ostringstream<char> ostringstream; 131*58b9f456SAndroid Build Coastguard Workertypedef basic_ostringstream<wchar_t> wostringstream; 132*58b9f456SAndroid Build Coastguard Worker 133*58b9f456SAndroid Build Coastguard Workertemplate <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > 134*58b9f456SAndroid Build Coastguard Workerclass basic_stringstream 135*58b9f456SAndroid Build Coastguard Worker : public basic_iostream<charT, traits> 136*58b9f456SAndroid Build Coastguard Worker{ 137*58b9f456SAndroid Build Coastguard Workerpublic: 138*58b9f456SAndroid Build Coastguard Worker // types: 139*58b9f456SAndroid Build Coastguard Worker typedef charT char_type; 140*58b9f456SAndroid Build Coastguard Worker typedef traits traits_type; 141*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::int_type int_type; 142*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::pos_type pos_type; 143*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::off_type off_type; 144*58b9f456SAndroid Build Coastguard Worker typedef Allocator allocator_type; 145*58b9f456SAndroid Build Coastguard Worker 146*58b9f456SAndroid Build Coastguard Worker // constructors/destructor 147*58b9f456SAndroid Build Coastguard Worker explicit basic_stringstream(ios_base::openmode which = ios_base::out|ios_base::in); 148*58b9f456SAndroid Build Coastguard Worker explicit basic_stringstream(const basic_string<char_type, traits_type, allocator_type>& str, 149*58b9f456SAndroid Build Coastguard Worker ios_base::openmode which = ios_base::out|ios_base::in); 150*58b9f456SAndroid Build Coastguard Worker basic_stringstream(basic_stringstream&& rhs); 151*58b9f456SAndroid Build Coastguard Worker 152*58b9f456SAndroid Build Coastguard Worker // 27.8.5.1 Assign/swap: 153*58b9f456SAndroid Build Coastguard Worker basic_stringstream& operator=(basic_stringstream&& rhs); 154*58b9f456SAndroid Build Coastguard Worker void swap(basic_stringstream& rhs); 155*58b9f456SAndroid Build Coastguard Worker 156*58b9f456SAndroid Build Coastguard Worker // Members: 157*58b9f456SAndroid Build Coastguard Worker basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; 158*58b9f456SAndroid Build Coastguard Worker basic_string<char_type, traits_type, allocator_type> str() const; 159*58b9f456SAndroid Build Coastguard Worker void str(const basic_string<char_type, traits_type, allocator_type>& str); 160*58b9f456SAndroid Build Coastguard Worker}; 161*58b9f456SAndroid Build Coastguard Worker 162*58b9f456SAndroid Build Coastguard Workertemplate <class charT, class traits, class Allocator> 163*58b9f456SAndroid Build Coastguard Worker void swap(basic_stringstream<charT, traits, Allocator>& x, 164*58b9f456SAndroid Build Coastguard Worker basic_stringstream<charT, traits, Allocator>& y); 165*58b9f456SAndroid Build Coastguard Worker 166*58b9f456SAndroid Build Coastguard Workertypedef basic_stringstream<char> stringstream; 167*58b9f456SAndroid Build Coastguard Workertypedef basic_stringstream<wchar_t> wstringstream; 168*58b9f456SAndroid Build Coastguard Worker 169*58b9f456SAndroid Build Coastguard Worker} // std 170*58b9f456SAndroid Build Coastguard Worker 171*58b9f456SAndroid Build Coastguard Worker*/ 172*58b9f456SAndroid Build Coastguard Worker 173*58b9f456SAndroid Build Coastguard Worker#include <__config> 174*58b9f456SAndroid Build Coastguard Worker#include <ostream> 175*58b9f456SAndroid Build Coastguard Worker#include <istream> 176*58b9f456SAndroid Build Coastguard Worker#include <string> 177*58b9f456SAndroid Build Coastguard Worker 178*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 179*58b9f456SAndroid Build Coastguard Worker#pragma GCC system_header 180*58b9f456SAndroid Build Coastguard Worker#endif 181*58b9f456SAndroid Build Coastguard Worker 182*58b9f456SAndroid Build Coastguard Worker_LIBCPP_PUSH_MACROS 183*58b9f456SAndroid Build Coastguard Worker#include <__undef_macros> 184*58b9f456SAndroid Build Coastguard Worker 185*58b9f456SAndroid Build Coastguard Worker 186*58b9f456SAndroid Build Coastguard Worker_LIBCPP_BEGIN_NAMESPACE_STD 187*58b9f456SAndroid Build Coastguard Worker 188*58b9f456SAndroid Build Coastguard Worker// basic_stringbuf 189*58b9f456SAndroid Build Coastguard Worker 190*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 191*58b9f456SAndroid Build Coastguard Workerclass _LIBCPP_TEMPLATE_VIS basic_stringbuf 192*58b9f456SAndroid Build Coastguard Worker : public basic_streambuf<_CharT, _Traits> 193*58b9f456SAndroid Build Coastguard Worker{ 194*58b9f456SAndroid Build Coastguard Workerpublic: 195*58b9f456SAndroid Build Coastguard Worker typedef _CharT char_type; 196*58b9f456SAndroid Build Coastguard Worker typedef _Traits traits_type; 197*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::int_type int_type; 198*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::pos_type pos_type; 199*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::off_type off_type; 200*58b9f456SAndroid Build Coastguard Worker typedef _Allocator allocator_type; 201*58b9f456SAndroid Build Coastguard Worker 202*58b9f456SAndroid Build Coastguard Worker typedef basic_string<char_type, traits_type, allocator_type> string_type; 203*58b9f456SAndroid Build Coastguard Worker 204*58b9f456SAndroid Build Coastguard Workerprivate: 205*58b9f456SAndroid Build Coastguard Worker 206*58b9f456SAndroid Build Coastguard Worker string_type __str_; 207*58b9f456SAndroid Build Coastguard Worker mutable char_type* __hm_; 208*58b9f456SAndroid Build Coastguard Worker ios_base::openmode __mode_; 209*58b9f456SAndroid Build Coastguard Worker 210*58b9f456SAndroid Build Coastguard Workerpublic: 211*58b9f456SAndroid Build Coastguard Worker // 27.8.1.1 Constructors: 212*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 213*58b9f456SAndroid Build Coastguard Worker explicit basic_stringbuf(ios_base::openmode __wch = ios_base::in | ios_base::out); 214*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 215*58b9f456SAndroid Build Coastguard Worker explicit basic_stringbuf(const string_type& __s, 216*58b9f456SAndroid Build Coastguard Worker ios_base::openmode __wch = ios_base::in | ios_base::out); 217*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 218*58b9f456SAndroid Build Coastguard Worker basic_stringbuf(basic_stringbuf&& __rhs); 219*58b9f456SAndroid Build Coastguard Worker 220*58b9f456SAndroid Build Coastguard Worker // 27.8.1.2 Assign and swap: 221*58b9f456SAndroid Build Coastguard Worker basic_stringbuf& operator=(basic_stringbuf&& __rhs); 222*58b9f456SAndroid Build Coastguard Worker#endif 223*58b9f456SAndroid Build Coastguard Worker void swap(basic_stringbuf& __rhs); 224*58b9f456SAndroid Build Coastguard Worker 225*58b9f456SAndroid Build Coastguard Worker // 27.8.1.3 Get and set: 226*58b9f456SAndroid Build Coastguard Worker string_type str() const; 227*58b9f456SAndroid Build Coastguard Worker void str(const string_type& __s); 228*58b9f456SAndroid Build Coastguard Worker 229*58b9f456SAndroid Build Coastguard Workerprotected: 230*58b9f456SAndroid Build Coastguard Worker // 27.8.1.4 Overridden virtual functions: 231*58b9f456SAndroid Build Coastguard Worker virtual int_type underflow(); 232*58b9f456SAndroid Build Coastguard Worker virtual int_type pbackfail(int_type __c = traits_type::eof()); 233*58b9f456SAndroid Build Coastguard Worker virtual int_type overflow (int_type __c = traits_type::eof()); 234*58b9f456SAndroid Build Coastguard Worker virtual pos_type seekoff(off_type __off, ios_base::seekdir __way, 235*58b9f456SAndroid Build Coastguard Worker ios_base::openmode __wch = ios_base::in | ios_base::out); 236*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 237*58b9f456SAndroid Build Coastguard Worker virtual pos_type seekpos(pos_type __sp, 238*58b9f456SAndroid Build Coastguard Worker ios_base::openmode __wch = ios_base::in | ios_base::out); 239*58b9f456SAndroid Build Coastguard Worker}; 240*58b9f456SAndroid Build Coastguard Worker 241*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 242*58b9f456SAndroid Build Coastguard Workerbasic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(ios_base::openmode __wch) 243*58b9f456SAndroid Build Coastguard Worker : __hm_(0), 244*58b9f456SAndroid Build Coastguard Worker __mode_(__wch) 245*58b9f456SAndroid Build Coastguard Worker{ 246*58b9f456SAndroid Build Coastguard Worker} 247*58b9f456SAndroid Build Coastguard Worker 248*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 249*58b9f456SAndroid Build Coastguard Workerbasic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(const string_type& __s, 250*58b9f456SAndroid Build Coastguard Worker ios_base::openmode __wch) 251*58b9f456SAndroid Build Coastguard Worker : __str_(__s.get_allocator()), 252*58b9f456SAndroid Build Coastguard Worker __hm_(0), 253*58b9f456SAndroid Build Coastguard Worker __mode_(__wch) 254*58b9f456SAndroid Build Coastguard Worker{ 255*58b9f456SAndroid Build Coastguard Worker str(__s); 256*58b9f456SAndroid Build Coastguard Worker} 257*58b9f456SAndroid Build Coastguard Worker 258*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 259*58b9f456SAndroid Build Coastguard Worker 260*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 261*58b9f456SAndroid Build Coastguard Workerbasic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&& __rhs) 262*58b9f456SAndroid Build Coastguard Worker : __mode_(__rhs.__mode_) 263*58b9f456SAndroid Build Coastguard Worker{ 264*58b9f456SAndroid Build Coastguard Worker char_type* __p = const_cast<char_type*>(__rhs.__str_.data()); 265*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __binp = -1; 266*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __ninp = -1; 267*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __einp = -1; 268*58b9f456SAndroid Build Coastguard Worker if (__rhs.eback() != nullptr) 269*58b9f456SAndroid Build Coastguard Worker { 270*58b9f456SAndroid Build Coastguard Worker __binp = __rhs.eback() - __p; 271*58b9f456SAndroid Build Coastguard Worker __ninp = __rhs.gptr() - __p; 272*58b9f456SAndroid Build Coastguard Worker __einp = __rhs.egptr() - __p; 273*58b9f456SAndroid Build Coastguard Worker } 274*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __bout = -1; 275*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __nout = -1; 276*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __eout = -1; 277*58b9f456SAndroid Build Coastguard Worker if (__rhs.pbase() != nullptr) 278*58b9f456SAndroid Build Coastguard Worker { 279*58b9f456SAndroid Build Coastguard Worker __bout = __rhs.pbase() - __p; 280*58b9f456SAndroid Build Coastguard Worker __nout = __rhs.pptr() - __p; 281*58b9f456SAndroid Build Coastguard Worker __eout = __rhs.epptr() - __p; 282*58b9f456SAndroid Build Coastguard Worker } 283*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p; 284*58b9f456SAndroid Build Coastguard Worker __str_ = _VSTD::move(__rhs.__str_); 285*58b9f456SAndroid Build Coastguard Worker __p = const_cast<char_type*>(__str_.data()); 286*58b9f456SAndroid Build Coastguard Worker if (__binp != -1) 287*58b9f456SAndroid Build Coastguard Worker this->setg(__p + __binp, __p + __ninp, __p + __einp); 288*58b9f456SAndroid Build Coastguard Worker if (__bout != -1) 289*58b9f456SAndroid Build Coastguard Worker { 290*58b9f456SAndroid Build Coastguard Worker this->setp(__p + __bout, __p + __eout); 291*58b9f456SAndroid Build Coastguard Worker this->__pbump(__nout); 292*58b9f456SAndroid Build Coastguard Worker } 293*58b9f456SAndroid Build Coastguard Worker __hm_ = __hm == -1 ? nullptr : __p + __hm; 294*58b9f456SAndroid Build Coastguard Worker __p = const_cast<char_type*>(__rhs.__str_.data()); 295*58b9f456SAndroid Build Coastguard Worker __rhs.setg(__p, __p, __p); 296*58b9f456SAndroid Build Coastguard Worker __rhs.setp(__p, __p); 297*58b9f456SAndroid Build Coastguard Worker __rhs.__hm_ = __p; 298*58b9f456SAndroid Build Coastguard Worker this->pubimbue(__rhs.getloc()); 299*58b9f456SAndroid Build Coastguard Worker} 300*58b9f456SAndroid Build Coastguard Worker 301*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 302*58b9f456SAndroid Build Coastguard Workerbasic_stringbuf<_CharT, _Traits, _Allocator>& 303*58b9f456SAndroid Build Coastguard Workerbasic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs) 304*58b9f456SAndroid Build Coastguard Worker{ 305*58b9f456SAndroid Build Coastguard Worker char_type* __p = const_cast<char_type*>(__rhs.__str_.data()); 306*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __binp = -1; 307*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __ninp = -1; 308*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __einp = -1; 309*58b9f456SAndroid Build Coastguard Worker if (__rhs.eback() != nullptr) 310*58b9f456SAndroid Build Coastguard Worker { 311*58b9f456SAndroid Build Coastguard Worker __binp = __rhs.eback() - __p; 312*58b9f456SAndroid Build Coastguard Worker __ninp = __rhs.gptr() - __p; 313*58b9f456SAndroid Build Coastguard Worker __einp = __rhs.egptr() - __p; 314*58b9f456SAndroid Build Coastguard Worker } 315*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __bout = -1; 316*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __nout = -1; 317*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __eout = -1; 318*58b9f456SAndroid Build Coastguard Worker if (__rhs.pbase() != nullptr) 319*58b9f456SAndroid Build Coastguard Worker { 320*58b9f456SAndroid Build Coastguard Worker __bout = __rhs.pbase() - __p; 321*58b9f456SAndroid Build Coastguard Worker __nout = __rhs.pptr() - __p; 322*58b9f456SAndroid Build Coastguard Worker __eout = __rhs.epptr() - __p; 323*58b9f456SAndroid Build Coastguard Worker } 324*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p; 325*58b9f456SAndroid Build Coastguard Worker __str_ = _VSTD::move(__rhs.__str_); 326*58b9f456SAndroid Build Coastguard Worker __p = const_cast<char_type*>(__str_.data()); 327*58b9f456SAndroid Build Coastguard Worker if (__binp != -1) 328*58b9f456SAndroid Build Coastguard Worker this->setg(__p + __binp, __p + __ninp, __p + __einp); 329*58b9f456SAndroid Build Coastguard Worker else 330*58b9f456SAndroid Build Coastguard Worker this->setg(nullptr, nullptr, nullptr); 331*58b9f456SAndroid Build Coastguard Worker if (__bout != -1) 332*58b9f456SAndroid Build Coastguard Worker { 333*58b9f456SAndroid Build Coastguard Worker this->setp(__p + __bout, __p + __eout); 334*58b9f456SAndroid Build Coastguard Worker this->__pbump(__nout); 335*58b9f456SAndroid Build Coastguard Worker } 336*58b9f456SAndroid Build Coastguard Worker else 337*58b9f456SAndroid Build Coastguard Worker this->setp(nullptr, nullptr); 338*58b9f456SAndroid Build Coastguard Worker 339*58b9f456SAndroid Build Coastguard Worker __hm_ = __hm == -1 ? nullptr : __p + __hm; 340*58b9f456SAndroid Build Coastguard Worker __mode_ = __rhs.__mode_; 341*58b9f456SAndroid Build Coastguard Worker __p = const_cast<char_type*>(__rhs.__str_.data()); 342*58b9f456SAndroid Build Coastguard Worker __rhs.setg(__p, __p, __p); 343*58b9f456SAndroid Build Coastguard Worker __rhs.setp(__p, __p); 344*58b9f456SAndroid Build Coastguard Worker __rhs.__hm_ = __p; 345*58b9f456SAndroid Build Coastguard Worker this->pubimbue(__rhs.getloc()); 346*58b9f456SAndroid Build Coastguard Worker return *this; 347*58b9f456SAndroid Build Coastguard Worker} 348*58b9f456SAndroid Build Coastguard Worker 349*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_LANG 350*58b9f456SAndroid Build Coastguard Worker 351*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 352*58b9f456SAndroid Build Coastguard Workervoid 353*58b9f456SAndroid Build Coastguard Workerbasic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs) 354*58b9f456SAndroid Build Coastguard Worker{ 355*58b9f456SAndroid Build Coastguard Worker char_type* __p = const_cast<char_type*>(__rhs.__str_.data()); 356*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __rbinp = -1; 357*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __rninp = -1; 358*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __reinp = -1; 359*58b9f456SAndroid Build Coastguard Worker if (__rhs.eback() != nullptr) 360*58b9f456SAndroid Build Coastguard Worker { 361*58b9f456SAndroid Build Coastguard Worker __rbinp = __rhs.eback() - __p; 362*58b9f456SAndroid Build Coastguard Worker __rninp = __rhs.gptr() - __p; 363*58b9f456SAndroid Build Coastguard Worker __reinp = __rhs.egptr() - __p; 364*58b9f456SAndroid Build Coastguard Worker } 365*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __rbout = -1; 366*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __rnout = -1; 367*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __reout = -1; 368*58b9f456SAndroid Build Coastguard Worker if (__rhs.pbase() != nullptr) 369*58b9f456SAndroid Build Coastguard Worker { 370*58b9f456SAndroid Build Coastguard Worker __rbout = __rhs.pbase() - __p; 371*58b9f456SAndroid Build Coastguard Worker __rnout = __rhs.pptr() - __p; 372*58b9f456SAndroid Build Coastguard Worker __reout = __rhs.epptr() - __p; 373*58b9f456SAndroid Build Coastguard Worker } 374*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __rhm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p; 375*58b9f456SAndroid Build Coastguard Worker __p = const_cast<char_type*>(__str_.data()); 376*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __lbinp = -1; 377*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __lninp = -1; 378*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __leinp = -1; 379*58b9f456SAndroid Build Coastguard Worker if (this->eback() != nullptr) 380*58b9f456SAndroid Build Coastguard Worker { 381*58b9f456SAndroid Build Coastguard Worker __lbinp = this->eback() - __p; 382*58b9f456SAndroid Build Coastguard Worker __lninp = this->gptr() - __p; 383*58b9f456SAndroid Build Coastguard Worker __leinp = this->egptr() - __p; 384*58b9f456SAndroid Build Coastguard Worker } 385*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __lbout = -1; 386*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __lnout = -1; 387*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __leout = -1; 388*58b9f456SAndroid Build Coastguard Worker if (this->pbase() != nullptr) 389*58b9f456SAndroid Build Coastguard Worker { 390*58b9f456SAndroid Build Coastguard Worker __lbout = this->pbase() - __p; 391*58b9f456SAndroid Build Coastguard Worker __lnout = this->pptr() - __p; 392*58b9f456SAndroid Build Coastguard Worker __leout = this->epptr() - __p; 393*58b9f456SAndroid Build Coastguard Worker } 394*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __lhm = __hm_ == nullptr ? -1 : __hm_ - __p; 395*58b9f456SAndroid Build Coastguard Worker _VSTD::swap(__mode_, __rhs.__mode_); 396*58b9f456SAndroid Build Coastguard Worker __str_.swap(__rhs.__str_); 397*58b9f456SAndroid Build Coastguard Worker __p = const_cast<char_type*>(__str_.data()); 398*58b9f456SAndroid Build Coastguard Worker if (__rbinp != -1) 399*58b9f456SAndroid Build Coastguard Worker this->setg(__p + __rbinp, __p + __rninp, __p + __reinp); 400*58b9f456SAndroid Build Coastguard Worker else 401*58b9f456SAndroid Build Coastguard Worker this->setg(nullptr, nullptr, nullptr); 402*58b9f456SAndroid Build Coastguard Worker if (__rbout != -1) 403*58b9f456SAndroid Build Coastguard Worker { 404*58b9f456SAndroid Build Coastguard Worker this->setp(__p + __rbout, __p + __reout); 405*58b9f456SAndroid Build Coastguard Worker this->__pbump(__rnout); 406*58b9f456SAndroid Build Coastguard Worker } 407*58b9f456SAndroid Build Coastguard Worker else 408*58b9f456SAndroid Build Coastguard Worker this->setp(nullptr, nullptr); 409*58b9f456SAndroid Build Coastguard Worker __hm_ = __rhm == -1 ? nullptr : __p + __rhm; 410*58b9f456SAndroid Build Coastguard Worker __p = const_cast<char_type*>(__rhs.__str_.data()); 411*58b9f456SAndroid Build Coastguard Worker if (__lbinp != -1) 412*58b9f456SAndroid Build Coastguard Worker __rhs.setg(__p + __lbinp, __p + __lninp, __p + __leinp); 413*58b9f456SAndroid Build Coastguard Worker else 414*58b9f456SAndroid Build Coastguard Worker __rhs.setg(nullptr, nullptr, nullptr); 415*58b9f456SAndroid Build Coastguard Worker if (__lbout != -1) 416*58b9f456SAndroid Build Coastguard Worker { 417*58b9f456SAndroid Build Coastguard Worker __rhs.setp(__p + __lbout, __p + __leout); 418*58b9f456SAndroid Build Coastguard Worker __rhs.__pbump(__lnout); 419*58b9f456SAndroid Build Coastguard Worker } 420*58b9f456SAndroid Build Coastguard Worker else 421*58b9f456SAndroid Build Coastguard Worker __rhs.setp(nullptr, nullptr); 422*58b9f456SAndroid Build Coastguard Worker __rhs.__hm_ = __lhm == -1 ? nullptr : __p + __lhm; 423*58b9f456SAndroid Build Coastguard Worker locale __tl = __rhs.getloc(); 424*58b9f456SAndroid Build Coastguard Worker __rhs.pubimbue(this->getloc()); 425*58b9f456SAndroid Build Coastguard Worker this->pubimbue(__tl); 426*58b9f456SAndroid Build Coastguard Worker} 427*58b9f456SAndroid Build Coastguard Worker 428*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 429*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 430*58b9f456SAndroid Build Coastguard Workervoid 431*58b9f456SAndroid Build Coastguard Workerswap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x, 432*58b9f456SAndroid Build Coastguard Worker basic_stringbuf<_CharT, _Traits, _Allocator>& __y) 433*58b9f456SAndroid Build Coastguard Worker{ 434*58b9f456SAndroid Build Coastguard Worker __x.swap(__y); 435*58b9f456SAndroid Build Coastguard Worker} 436*58b9f456SAndroid Build Coastguard Worker 437*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 438*58b9f456SAndroid Build Coastguard Workerbasic_string<_CharT, _Traits, _Allocator> 439*58b9f456SAndroid Build Coastguard Workerbasic_stringbuf<_CharT, _Traits, _Allocator>::str() const 440*58b9f456SAndroid Build Coastguard Worker{ 441*58b9f456SAndroid Build Coastguard Worker if (__mode_ & ios_base::out) 442*58b9f456SAndroid Build Coastguard Worker { 443*58b9f456SAndroid Build Coastguard Worker if (__hm_ < this->pptr()) 444*58b9f456SAndroid Build Coastguard Worker __hm_ = this->pptr(); 445*58b9f456SAndroid Build Coastguard Worker return string_type(this->pbase(), __hm_, __str_.get_allocator()); 446*58b9f456SAndroid Build Coastguard Worker } 447*58b9f456SAndroid Build Coastguard Worker else if (__mode_ & ios_base::in) 448*58b9f456SAndroid Build Coastguard Worker return string_type(this->eback(), this->egptr(), __str_.get_allocator()); 449*58b9f456SAndroid Build Coastguard Worker return string_type(__str_.get_allocator()); 450*58b9f456SAndroid Build Coastguard Worker} 451*58b9f456SAndroid Build Coastguard Worker 452*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 453*58b9f456SAndroid Build Coastguard Workervoid 454*58b9f456SAndroid Build Coastguard Workerbasic_stringbuf<_CharT, _Traits, _Allocator>::str(const string_type& __s) 455*58b9f456SAndroid Build Coastguard Worker{ 456*58b9f456SAndroid Build Coastguard Worker __str_ = __s; 457*58b9f456SAndroid Build Coastguard Worker __hm_ = 0; 458*58b9f456SAndroid Build Coastguard Worker if (__mode_ & ios_base::in) 459*58b9f456SAndroid Build Coastguard Worker { 460*58b9f456SAndroid Build Coastguard Worker __hm_ = const_cast<char_type*>(__str_.data()) + __str_.size(); 461*58b9f456SAndroid Build Coastguard Worker this->setg(const_cast<char_type*>(__str_.data()), 462*58b9f456SAndroid Build Coastguard Worker const_cast<char_type*>(__str_.data()), 463*58b9f456SAndroid Build Coastguard Worker __hm_); 464*58b9f456SAndroid Build Coastguard Worker } 465*58b9f456SAndroid Build Coastguard Worker if (__mode_ & ios_base::out) 466*58b9f456SAndroid Build Coastguard Worker { 467*58b9f456SAndroid Build Coastguard Worker typename string_type::size_type __sz = __str_.size(); 468*58b9f456SAndroid Build Coastguard Worker __hm_ = const_cast<char_type*>(__str_.data()) + __sz; 469*58b9f456SAndroid Build Coastguard Worker __str_.resize(__str_.capacity()); 470*58b9f456SAndroid Build Coastguard Worker this->setp(const_cast<char_type*>(__str_.data()), 471*58b9f456SAndroid Build Coastguard Worker const_cast<char_type*>(__str_.data()) + __str_.size()); 472*58b9f456SAndroid Build Coastguard Worker if (__mode_ & (ios_base::app | ios_base::ate)) 473*58b9f456SAndroid Build Coastguard Worker { 474*58b9f456SAndroid Build Coastguard Worker while (__sz > INT_MAX) 475*58b9f456SAndroid Build Coastguard Worker { 476*58b9f456SAndroid Build Coastguard Worker this->pbump(INT_MAX); 477*58b9f456SAndroid Build Coastguard Worker __sz -= INT_MAX; 478*58b9f456SAndroid Build Coastguard Worker } 479*58b9f456SAndroid Build Coastguard Worker if (__sz > 0) 480*58b9f456SAndroid Build Coastguard Worker this->pbump(__sz); 481*58b9f456SAndroid Build Coastguard Worker } 482*58b9f456SAndroid Build Coastguard Worker } 483*58b9f456SAndroid Build Coastguard Worker} 484*58b9f456SAndroid Build Coastguard Worker 485*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 486*58b9f456SAndroid Build Coastguard Workertypename basic_stringbuf<_CharT, _Traits, _Allocator>::int_type 487*58b9f456SAndroid Build Coastguard Workerbasic_stringbuf<_CharT, _Traits, _Allocator>::underflow() 488*58b9f456SAndroid Build Coastguard Worker{ 489*58b9f456SAndroid Build Coastguard Worker if (__hm_ < this->pptr()) 490*58b9f456SAndroid Build Coastguard Worker __hm_ = this->pptr(); 491*58b9f456SAndroid Build Coastguard Worker if (__mode_ & ios_base::in) 492*58b9f456SAndroid Build Coastguard Worker { 493*58b9f456SAndroid Build Coastguard Worker if (this->egptr() < __hm_) 494*58b9f456SAndroid Build Coastguard Worker this->setg(this->eback(), this->gptr(), __hm_); 495*58b9f456SAndroid Build Coastguard Worker if (this->gptr() < this->egptr()) 496*58b9f456SAndroid Build Coastguard Worker return traits_type::to_int_type(*this->gptr()); 497*58b9f456SAndroid Build Coastguard Worker } 498*58b9f456SAndroid Build Coastguard Worker return traits_type::eof(); 499*58b9f456SAndroid Build Coastguard Worker} 500*58b9f456SAndroid Build Coastguard Worker 501*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 502*58b9f456SAndroid Build Coastguard Workertypename basic_stringbuf<_CharT, _Traits, _Allocator>::int_type 503*58b9f456SAndroid Build Coastguard Workerbasic_stringbuf<_CharT, _Traits, _Allocator>::pbackfail(int_type __c) 504*58b9f456SAndroid Build Coastguard Worker{ 505*58b9f456SAndroid Build Coastguard Worker if (__hm_ < this->pptr()) 506*58b9f456SAndroid Build Coastguard Worker __hm_ = this->pptr(); 507*58b9f456SAndroid Build Coastguard Worker if (this->eback() < this->gptr()) 508*58b9f456SAndroid Build Coastguard Worker { 509*58b9f456SAndroid Build Coastguard Worker if (traits_type::eq_int_type(__c, traits_type::eof())) 510*58b9f456SAndroid Build Coastguard Worker { 511*58b9f456SAndroid Build Coastguard Worker this->setg(this->eback(), this->gptr()-1, __hm_); 512*58b9f456SAndroid Build Coastguard Worker return traits_type::not_eof(__c); 513*58b9f456SAndroid Build Coastguard Worker } 514*58b9f456SAndroid Build Coastguard Worker if ((__mode_ & ios_base::out) || 515*58b9f456SAndroid Build Coastguard Worker traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1])) 516*58b9f456SAndroid Build Coastguard Worker { 517*58b9f456SAndroid Build Coastguard Worker this->setg(this->eback(), this->gptr()-1, __hm_); 518*58b9f456SAndroid Build Coastguard Worker *this->gptr() = traits_type::to_char_type(__c); 519*58b9f456SAndroid Build Coastguard Worker return __c; 520*58b9f456SAndroid Build Coastguard Worker } 521*58b9f456SAndroid Build Coastguard Worker } 522*58b9f456SAndroid Build Coastguard Worker return traits_type::eof(); 523*58b9f456SAndroid Build Coastguard Worker} 524*58b9f456SAndroid Build Coastguard Worker 525*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 526*58b9f456SAndroid Build Coastguard Workertypename basic_stringbuf<_CharT, _Traits, _Allocator>::int_type 527*58b9f456SAndroid Build Coastguard Workerbasic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c) 528*58b9f456SAndroid Build Coastguard Worker{ 529*58b9f456SAndroid Build Coastguard Worker if (!traits_type::eq_int_type(__c, traits_type::eof())) 530*58b9f456SAndroid Build Coastguard Worker { 531*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __ninp = this->gptr() - this->eback(); 532*58b9f456SAndroid Build Coastguard Worker if (this->pptr() == this->epptr()) 533*58b9f456SAndroid Build Coastguard Worker { 534*58b9f456SAndroid Build Coastguard Worker if (!(__mode_ & ios_base::out)) 535*58b9f456SAndroid Build Coastguard Worker return traits_type::eof(); 536*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_NO_EXCEPTIONS 537*58b9f456SAndroid Build Coastguard Worker try 538*58b9f456SAndroid Build Coastguard Worker { 539*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_NO_EXCEPTIONS 540*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __nout = this->pptr() - this->pbase(); 541*58b9f456SAndroid Build Coastguard Worker ptrdiff_t __hm = __hm_ - this->pbase(); 542*58b9f456SAndroid Build Coastguard Worker __str_.push_back(char_type()); 543*58b9f456SAndroid Build Coastguard Worker __str_.resize(__str_.capacity()); 544*58b9f456SAndroid Build Coastguard Worker char_type* __p = const_cast<char_type*>(__str_.data()); 545*58b9f456SAndroid Build Coastguard Worker this->setp(__p, __p + __str_.size()); 546*58b9f456SAndroid Build Coastguard Worker this->__pbump(__nout); 547*58b9f456SAndroid Build Coastguard Worker __hm_ = this->pbase() + __hm; 548*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_NO_EXCEPTIONS 549*58b9f456SAndroid Build Coastguard Worker } 550*58b9f456SAndroid Build Coastguard Worker catch (...) 551*58b9f456SAndroid Build Coastguard Worker { 552*58b9f456SAndroid Build Coastguard Worker return traits_type::eof(); 553*58b9f456SAndroid Build Coastguard Worker } 554*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_NO_EXCEPTIONS 555*58b9f456SAndroid Build Coastguard Worker } 556*58b9f456SAndroid Build Coastguard Worker __hm_ = _VSTD::max(this->pptr() + 1, __hm_); 557*58b9f456SAndroid Build Coastguard Worker if (__mode_ & ios_base::in) 558*58b9f456SAndroid Build Coastguard Worker { 559*58b9f456SAndroid Build Coastguard Worker char_type* __p = const_cast<char_type*>(__str_.data()); 560*58b9f456SAndroid Build Coastguard Worker this->setg(__p, __p + __ninp, __hm_); 561*58b9f456SAndroid Build Coastguard Worker } 562*58b9f456SAndroid Build Coastguard Worker return this->sputc(__c); 563*58b9f456SAndroid Build Coastguard Worker } 564*58b9f456SAndroid Build Coastguard Worker return traits_type::not_eof(__c); 565*58b9f456SAndroid Build Coastguard Worker} 566*58b9f456SAndroid Build Coastguard Worker 567*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 568*58b9f456SAndroid Build Coastguard Workertypename basic_stringbuf<_CharT, _Traits, _Allocator>::pos_type 569*58b9f456SAndroid Build Coastguard Workerbasic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off, 570*58b9f456SAndroid Build Coastguard Worker ios_base::seekdir __way, 571*58b9f456SAndroid Build Coastguard Worker ios_base::openmode __wch) 572*58b9f456SAndroid Build Coastguard Worker{ 573*58b9f456SAndroid Build Coastguard Worker if (__hm_ < this->pptr()) 574*58b9f456SAndroid Build Coastguard Worker __hm_ = this->pptr(); 575*58b9f456SAndroid Build Coastguard Worker if ((__wch & (ios_base::in | ios_base::out)) == 0) 576*58b9f456SAndroid Build Coastguard Worker return pos_type(-1); 577*58b9f456SAndroid Build Coastguard Worker if ((__wch & (ios_base::in | ios_base::out)) == (ios_base::in | ios_base::out) 578*58b9f456SAndroid Build Coastguard Worker && __way == ios_base::cur) 579*58b9f456SAndroid Build Coastguard Worker return pos_type(-1); 580*58b9f456SAndroid Build Coastguard Worker const ptrdiff_t __hm = __hm_ == nullptr ? 0 : __hm_ - __str_.data(); 581*58b9f456SAndroid Build Coastguard Worker off_type __noff; 582*58b9f456SAndroid Build Coastguard Worker switch (__way) 583*58b9f456SAndroid Build Coastguard Worker { 584*58b9f456SAndroid Build Coastguard Worker case ios_base::beg: 585*58b9f456SAndroid Build Coastguard Worker __noff = 0; 586*58b9f456SAndroid Build Coastguard Worker break; 587*58b9f456SAndroid Build Coastguard Worker case ios_base::cur: 588*58b9f456SAndroid Build Coastguard Worker if (__wch & ios_base::in) 589*58b9f456SAndroid Build Coastguard Worker __noff = this->gptr() - this->eback(); 590*58b9f456SAndroid Build Coastguard Worker else 591*58b9f456SAndroid Build Coastguard Worker __noff = this->pptr() - this->pbase(); 592*58b9f456SAndroid Build Coastguard Worker break; 593*58b9f456SAndroid Build Coastguard Worker case ios_base::end: 594*58b9f456SAndroid Build Coastguard Worker __noff = __hm; 595*58b9f456SAndroid Build Coastguard Worker break; 596*58b9f456SAndroid Build Coastguard Worker default: 597*58b9f456SAndroid Build Coastguard Worker return pos_type(-1); 598*58b9f456SAndroid Build Coastguard Worker } 599*58b9f456SAndroid Build Coastguard Worker __noff += __off; 600*58b9f456SAndroid Build Coastguard Worker if (__noff < 0 || __hm < __noff) 601*58b9f456SAndroid Build Coastguard Worker return pos_type(-1); 602*58b9f456SAndroid Build Coastguard Worker if (__noff != 0) 603*58b9f456SAndroid Build Coastguard Worker { 604*58b9f456SAndroid Build Coastguard Worker if ((__wch & ios_base::in) && this->gptr() == 0) 605*58b9f456SAndroid Build Coastguard Worker return pos_type(-1); 606*58b9f456SAndroid Build Coastguard Worker if ((__wch & ios_base::out) && this->pptr() == 0) 607*58b9f456SAndroid Build Coastguard Worker return pos_type(-1); 608*58b9f456SAndroid Build Coastguard Worker } 609*58b9f456SAndroid Build Coastguard Worker if (__wch & ios_base::in) 610*58b9f456SAndroid Build Coastguard Worker this->setg(this->eback(), this->eback() + __noff, __hm_); 611*58b9f456SAndroid Build Coastguard Worker if (__wch & ios_base::out) 612*58b9f456SAndroid Build Coastguard Worker { 613*58b9f456SAndroid Build Coastguard Worker this->setp(this->pbase(), this->epptr()); 614*58b9f456SAndroid Build Coastguard Worker this->pbump(__noff); 615*58b9f456SAndroid Build Coastguard Worker } 616*58b9f456SAndroid Build Coastguard Worker return pos_type(__noff); 617*58b9f456SAndroid Build Coastguard Worker} 618*58b9f456SAndroid Build Coastguard Worker 619*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 620*58b9f456SAndroid Build Coastguard Workertypename basic_stringbuf<_CharT, _Traits, _Allocator>::pos_type 621*58b9f456SAndroid Build Coastguard Workerbasic_stringbuf<_CharT, _Traits, _Allocator>::seekpos(pos_type __sp, 622*58b9f456SAndroid Build Coastguard Worker ios_base::openmode __wch) 623*58b9f456SAndroid Build Coastguard Worker{ 624*58b9f456SAndroid Build Coastguard Worker return seekoff(__sp, ios_base::beg, __wch); 625*58b9f456SAndroid Build Coastguard Worker} 626*58b9f456SAndroid Build Coastguard Worker 627*58b9f456SAndroid Build Coastguard Worker// basic_istringstream 628*58b9f456SAndroid Build Coastguard Worker 629*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 630*58b9f456SAndroid Build Coastguard Workerclass _LIBCPP_TEMPLATE_VIS basic_istringstream 631*58b9f456SAndroid Build Coastguard Worker : public basic_istream<_CharT, _Traits> 632*58b9f456SAndroid Build Coastguard Worker{ 633*58b9f456SAndroid Build Coastguard Workerpublic: 634*58b9f456SAndroid Build Coastguard Worker typedef _CharT char_type; 635*58b9f456SAndroid Build Coastguard Worker typedef _Traits traits_type; 636*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::int_type int_type; 637*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::pos_type pos_type; 638*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::off_type off_type; 639*58b9f456SAndroid Build Coastguard Worker typedef _Allocator allocator_type; 640*58b9f456SAndroid Build Coastguard Worker 641*58b9f456SAndroid Build Coastguard Worker typedef basic_string<char_type, traits_type, allocator_type> string_type; 642*58b9f456SAndroid Build Coastguard Worker 643*58b9f456SAndroid Build Coastguard Workerprivate: 644*58b9f456SAndroid Build Coastguard Worker basic_stringbuf<char_type, traits_type, allocator_type> __sb_; 645*58b9f456SAndroid Build Coastguard Worker 646*58b9f456SAndroid Build Coastguard Workerpublic: 647*58b9f456SAndroid Build Coastguard Worker // 27.8.2.1 Constructors: 648*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 649*58b9f456SAndroid Build Coastguard Worker explicit basic_istringstream(ios_base::openmode __wch = ios_base::in); 650*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 651*58b9f456SAndroid Build Coastguard Worker explicit basic_istringstream(const string_type& __s, 652*58b9f456SAndroid Build Coastguard Worker ios_base::openmode __wch = ios_base::in); 653*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 654*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 655*58b9f456SAndroid Build Coastguard Worker basic_istringstream(basic_istringstream&& __rhs); 656*58b9f456SAndroid Build Coastguard Worker 657*58b9f456SAndroid Build Coastguard Worker // 27.8.2.2 Assign and swap: 658*58b9f456SAndroid Build Coastguard Worker basic_istringstream& operator=(basic_istringstream&& __rhs); 659*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_LANG 660*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 661*58b9f456SAndroid Build Coastguard Worker void swap(basic_istringstream& __rhs); 662*58b9f456SAndroid Build Coastguard Worker 663*58b9f456SAndroid Build Coastguard Worker // 27.8.2.3 Members: 664*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 665*58b9f456SAndroid Build Coastguard Worker basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; 666*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 667*58b9f456SAndroid Build Coastguard Worker string_type str() const; 668*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 669*58b9f456SAndroid Build Coastguard Worker void str(const string_type& __s); 670*58b9f456SAndroid Build Coastguard Worker}; 671*58b9f456SAndroid Build Coastguard Worker 672*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 673*58b9f456SAndroid Build Coastguard Workerbasic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(ios_base::openmode __wch) 674*58b9f456SAndroid Build Coastguard Worker : basic_istream<_CharT, _Traits>(&__sb_), 675*58b9f456SAndroid Build Coastguard Worker __sb_(__wch | ios_base::in) 676*58b9f456SAndroid Build Coastguard Worker{ 677*58b9f456SAndroid Build Coastguard Worker} 678*58b9f456SAndroid Build Coastguard Worker 679*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 680*58b9f456SAndroid Build Coastguard Workerbasic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const string_type& __s, 681*58b9f456SAndroid Build Coastguard Worker ios_base::openmode __wch) 682*58b9f456SAndroid Build Coastguard Worker : basic_istream<_CharT, _Traits>(&__sb_), 683*58b9f456SAndroid Build Coastguard Worker __sb_(__s, __wch | ios_base::in) 684*58b9f456SAndroid Build Coastguard Worker{ 685*58b9f456SAndroid Build Coastguard Worker} 686*58b9f456SAndroid Build Coastguard Worker 687*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 688*58b9f456SAndroid Build Coastguard Worker 689*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 690*58b9f456SAndroid Build Coastguard Workerbasic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(basic_istringstream&& __rhs) 691*58b9f456SAndroid Build Coastguard Worker : basic_istream<_CharT, _Traits>(_VSTD::move(__rhs)), 692*58b9f456SAndroid Build Coastguard Worker __sb_(_VSTD::move(__rhs.__sb_)) 693*58b9f456SAndroid Build Coastguard Worker{ 694*58b9f456SAndroid Build Coastguard Worker basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_); 695*58b9f456SAndroid Build Coastguard Worker} 696*58b9f456SAndroid Build Coastguard Worker 697*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 698*58b9f456SAndroid Build Coastguard Workerbasic_istringstream<_CharT, _Traits, _Allocator>& 699*58b9f456SAndroid Build Coastguard Workerbasic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream&& __rhs) 700*58b9f456SAndroid Build Coastguard Worker{ 701*58b9f456SAndroid Build Coastguard Worker basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); 702*58b9f456SAndroid Build Coastguard Worker __sb_ = _VSTD::move(__rhs.__sb_); 703*58b9f456SAndroid Build Coastguard Worker return *this; 704*58b9f456SAndroid Build Coastguard Worker} 705*58b9f456SAndroid Build Coastguard Worker 706*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_LANG 707*58b9f456SAndroid Build Coastguard Worker 708*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 709*58b9f456SAndroid Build Coastguard Workervoid basic_istringstream<_CharT, _Traits, _Allocator>::swap(basic_istringstream& __rhs) 710*58b9f456SAndroid Build Coastguard Worker{ 711*58b9f456SAndroid Build Coastguard Worker basic_istream<char_type, traits_type>::swap(__rhs); 712*58b9f456SAndroid Build Coastguard Worker __sb_.swap(__rhs.__sb_); 713*58b9f456SAndroid Build Coastguard Worker} 714*58b9f456SAndroid Build Coastguard Worker 715*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 716*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 717*58b9f456SAndroid Build Coastguard Workervoid 718*58b9f456SAndroid Build Coastguard Workerswap(basic_istringstream<_CharT, _Traits, _Allocator>& __x, 719*58b9f456SAndroid Build Coastguard Worker basic_istringstream<_CharT, _Traits, _Allocator>& __y) 720*58b9f456SAndroid Build Coastguard Worker{ 721*58b9f456SAndroid Build Coastguard Worker __x.swap(__y); 722*58b9f456SAndroid Build Coastguard Worker} 723*58b9f456SAndroid Build Coastguard Worker 724*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 725*58b9f456SAndroid Build Coastguard Workerbasic_stringbuf<_CharT, _Traits, _Allocator>* 726*58b9f456SAndroid Build Coastguard Workerbasic_istringstream<_CharT, _Traits, _Allocator>::rdbuf() const 727*58b9f456SAndroid Build Coastguard Worker{ 728*58b9f456SAndroid Build Coastguard Worker return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); 729*58b9f456SAndroid Build Coastguard Worker} 730*58b9f456SAndroid Build Coastguard Worker 731*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 732*58b9f456SAndroid Build Coastguard Workerbasic_string<_CharT, _Traits, _Allocator> 733*58b9f456SAndroid Build Coastguard Workerbasic_istringstream<_CharT, _Traits, _Allocator>::str() const 734*58b9f456SAndroid Build Coastguard Worker{ 735*58b9f456SAndroid Build Coastguard Worker return __sb_.str(); 736*58b9f456SAndroid Build Coastguard Worker} 737*58b9f456SAndroid Build Coastguard Worker 738*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 739*58b9f456SAndroid Build Coastguard Workervoid basic_istringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s) 740*58b9f456SAndroid Build Coastguard Worker{ 741*58b9f456SAndroid Build Coastguard Worker __sb_.str(__s); 742*58b9f456SAndroid Build Coastguard Worker} 743*58b9f456SAndroid Build Coastguard Worker 744*58b9f456SAndroid Build Coastguard Worker// basic_ostringstream 745*58b9f456SAndroid Build Coastguard Worker 746*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 747*58b9f456SAndroid Build Coastguard Workerclass _LIBCPP_TEMPLATE_VIS basic_ostringstream 748*58b9f456SAndroid Build Coastguard Worker : public basic_ostream<_CharT, _Traits> 749*58b9f456SAndroid Build Coastguard Worker{ 750*58b9f456SAndroid Build Coastguard Workerpublic: 751*58b9f456SAndroid Build Coastguard Worker typedef _CharT char_type; 752*58b9f456SAndroid Build Coastguard Worker typedef _Traits traits_type; 753*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::int_type int_type; 754*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::pos_type pos_type; 755*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::off_type off_type; 756*58b9f456SAndroid Build Coastguard Worker typedef _Allocator allocator_type; 757*58b9f456SAndroid Build Coastguard Worker 758*58b9f456SAndroid Build Coastguard Worker typedef basic_string<char_type, traits_type, allocator_type> string_type; 759*58b9f456SAndroid Build Coastguard Worker 760*58b9f456SAndroid Build Coastguard Workerprivate: 761*58b9f456SAndroid Build Coastguard Worker basic_stringbuf<char_type, traits_type, allocator_type> __sb_; 762*58b9f456SAndroid Build Coastguard Worker 763*58b9f456SAndroid Build Coastguard Workerpublic: 764*58b9f456SAndroid Build Coastguard Worker // 27.8.2.1 Constructors: 765*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 766*58b9f456SAndroid Build Coastguard Worker explicit basic_ostringstream(ios_base::openmode __wch = ios_base::out); 767*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 768*58b9f456SAndroid Build Coastguard Worker explicit basic_ostringstream(const string_type& __s, 769*58b9f456SAndroid Build Coastguard Worker ios_base::openmode __wch = ios_base::out); 770*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 771*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 772*58b9f456SAndroid Build Coastguard Worker basic_ostringstream(basic_ostringstream&& __rhs); 773*58b9f456SAndroid Build Coastguard Worker 774*58b9f456SAndroid Build Coastguard Worker // 27.8.2.2 Assign and swap: 775*58b9f456SAndroid Build Coastguard Worker basic_ostringstream& operator=(basic_ostringstream&& __rhs); 776*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_LANG 777*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 778*58b9f456SAndroid Build Coastguard Worker void swap(basic_ostringstream& __rhs); 779*58b9f456SAndroid Build Coastguard Worker 780*58b9f456SAndroid Build Coastguard Worker // 27.8.2.3 Members: 781*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 782*58b9f456SAndroid Build Coastguard Worker basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; 783*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 784*58b9f456SAndroid Build Coastguard Worker string_type str() const; 785*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 786*58b9f456SAndroid Build Coastguard Worker void str(const string_type& __s); 787*58b9f456SAndroid Build Coastguard Worker}; 788*58b9f456SAndroid Build Coastguard Worker 789*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 790*58b9f456SAndroid Build Coastguard Workerbasic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(ios_base::openmode __wch) 791*58b9f456SAndroid Build Coastguard Worker : basic_ostream<_CharT, _Traits>(&__sb_), 792*58b9f456SAndroid Build Coastguard Worker __sb_(__wch | ios_base::out) 793*58b9f456SAndroid Build Coastguard Worker{ 794*58b9f456SAndroid Build Coastguard Worker} 795*58b9f456SAndroid Build Coastguard Worker 796*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 797*58b9f456SAndroid Build Coastguard Workerbasic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const string_type& __s, 798*58b9f456SAndroid Build Coastguard Worker ios_base::openmode __wch) 799*58b9f456SAndroid Build Coastguard Worker : basic_ostream<_CharT, _Traits>(&__sb_), 800*58b9f456SAndroid Build Coastguard Worker __sb_(__s, __wch | ios_base::out) 801*58b9f456SAndroid Build Coastguard Worker{ 802*58b9f456SAndroid Build Coastguard Worker} 803*58b9f456SAndroid Build Coastguard Worker 804*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 805*58b9f456SAndroid Build Coastguard Worker 806*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 807*58b9f456SAndroid Build Coastguard Workerbasic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(basic_ostringstream&& __rhs) 808*58b9f456SAndroid Build Coastguard Worker : basic_ostream<_CharT, _Traits>(_VSTD::move(__rhs)), 809*58b9f456SAndroid Build Coastguard Worker __sb_(_VSTD::move(__rhs.__sb_)) 810*58b9f456SAndroid Build Coastguard Worker{ 811*58b9f456SAndroid Build Coastguard Worker basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_); 812*58b9f456SAndroid Build Coastguard Worker} 813*58b9f456SAndroid Build Coastguard Worker 814*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 815*58b9f456SAndroid Build Coastguard Workerbasic_ostringstream<_CharT, _Traits, _Allocator>& 816*58b9f456SAndroid Build Coastguard Workerbasic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream&& __rhs) 817*58b9f456SAndroid Build Coastguard Worker{ 818*58b9f456SAndroid Build Coastguard Worker basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); 819*58b9f456SAndroid Build Coastguard Worker __sb_ = _VSTD::move(__rhs.__sb_); 820*58b9f456SAndroid Build Coastguard Worker return *this; 821*58b9f456SAndroid Build Coastguard Worker} 822*58b9f456SAndroid Build Coastguard Worker 823*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_LANG 824*58b9f456SAndroid Build Coastguard Worker 825*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 826*58b9f456SAndroid Build Coastguard Workervoid 827*58b9f456SAndroid Build Coastguard Workerbasic_ostringstream<_CharT, _Traits, _Allocator>::swap(basic_ostringstream& __rhs) 828*58b9f456SAndroid Build Coastguard Worker{ 829*58b9f456SAndroid Build Coastguard Worker basic_ostream<char_type, traits_type>::swap(__rhs); 830*58b9f456SAndroid Build Coastguard Worker __sb_.swap(__rhs.__sb_); 831*58b9f456SAndroid Build Coastguard Worker} 832*58b9f456SAndroid Build Coastguard Worker 833*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 834*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 835*58b9f456SAndroid Build Coastguard Workervoid 836*58b9f456SAndroid Build Coastguard Workerswap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x, 837*58b9f456SAndroid Build Coastguard Worker basic_ostringstream<_CharT, _Traits, _Allocator>& __y) 838*58b9f456SAndroid Build Coastguard Worker{ 839*58b9f456SAndroid Build Coastguard Worker __x.swap(__y); 840*58b9f456SAndroid Build Coastguard Worker} 841*58b9f456SAndroid Build Coastguard Worker 842*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 843*58b9f456SAndroid Build Coastguard Workerbasic_stringbuf<_CharT, _Traits, _Allocator>* 844*58b9f456SAndroid Build Coastguard Workerbasic_ostringstream<_CharT, _Traits, _Allocator>::rdbuf() const 845*58b9f456SAndroid Build Coastguard Worker{ 846*58b9f456SAndroid Build Coastguard Worker return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); 847*58b9f456SAndroid Build Coastguard Worker} 848*58b9f456SAndroid Build Coastguard Worker 849*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 850*58b9f456SAndroid Build Coastguard Workerbasic_string<_CharT, _Traits, _Allocator> 851*58b9f456SAndroid Build Coastguard Workerbasic_ostringstream<_CharT, _Traits, _Allocator>::str() const 852*58b9f456SAndroid Build Coastguard Worker{ 853*58b9f456SAndroid Build Coastguard Worker return __sb_.str(); 854*58b9f456SAndroid Build Coastguard Worker} 855*58b9f456SAndroid Build Coastguard Worker 856*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 857*58b9f456SAndroid Build Coastguard Workervoid 858*58b9f456SAndroid Build Coastguard Workerbasic_ostringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s) 859*58b9f456SAndroid Build Coastguard Worker{ 860*58b9f456SAndroid Build Coastguard Worker __sb_.str(__s); 861*58b9f456SAndroid Build Coastguard Worker} 862*58b9f456SAndroid Build Coastguard Worker 863*58b9f456SAndroid Build Coastguard Worker// basic_stringstream 864*58b9f456SAndroid Build Coastguard Worker 865*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 866*58b9f456SAndroid Build Coastguard Workerclass _LIBCPP_TEMPLATE_VIS basic_stringstream 867*58b9f456SAndroid Build Coastguard Worker : public basic_iostream<_CharT, _Traits> 868*58b9f456SAndroid Build Coastguard Worker{ 869*58b9f456SAndroid Build Coastguard Workerpublic: 870*58b9f456SAndroid Build Coastguard Worker typedef _CharT char_type; 871*58b9f456SAndroid Build Coastguard Worker typedef _Traits traits_type; 872*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::int_type int_type; 873*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::pos_type pos_type; 874*58b9f456SAndroid Build Coastguard Worker typedef typename traits_type::off_type off_type; 875*58b9f456SAndroid Build Coastguard Worker typedef _Allocator allocator_type; 876*58b9f456SAndroid Build Coastguard Worker 877*58b9f456SAndroid Build Coastguard Worker typedef basic_string<char_type, traits_type, allocator_type> string_type; 878*58b9f456SAndroid Build Coastguard Worker 879*58b9f456SAndroid Build Coastguard Workerprivate: 880*58b9f456SAndroid Build Coastguard Worker basic_stringbuf<char_type, traits_type, allocator_type> __sb_; 881*58b9f456SAndroid Build Coastguard Worker 882*58b9f456SAndroid Build Coastguard Workerpublic: 883*58b9f456SAndroid Build Coastguard Worker // 27.8.2.1 Constructors: 884*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 885*58b9f456SAndroid Build Coastguard Worker explicit basic_stringstream(ios_base::openmode __wch = ios_base::in | ios_base::out); 886*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 887*58b9f456SAndroid Build Coastguard Worker explicit basic_stringstream(const string_type& __s, 888*58b9f456SAndroid Build Coastguard Worker ios_base::openmode __wch = ios_base::in | ios_base::out); 889*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 890*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 891*58b9f456SAndroid Build Coastguard Worker basic_stringstream(basic_stringstream&& __rhs); 892*58b9f456SAndroid Build Coastguard Worker 893*58b9f456SAndroid Build Coastguard Worker // 27.8.2.2 Assign and swap: 894*58b9f456SAndroid Build Coastguard Worker basic_stringstream& operator=(basic_stringstream&& __rhs); 895*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_LANG 896*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 897*58b9f456SAndroid Build Coastguard Worker void swap(basic_stringstream& __rhs); 898*58b9f456SAndroid Build Coastguard Worker 899*58b9f456SAndroid Build Coastguard Worker // 27.8.2.3 Members: 900*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 901*58b9f456SAndroid Build Coastguard Worker basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; 902*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 903*58b9f456SAndroid Build Coastguard Worker string_type str() const; 904*58b9f456SAndroid Build Coastguard Worker inline _LIBCPP_INLINE_VISIBILITY 905*58b9f456SAndroid Build Coastguard Worker void str(const string_type& __s); 906*58b9f456SAndroid Build Coastguard Worker}; 907*58b9f456SAndroid Build Coastguard Worker 908*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 909*58b9f456SAndroid Build Coastguard Workerbasic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(ios_base::openmode __wch) 910*58b9f456SAndroid Build Coastguard Worker : basic_iostream<_CharT, _Traits>(&__sb_), 911*58b9f456SAndroid Build Coastguard Worker __sb_(__wch) 912*58b9f456SAndroid Build Coastguard Worker{ 913*58b9f456SAndroid Build Coastguard Worker} 914*58b9f456SAndroid Build Coastguard Worker 915*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 916*58b9f456SAndroid Build Coastguard Workerbasic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string_type& __s, 917*58b9f456SAndroid Build Coastguard Worker ios_base::openmode __wch) 918*58b9f456SAndroid Build Coastguard Worker : basic_iostream<_CharT, _Traits>(&__sb_), 919*58b9f456SAndroid Build Coastguard Worker __sb_(__s, __wch) 920*58b9f456SAndroid Build Coastguard Worker{ 921*58b9f456SAndroid Build Coastguard Worker} 922*58b9f456SAndroid Build Coastguard Worker 923*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG 924*58b9f456SAndroid Build Coastguard Worker 925*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 926*58b9f456SAndroid Build Coastguard Workerbasic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(basic_stringstream&& __rhs) 927*58b9f456SAndroid Build Coastguard Worker : basic_iostream<_CharT, _Traits>(_VSTD::move(__rhs)), 928*58b9f456SAndroid Build Coastguard Worker __sb_(_VSTD::move(__rhs.__sb_)) 929*58b9f456SAndroid Build Coastguard Worker{ 930*58b9f456SAndroid Build Coastguard Worker basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_); 931*58b9f456SAndroid Build Coastguard Worker} 932*58b9f456SAndroid Build Coastguard Worker 933*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 934*58b9f456SAndroid Build Coastguard Workerbasic_stringstream<_CharT, _Traits, _Allocator>& 935*58b9f456SAndroid Build Coastguard Workerbasic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&& __rhs) 936*58b9f456SAndroid Build Coastguard Worker{ 937*58b9f456SAndroid Build Coastguard Worker basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); 938*58b9f456SAndroid Build Coastguard Worker __sb_ = _VSTD::move(__rhs.__sb_); 939*58b9f456SAndroid Build Coastguard Worker return *this; 940*58b9f456SAndroid Build Coastguard Worker} 941*58b9f456SAndroid Build Coastguard Worker 942*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_LANG 943*58b9f456SAndroid Build Coastguard Worker 944*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 945*58b9f456SAndroid Build Coastguard Workervoid 946*58b9f456SAndroid Build Coastguard Workerbasic_stringstream<_CharT, _Traits, _Allocator>::swap(basic_stringstream& __rhs) 947*58b9f456SAndroid Build Coastguard Worker{ 948*58b9f456SAndroid Build Coastguard Worker basic_iostream<char_type, traits_type>::swap(__rhs); 949*58b9f456SAndroid Build Coastguard Worker __sb_.swap(__rhs.__sb_); 950*58b9f456SAndroid Build Coastguard Worker} 951*58b9f456SAndroid Build Coastguard Worker 952*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 953*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY 954*58b9f456SAndroid Build Coastguard Workervoid 955*58b9f456SAndroid Build Coastguard Workerswap(basic_stringstream<_CharT, _Traits, _Allocator>& __x, 956*58b9f456SAndroid Build Coastguard Worker basic_stringstream<_CharT, _Traits, _Allocator>& __y) 957*58b9f456SAndroid Build Coastguard Worker{ 958*58b9f456SAndroid Build Coastguard Worker __x.swap(__y); 959*58b9f456SAndroid Build Coastguard Worker} 960*58b9f456SAndroid Build Coastguard Worker 961*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 962*58b9f456SAndroid Build Coastguard Workerbasic_stringbuf<_CharT, _Traits, _Allocator>* 963*58b9f456SAndroid Build Coastguard Workerbasic_stringstream<_CharT, _Traits, _Allocator>::rdbuf() const 964*58b9f456SAndroid Build Coastguard Worker{ 965*58b9f456SAndroid Build Coastguard Worker return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); 966*58b9f456SAndroid Build Coastguard Worker} 967*58b9f456SAndroid Build Coastguard Worker 968*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 969*58b9f456SAndroid Build Coastguard Workerbasic_string<_CharT, _Traits, _Allocator> 970*58b9f456SAndroid Build Coastguard Workerbasic_stringstream<_CharT, _Traits, _Allocator>::str() const 971*58b9f456SAndroid Build Coastguard Worker{ 972*58b9f456SAndroid Build Coastguard Worker return __sb_.str(); 973*58b9f456SAndroid Build Coastguard Worker} 974*58b9f456SAndroid Build Coastguard Worker 975*58b9f456SAndroid Build Coastguard Workertemplate <class _CharT, class _Traits, class _Allocator> 976*58b9f456SAndroid Build Coastguard Workervoid 977*58b9f456SAndroid Build Coastguard Workerbasic_stringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s) 978*58b9f456SAndroid Build Coastguard Worker{ 979*58b9f456SAndroid Build Coastguard Worker __sb_.str(__s); 980*58b9f456SAndroid Build Coastguard Worker} 981*58b9f456SAndroid Build Coastguard Worker 982*58b9f456SAndroid Build Coastguard Worker_LIBCPP_END_NAMESPACE_STD 983*58b9f456SAndroid Build Coastguard Worker 984*58b9f456SAndroid Build Coastguard Worker_LIBCPP_POP_MACROS 985*58b9f456SAndroid Build Coastguard Worker 986*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_SSTREAM 987