14684ddb6SLionel Sambuc// -*- C++ -*- 24684ddb6SLionel Sambuc//===--------------------------- sstream ----------------------------------===// 34684ddb6SLionel Sambuc// 44684ddb6SLionel Sambuc// The LLVM Compiler Infrastructure 54684ddb6SLionel Sambuc// 64684ddb6SLionel Sambuc// This file is dual licensed under the MIT and the University of Illinois Open 74684ddb6SLionel Sambuc// Source Licenses. See LICENSE.TXT for details. 84684ddb6SLionel Sambuc// 94684ddb6SLionel Sambuc//===----------------------------------------------------------------------===// 104684ddb6SLionel Sambuc 114684ddb6SLionel Sambuc#ifndef _LIBCPP_SSTREAM 124684ddb6SLionel Sambuc#define _LIBCPP_SSTREAM 134684ddb6SLionel Sambuc 144684ddb6SLionel Sambuc/* 154684ddb6SLionel Sambuc sstream synopsis 164684ddb6SLionel Sambuc 174684ddb6SLionel Sambuctemplate <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > 184684ddb6SLionel Sambucclass basic_stringbuf 194684ddb6SLionel Sambuc : public basic_streambuf<charT, traits> 204684ddb6SLionel Sambuc{ 214684ddb6SLionel Sambucpublic: 224684ddb6SLionel Sambuc typedef charT char_type; 234684ddb6SLionel Sambuc typedef traits traits_type; 244684ddb6SLionel Sambuc typedef typename traits_type::int_type int_type; 254684ddb6SLionel Sambuc typedef typename traits_type::pos_type pos_type; 264684ddb6SLionel Sambuc typedef typename traits_type::off_type off_type; 274684ddb6SLionel Sambuc typedef Allocator allocator_type; 284684ddb6SLionel Sambuc 294684ddb6SLionel Sambuc // 27.8.1.1 Constructors: 304684ddb6SLionel Sambuc explicit basic_stringbuf(ios_base::openmode which = ios_base::in | ios_base::out); 314684ddb6SLionel Sambuc explicit basic_stringbuf(const basic_string<char_type, traits_type, allocator_type>& str, 324684ddb6SLionel Sambuc ios_base::openmode which = ios_base::in | ios_base::out); 334684ddb6SLionel Sambuc basic_stringbuf(basic_stringbuf&& rhs); 344684ddb6SLionel Sambuc 354684ddb6SLionel Sambuc // 27.8.1.2 Assign and swap: 364684ddb6SLionel Sambuc basic_stringbuf& operator=(basic_stringbuf&& rhs); 374684ddb6SLionel Sambuc void swap(basic_stringbuf& rhs); 384684ddb6SLionel Sambuc 394684ddb6SLionel Sambuc // 27.8.1.3 Get and set: 404684ddb6SLionel Sambuc basic_string<char_type, traits_type, allocator_type> str() const; 414684ddb6SLionel Sambuc void str(const basic_string<char_type, traits_type, allocator_type>& s); 424684ddb6SLionel Sambuc 434684ddb6SLionel Sambucprotected: 444684ddb6SLionel Sambuc // 27.8.1.4 Overridden virtual functions: 454684ddb6SLionel Sambuc virtual int_type underflow(); 464684ddb6SLionel Sambuc virtual int_type pbackfail(int_type c = traits_type::eof()); 474684ddb6SLionel Sambuc virtual int_type overflow (int_type c = traits_type::eof()); 484684ddb6SLionel Sambuc virtual basic_streambuf<char_type, traits_type>* setbuf(char_type*, streamsize); 494684ddb6SLionel Sambuc virtual pos_type seekoff(off_type off, ios_base::seekdir way, 504684ddb6SLionel Sambuc ios_base::openmode which = ios_base::in | ios_base::out); 514684ddb6SLionel Sambuc virtual pos_type seekpos(pos_type sp, 524684ddb6SLionel Sambuc ios_base::openmode which = ios_base::in | ios_base::out); 534684ddb6SLionel Sambuc}; 544684ddb6SLionel Sambuc 554684ddb6SLionel Sambuctemplate <class charT, class traits, class Allocator> 564684ddb6SLionel Sambuc void swap(basic_stringbuf<charT, traits, Allocator>& x, 574684ddb6SLionel Sambuc basic_stringbuf<charT, traits, Allocator>& y); 584684ddb6SLionel Sambuc 594684ddb6SLionel Sambuctypedef basic_stringbuf<char> stringbuf; 604684ddb6SLionel Sambuctypedef basic_stringbuf<wchar_t> wstringbuf; 614684ddb6SLionel Sambuc 624684ddb6SLionel Sambuctemplate <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > 634684ddb6SLionel Sambucclass basic_istringstream 644684ddb6SLionel Sambuc : public basic_istream<charT, traits> 654684ddb6SLionel Sambuc{ 664684ddb6SLionel Sambucpublic: 674684ddb6SLionel Sambuc typedef charT char_type; 684684ddb6SLionel Sambuc typedef traits traits_type; 694684ddb6SLionel Sambuc typedef typename traits_type::int_type int_type; 704684ddb6SLionel Sambuc typedef typename traits_type::pos_type pos_type; 714684ddb6SLionel Sambuc typedef typename traits_type::off_type off_type; 724684ddb6SLionel Sambuc typedef Allocator allocator_type; 734684ddb6SLionel Sambuc 744684ddb6SLionel Sambuc // 27.8.2.1 Constructors: 754684ddb6SLionel Sambuc explicit basic_istringstream(ios_base::openmode which = ios_base::in); 764684ddb6SLionel Sambuc explicit basic_istringstream(const basic_string<char_type, traits_type,allocator_type>& str, 774684ddb6SLionel Sambuc ios_base::openmode which = ios_base::in); 784684ddb6SLionel Sambuc basic_istringstream(basic_istringstream&& rhs); 794684ddb6SLionel Sambuc 804684ddb6SLionel Sambuc // 27.8.2.2 Assign and swap: 814684ddb6SLionel Sambuc basic_istringstream& operator=(basic_istringstream&& rhs); 824684ddb6SLionel Sambuc void swap(basic_istringstream& rhs); 834684ddb6SLionel Sambuc 844684ddb6SLionel Sambuc // 27.8.2.3 Members: 854684ddb6SLionel Sambuc basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; 864684ddb6SLionel Sambuc basic_string<char_type, traits_type, allocator_type> str() const; 874684ddb6SLionel Sambuc void str(const basic_string<char_type, traits_type, allocator_type>& s); 884684ddb6SLionel Sambuc}; 894684ddb6SLionel Sambuc 904684ddb6SLionel Sambuctemplate <class charT, class traits, class Allocator> 914684ddb6SLionel Sambuc void swap(basic_istringstream<charT, traits, Allocator>& x, 924684ddb6SLionel Sambuc basic_istringstream<charT, traits, Allocator>& y); 934684ddb6SLionel Sambuc 944684ddb6SLionel Sambuctypedef basic_istringstream<char> istringstream; 954684ddb6SLionel Sambuctypedef basic_istringstream<wchar_t> wistringstream; 964684ddb6SLionel Sambuc 974684ddb6SLionel Sambuctemplate <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > 984684ddb6SLionel Sambucclass basic_ostringstream 994684ddb6SLionel Sambuc : public basic_ostream<charT, traits> 1004684ddb6SLionel Sambuc{ 1014684ddb6SLionel Sambucpublic: 1024684ddb6SLionel Sambuc // types: 1034684ddb6SLionel Sambuc typedef charT char_type; 1044684ddb6SLionel Sambuc typedef traits traits_type; 1054684ddb6SLionel Sambuc typedef typename traits_type::int_type int_type; 1064684ddb6SLionel Sambuc typedef typename traits_type::pos_type pos_type; 1074684ddb6SLionel Sambuc typedef typename traits_type::off_type off_type; 1084684ddb6SLionel Sambuc typedef Allocator allocator_type; 1094684ddb6SLionel Sambuc 1104684ddb6SLionel Sambuc // 27.8.3.1 Constructors/destructor: 1114684ddb6SLionel Sambuc explicit basic_ostringstream(ios_base::openmode which = ios_base::out); 1124684ddb6SLionel Sambuc explicit basic_ostringstream(const basic_string<char_type, traits_type, allocator_type>& str, 1134684ddb6SLionel Sambuc ios_base::openmode which = ios_base::out); 1144684ddb6SLionel Sambuc basic_ostringstream(basic_ostringstream&& rhs); 1154684ddb6SLionel Sambuc 1164684ddb6SLionel Sambuc // 27.8.3.2 Assign/swap: 1174684ddb6SLionel Sambuc basic_ostringstream& operator=(basic_ostringstream&& rhs); 1184684ddb6SLionel Sambuc void swap(basic_ostringstream& rhs); 1194684ddb6SLionel Sambuc 1204684ddb6SLionel Sambuc // 27.8.3.3 Members: 1214684ddb6SLionel Sambuc basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; 1224684ddb6SLionel Sambuc basic_string<char_type, traits_type, allocator_type> str() const; 1234684ddb6SLionel Sambuc void str(const basic_string<char_type, traits_type, allocator_type>& s); 1244684ddb6SLionel Sambuc}; 1254684ddb6SLionel Sambuc 1264684ddb6SLionel Sambuctemplate <class charT, class traits, class Allocator> 1274684ddb6SLionel Sambuc void swap(basic_ostringstream<charT, traits, Allocator>& x, 1284684ddb6SLionel Sambuc basic_ostringstream<charT, traits, Allocator>& y); 1294684ddb6SLionel Sambuc 1304684ddb6SLionel Sambuctypedef basic_ostringstream<char> ostringstream; 1314684ddb6SLionel Sambuctypedef basic_ostringstream<wchar_t> wostringstream; 1324684ddb6SLionel Sambuc 1334684ddb6SLionel Sambuctemplate <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > 1344684ddb6SLionel Sambucclass basic_stringstream 1354684ddb6SLionel Sambuc : public basic_iostream<charT, traits> 1364684ddb6SLionel Sambuc{ 1374684ddb6SLionel Sambucpublic: 1384684ddb6SLionel Sambuc // types: 1394684ddb6SLionel Sambuc typedef charT char_type; 1404684ddb6SLionel Sambuc typedef traits traits_type; 1414684ddb6SLionel Sambuc typedef typename traits_type::int_type int_type; 1424684ddb6SLionel Sambuc typedef typename traits_type::pos_type pos_type; 1434684ddb6SLionel Sambuc typedef typename traits_type::off_type off_type; 1444684ddb6SLionel Sambuc typedef Allocator allocator_type; 1454684ddb6SLionel Sambuc 1464684ddb6SLionel Sambuc // constructors/destructor 1474684ddb6SLionel Sambuc explicit basic_stringstream(ios_base::openmode which = ios_base::out|ios_base::in); 1484684ddb6SLionel Sambuc explicit basic_stringstream(const basic_string<char_type, traits_type, allocator_type>& str, 1494684ddb6SLionel Sambuc ios_base::openmode which = ios_base::out|ios_base::in); 1504684ddb6SLionel Sambuc basic_stringstream(basic_stringstream&& rhs); 1514684ddb6SLionel Sambuc 1524684ddb6SLionel Sambuc // 27.8.5.1 Assign/swap: 1534684ddb6SLionel Sambuc basic_stringstream& operator=(basic_stringstream&& rhs); 1544684ddb6SLionel Sambuc void swap(basic_stringstream& rhs); 1554684ddb6SLionel Sambuc 1564684ddb6SLionel Sambuc // Members: 1574684ddb6SLionel Sambuc basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; 1584684ddb6SLionel Sambuc basic_string<char_type, traits_type, allocator_type> str() const; 1594684ddb6SLionel Sambuc void str(const basic_string<char_type, traits_type, allocator_type>& str); 1604684ddb6SLionel Sambuc}; 1614684ddb6SLionel Sambuc 1624684ddb6SLionel Sambuctemplate <class charT, class traits, class Allocator> 1634684ddb6SLionel Sambuc void swap(basic_stringstream<charT, traits, Allocator>& x, 1644684ddb6SLionel Sambuc basic_stringstream<charT, traits, Allocator>& y); 1654684ddb6SLionel Sambuc 1664684ddb6SLionel Sambuctypedef basic_stringstream<char> stringstream; 1674684ddb6SLionel Sambuctypedef basic_stringstream<wchar_t> wstringstream; 1684684ddb6SLionel Sambuc 1694684ddb6SLionel Sambuc} // std 1704684ddb6SLionel Sambuc 1714684ddb6SLionel Sambuc*/ 1724684ddb6SLionel Sambuc 1734684ddb6SLionel Sambuc#include <__config> 1744684ddb6SLionel Sambuc#include <ostream> 1754684ddb6SLionel Sambuc#include <istream> 1764684ddb6SLionel Sambuc#include <string> 1774684ddb6SLionel Sambuc 1784684ddb6SLionel Sambuc#include <__undef_min_max> 1794684ddb6SLionel Sambuc 1804684ddb6SLionel Sambuc#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 1814684ddb6SLionel Sambuc#pragma GCC system_header 1824684ddb6SLionel Sambuc#endif 1834684ddb6SLionel Sambuc 1844684ddb6SLionel Sambuc_LIBCPP_BEGIN_NAMESPACE_STD 1854684ddb6SLionel Sambuc 1864684ddb6SLionel Sambuc// basic_stringbuf 1874684ddb6SLionel Sambuc 1884684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 1894684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY basic_stringbuf 1904684ddb6SLionel Sambuc : public basic_streambuf<_CharT, _Traits> 1914684ddb6SLionel Sambuc{ 1924684ddb6SLionel Sambucpublic: 1934684ddb6SLionel Sambuc typedef _CharT char_type; 1944684ddb6SLionel Sambuc typedef _Traits traits_type; 1954684ddb6SLionel Sambuc typedef typename traits_type::int_type int_type; 1964684ddb6SLionel Sambuc typedef typename traits_type::pos_type pos_type; 1974684ddb6SLionel Sambuc typedef typename traits_type::off_type off_type; 1984684ddb6SLionel Sambuc typedef _Allocator allocator_type; 1994684ddb6SLionel Sambuc 2004684ddb6SLionel Sambuc typedef basic_string<char_type, traits_type, allocator_type> string_type; 2014684ddb6SLionel Sambuc 2024684ddb6SLionel Sambucprivate: 2034684ddb6SLionel Sambuc 2044684ddb6SLionel Sambuc string_type __str_; 2054684ddb6SLionel Sambuc mutable char_type* __hm_; 2064684ddb6SLionel Sambuc ios_base::openmode __mode_; 2074684ddb6SLionel Sambuc 2084684ddb6SLionel Sambucpublic: 2094684ddb6SLionel Sambuc // 27.8.1.1 Constructors: 2104684ddb6SLionel Sambuc explicit basic_stringbuf(ios_base::openmode __wch = ios_base::in | ios_base::out); 2114684ddb6SLionel Sambuc explicit basic_stringbuf(const string_type& __s, 2124684ddb6SLionel Sambuc ios_base::openmode __wch = ios_base::in | ios_base::out); 2134684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2144684ddb6SLionel Sambuc basic_stringbuf(basic_stringbuf&& __rhs); 2154684ddb6SLionel Sambuc#endif 2164684ddb6SLionel Sambuc 2174684ddb6SLionel Sambuc // 27.8.1.2 Assign and swap: 2184684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2194684ddb6SLionel Sambuc basic_stringbuf& operator=(basic_stringbuf&& __rhs); 2204684ddb6SLionel Sambuc#endif 2214684ddb6SLionel Sambuc void swap(basic_stringbuf& __rhs); 2224684ddb6SLionel Sambuc 2234684ddb6SLionel Sambuc // 27.8.1.3 Get and set: 2244684ddb6SLionel Sambuc string_type str() const; 2254684ddb6SLionel Sambuc void str(const string_type& __s); 2264684ddb6SLionel Sambuc 2274684ddb6SLionel Sambucprotected: 2284684ddb6SLionel Sambuc // 27.8.1.4 Overridden virtual functions: 2294684ddb6SLionel Sambuc virtual int_type underflow(); 2304684ddb6SLionel Sambuc virtual int_type pbackfail(int_type __c = traits_type::eof()); 2314684ddb6SLionel Sambuc virtual int_type overflow (int_type __c = traits_type::eof()); 2324684ddb6SLionel Sambuc virtual pos_type seekoff(off_type __off, ios_base::seekdir __way, 2334684ddb6SLionel Sambuc ios_base::openmode __wch = ios_base::in | ios_base::out); 2344684ddb6SLionel Sambuc virtual pos_type seekpos(pos_type __sp, 2354684ddb6SLionel Sambuc ios_base::openmode __wch = ios_base::in | ios_base::out); 2364684ddb6SLionel Sambuc}; 2374684ddb6SLionel Sambuc 2384684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 2394684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 2404684ddb6SLionel Sambucbasic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(ios_base::openmode __wch) 2414684ddb6SLionel Sambuc : __hm_(0), 2424684ddb6SLionel Sambuc __mode_(__wch) 2434684ddb6SLionel Sambuc{ 2444684ddb6SLionel Sambuc str(string_type()); 2454684ddb6SLionel Sambuc} 2464684ddb6SLionel Sambuc 2474684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 2484684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 2494684ddb6SLionel Sambucbasic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(const string_type& __s, 2504684ddb6SLionel Sambuc ios_base::openmode __wch) 2514684ddb6SLionel Sambuc : __hm_(0), 2524684ddb6SLionel Sambuc __mode_(__wch) 2534684ddb6SLionel Sambuc{ 2544684ddb6SLionel Sambuc str(__s); 2554684ddb6SLionel Sambuc} 2564684ddb6SLionel Sambuc 2574684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2584684ddb6SLionel Sambuc 2594684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 2604684ddb6SLionel Sambucbasic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&& __rhs) 2614684ddb6SLionel Sambuc : __mode_(__rhs.__mode_) 2624684ddb6SLionel Sambuc{ 2634684ddb6SLionel Sambuc char_type* __p = const_cast<char_type*>(__rhs.__str_.data()); 2644684ddb6SLionel Sambuc ptrdiff_t __binp = -1; 2654684ddb6SLionel Sambuc ptrdiff_t __ninp = -1; 2664684ddb6SLionel Sambuc ptrdiff_t __einp = -1; 2674684ddb6SLionel Sambuc if (__rhs.eback() != nullptr) 2684684ddb6SLionel Sambuc { 2694684ddb6SLionel Sambuc __binp = __rhs.eback() - __p; 2704684ddb6SLionel Sambuc __ninp = __rhs.gptr() - __p; 2714684ddb6SLionel Sambuc __einp = __rhs.egptr() - __p; 2724684ddb6SLionel Sambuc } 2734684ddb6SLionel Sambuc ptrdiff_t __bout = -1; 2744684ddb6SLionel Sambuc ptrdiff_t __nout = -1; 2754684ddb6SLionel Sambuc ptrdiff_t __eout = -1; 2764684ddb6SLionel Sambuc if (__rhs.pbase() != nullptr) 2774684ddb6SLionel Sambuc { 2784684ddb6SLionel Sambuc __bout = __rhs.pbase() - __p; 2794684ddb6SLionel Sambuc __nout = __rhs.pptr() - __p; 2804684ddb6SLionel Sambuc __eout = __rhs.epptr() - __p; 2814684ddb6SLionel Sambuc } 2824684ddb6SLionel Sambuc ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p; 2834684ddb6SLionel Sambuc __str_ = _VSTD::move(__rhs.__str_); 2844684ddb6SLionel Sambuc __p = const_cast<char_type*>(__str_.data()); 2854684ddb6SLionel Sambuc if (__binp != -1) 2864684ddb6SLionel Sambuc this->setg(__p + __binp, __p + __ninp, __p + __einp); 2874684ddb6SLionel Sambuc if (__bout != -1) 2884684ddb6SLionel Sambuc { 2894684ddb6SLionel Sambuc this->setp(__p + __bout, __p + __eout); 2904684ddb6SLionel Sambuc this->pbump(__nout); 2914684ddb6SLionel Sambuc } 2924684ddb6SLionel Sambuc __hm_ = __hm == -1 ? nullptr : __p + __hm; 2934684ddb6SLionel Sambuc __p = const_cast<char_type*>(__rhs.__str_.data()); 2944684ddb6SLionel Sambuc __rhs.setg(__p, __p, __p); 2954684ddb6SLionel Sambuc __rhs.setp(__p, __p); 2964684ddb6SLionel Sambuc __rhs.__hm_ = __p; 2974684ddb6SLionel Sambuc this->pubimbue(__rhs.getloc()); 2984684ddb6SLionel Sambuc} 2994684ddb6SLionel Sambuc 3004684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 3014684ddb6SLionel Sambucbasic_stringbuf<_CharT, _Traits, _Allocator>& 3024684ddb6SLionel Sambucbasic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs) 3034684ddb6SLionel Sambuc{ 3044684ddb6SLionel Sambuc char_type* __p = const_cast<char_type*>(__rhs.__str_.data()); 3054684ddb6SLionel Sambuc ptrdiff_t __binp = -1; 3064684ddb6SLionel Sambuc ptrdiff_t __ninp = -1; 3074684ddb6SLionel Sambuc ptrdiff_t __einp = -1; 3084684ddb6SLionel Sambuc if (__rhs.eback() != nullptr) 3094684ddb6SLionel Sambuc { 3104684ddb6SLionel Sambuc __binp = __rhs.eback() - __p; 3114684ddb6SLionel Sambuc __ninp = __rhs.gptr() - __p; 3124684ddb6SLionel Sambuc __einp = __rhs.egptr() - __p; 3134684ddb6SLionel Sambuc } 3144684ddb6SLionel Sambuc ptrdiff_t __bout = -1; 3154684ddb6SLionel Sambuc ptrdiff_t __nout = -1; 3164684ddb6SLionel Sambuc ptrdiff_t __eout = -1; 3174684ddb6SLionel Sambuc if (__rhs.pbase() != nullptr) 3184684ddb6SLionel Sambuc { 3194684ddb6SLionel Sambuc __bout = __rhs.pbase() - __p; 3204684ddb6SLionel Sambuc __nout = __rhs.pptr() - __p; 3214684ddb6SLionel Sambuc __eout = __rhs.epptr() - __p; 3224684ddb6SLionel Sambuc } 3234684ddb6SLionel Sambuc ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p; 3244684ddb6SLionel Sambuc __str_ = _VSTD::move(__rhs.__str_); 3254684ddb6SLionel Sambuc __p = const_cast<char_type*>(__str_.data()); 3264684ddb6SLionel Sambuc if (__binp != -1) 3274684ddb6SLionel Sambuc this->setg(__p + __binp, __p + __ninp, __p + __einp); 328*0a6a1f1dSLionel Sambuc else 329*0a6a1f1dSLionel Sambuc this->setg(nullptr, nullptr, nullptr); 3304684ddb6SLionel Sambuc if (__bout != -1) 3314684ddb6SLionel Sambuc { 3324684ddb6SLionel Sambuc this->setp(__p + __bout, __p + __eout); 3334684ddb6SLionel Sambuc this->pbump(__nout); 3344684ddb6SLionel Sambuc } 335*0a6a1f1dSLionel Sambuc else 336*0a6a1f1dSLionel Sambuc this->setp(nullptr, nullptr); 337*0a6a1f1dSLionel Sambuc 3384684ddb6SLionel Sambuc __hm_ = __hm == -1 ? nullptr : __p + __hm; 3394684ddb6SLionel Sambuc __mode_ = __rhs.__mode_; 3404684ddb6SLionel Sambuc __p = const_cast<char_type*>(__rhs.__str_.data()); 3414684ddb6SLionel Sambuc __rhs.setg(__p, __p, __p); 3424684ddb6SLionel Sambuc __rhs.setp(__p, __p); 3434684ddb6SLionel Sambuc __rhs.__hm_ = __p; 3444684ddb6SLionel Sambuc this->pubimbue(__rhs.getloc()); 3454684ddb6SLionel Sambuc return *this; 3464684ddb6SLionel Sambuc} 3474684ddb6SLionel Sambuc 3484684ddb6SLionel Sambuc#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 3494684ddb6SLionel Sambuc 3504684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 3514684ddb6SLionel Sambucvoid 3524684ddb6SLionel Sambucbasic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs) 3534684ddb6SLionel Sambuc{ 3544684ddb6SLionel Sambuc char_type* __p = const_cast<char_type*>(__rhs.__str_.data()); 3554684ddb6SLionel Sambuc ptrdiff_t __rbinp = -1; 3564684ddb6SLionel Sambuc ptrdiff_t __rninp = -1; 3574684ddb6SLionel Sambuc ptrdiff_t __reinp = -1; 3584684ddb6SLionel Sambuc if (__rhs.eback() != nullptr) 3594684ddb6SLionel Sambuc { 3604684ddb6SLionel Sambuc __rbinp = __rhs.eback() - __p; 3614684ddb6SLionel Sambuc __rninp = __rhs.gptr() - __p; 3624684ddb6SLionel Sambuc __reinp = __rhs.egptr() - __p; 3634684ddb6SLionel Sambuc } 3644684ddb6SLionel Sambuc ptrdiff_t __rbout = -1; 3654684ddb6SLionel Sambuc ptrdiff_t __rnout = -1; 3664684ddb6SLionel Sambuc ptrdiff_t __reout = -1; 3674684ddb6SLionel Sambuc if (__rhs.pbase() != nullptr) 3684684ddb6SLionel Sambuc { 3694684ddb6SLionel Sambuc __rbout = __rhs.pbase() - __p; 3704684ddb6SLionel Sambuc __rnout = __rhs.pptr() - __p; 3714684ddb6SLionel Sambuc __reout = __rhs.epptr() - __p; 3724684ddb6SLionel Sambuc } 3734684ddb6SLionel Sambuc ptrdiff_t __rhm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p; 3744684ddb6SLionel Sambuc __p = const_cast<char_type*>(__str_.data()); 3754684ddb6SLionel Sambuc ptrdiff_t __lbinp = -1; 3764684ddb6SLionel Sambuc ptrdiff_t __lninp = -1; 3774684ddb6SLionel Sambuc ptrdiff_t __leinp = -1; 3784684ddb6SLionel Sambuc if (this->eback() != nullptr) 3794684ddb6SLionel Sambuc { 3804684ddb6SLionel Sambuc __lbinp = this->eback() - __p; 3814684ddb6SLionel Sambuc __lninp = this->gptr() - __p; 3824684ddb6SLionel Sambuc __leinp = this->egptr() - __p; 3834684ddb6SLionel Sambuc } 3844684ddb6SLionel Sambuc ptrdiff_t __lbout = -1; 3854684ddb6SLionel Sambuc ptrdiff_t __lnout = -1; 3864684ddb6SLionel Sambuc ptrdiff_t __leout = -1; 3874684ddb6SLionel Sambuc if (this->pbase() != nullptr) 3884684ddb6SLionel Sambuc { 3894684ddb6SLionel Sambuc __lbout = this->pbase() - __p; 3904684ddb6SLionel Sambuc __lnout = this->pptr() - __p; 3914684ddb6SLionel Sambuc __leout = this->epptr() - __p; 3924684ddb6SLionel Sambuc } 3934684ddb6SLionel Sambuc ptrdiff_t __lhm = __hm_ == nullptr ? -1 : __hm_ - __p; 3944684ddb6SLionel Sambuc _VSTD::swap(__mode_, __rhs.__mode_); 3954684ddb6SLionel Sambuc __str_.swap(__rhs.__str_); 3964684ddb6SLionel Sambuc __p = const_cast<char_type*>(__str_.data()); 3974684ddb6SLionel Sambuc if (__rbinp != -1) 3984684ddb6SLionel Sambuc this->setg(__p + __rbinp, __p + __rninp, __p + __reinp); 3994684ddb6SLionel Sambuc else 4004684ddb6SLionel Sambuc this->setg(nullptr, nullptr, nullptr); 4014684ddb6SLionel Sambuc if (__rbout != -1) 4024684ddb6SLionel Sambuc { 4034684ddb6SLionel Sambuc this->setp(__p + __rbout, __p + __reout); 4044684ddb6SLionel Sambuc this->pbump(__rnout); 4054684ddb6SLionel Sambuc } 4064684ddb6SLionel Sambuc else 4074684ddb6SLionel Sambuc this->setp(nullptr, nullptr); 4084684ddb6SLionel Sambuc __hm_ = __rhm == -1 ? nullptr : __p + __rhm; 4094684ddb6SLionel Sambuc __p = const_cast<char_type*>(__rhs.__str_.data()); 4104684ddb6SLionel Sambuc if (__lbinp != -1) 4114684ddb6SLionel Sambuc __rhs.setg(__p + __lbinp, __p + __lninp, __p + __leinp); 4124684ddb6SLionel Sambuc else 4134684ddb6SLionel Sambuc __rhs.setg(nullptr, nullptr, nullptr); 4144684ddb6SLionel Sambuc if (__lbout != -1) 4154684ddb6SLionel Sambuc { 4164684ddb6SLionel Sambuc __rhs.setp(__p + __lbout, __p + __leout); 4174684ddb6SLionel Sambuc __rhs.pbump(__lnout); 4184684ddb6SLionel Sambuc } 4194684ddb6SLionel Sambuc else 4204684ddb6SLionel Sambuc __rhs.setp(nullptr, nullptr); 4214684ddb6SLionel Sambuc __rhs.__hm_ = __lhm == -1 ? nullptr : __p + __lhm; 4224684ddb6SLionel Sambuc locale __tl = __rhs.getloc(); 4234684ddb6SLionel Sambuc __rhs.pubimbue(this->getloc()); 4244684ddb6SLionel Sambuc this->pubimbue(__tl); 4254684ddb6SLionel Sambuc} 4264684ddb6SLionel Sambuc 4274684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 4284684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 4294684ddb6SLionel Sambucvoid 4304684ddb6SLionel Sambucswap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x, 4314684ddb6SLionel Sambuc basic_stringbuf<_CharT, _Traits, _Allocator>& __y) 4324684ddb6SLionel Sambuc{ 4334684ddb6SLionel Sambuc __x.swap(__y); 4344684ddb6SLionel Sambuc} 4354684ddb6SLionel Sambuc 4364684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 4374684ddb6SLionel Sambucbasic_string<_CharT, _Traits, _Allocator> 4384684ddb6SLionel Sambucbasic_stringbuf<_CharT, _Traits, _Allocator>::str() const 4394684ddb6SLionel Sambuc{ 4404684ddb6SLionel Sambuc if (__mode_ & ios_base::out) 4414684ddb6SLionel Sambuc { 4424684ddb6SLionel Sambuc if (__hm_ < this->pptr()) 4434684ddb6SLionel Sambuc __hm_ = this->pptr(); 4444684ddb6SLionel Sambuc return string_type(this->pbase(), __hm_, __str_.get_allocator()); 4454684ddb6SLionel Sambuc } 4464684ddb6SLionel Sambuc else if (__mode_ & ios_base::in) 4474684ddb6SLionel Sambuc return string_type(this->eback(), this->egptr(), __str_.get_allocator()); 4484684ddb6SLionel Sambuc return string_type(__str_.get_allocator()); 4494684ddb6SLionel Sambuc} 4504684ddb6SLionel Sambuc 4514684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 4524684ddb6SLionel Sambucvoid 4534684ddb6SLionel Sambucbasic_stringbuf<_CharT, _Traits, _Allocator>::str(const string_type& __s) 4544684ddb6SLionel Sambuc{ 4554684ddb6SLionel Sambuc __str_ = __s; 4564684ddb6SLionel Sambuc __hm_ = 0; 4574684ddb6SLionel Sambuc if (__mode_ & ios_base::in) 4584684ddb6SLionel Sambuc { 4594684ddb6SLionel Sambuc __hm_ = const_cast<char_type*>(__str_.data()) + __str_.size(); 4604684ddb6SLionel Sambuc this->setg(const_cast<char_type*>(__str_.data()), 4614684ddb6SLionel Sambuc const_cast<char_type*>(__str_.data()), 4624684ddb6SLionel Sambuc __hm_); 4634684ddb6SLionel Sambuc } 4644684ddb6SLionel Sambuc if (__mode_ & ios_base::out) 4654684ddb6SLionel Sambuc { 4664684ddb6SLionel Sambuc typename string_type::size_type __sz = __str_.size(); 4674684ddb6SLionel Sambuc __hm_ = const_cast<char_type*>(__str_.data()) + __sz; 4684684ddb6SLionel Sambuc __str_.resize(__str_.capacity()); 4694684ddb6SLionel Sambuc this->setp(const_cast<char_type*>(__str_.data()), 4704684ddb6SLionel Sambuc const_cast<char_type*>(__str_.data()) + __str_.size()); 4714684ddb6SLionel Sambuc if (__mode_ & (ios_base::app | ios_base::ate)) 4724684ddb6SLionel Sambuc this->pbump(__sz); 4734684ddb6SLionel Sambuc } 4744684ddb6SLionel Sambuc} 4754684ddb6SLionel Sambuc 4764684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 4774684ddb6SLionel Sambuctypename basic_stringbuf<_CharT, _Traits, _Allocator>::int_type 4784684ddb6SLionel Sambucbasic_stringbuf<_CharT, _Traits, _Allocator>::underflow() 4794684ddb6SLionel Sambuc{ 4804684ddb6SLionel Sambuc if (__hm_ < this->pptr()) 4814684ddb6SLionel Sambuc __hm_ = this->pptr(); 4824684ddb6SLionel Sambuc if (__mode_ & ios_base::in) 4834684ddb6SLionel Sambuc { 4844684ddb6SLionel Sambuc if (this->egptr() < __hm_) 4854684ddb6SLionel Sambuc this->setg(this->eback(), this->gptr(), __hm_); 4864684ddb6SLionel Sambuc if (this->gptr() < this->egptr()) 4874684ddb6SLionel Sambuc return traits_type::to_int_type(*this->gptr()); 4884684ddb6SLionel Sambuc } 4894684ddb6SLionel Sambuc return traits_type::eof(); 4904684ddb6SLionel Sambuc} 4914684ddb6SLionel Sambuc 4924684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 4934684ddb6SLionel Sambuctypename basic_stringbuf<_CharT, _Traits, _Allocator>::int_type 4944684ddb6SLionel Sambucbasic_stringbuf<_CharT, _Traits, _Allocator>::pbackfail(int_type __c) 4954684ddb6SLionel Sambuc{ 4964684ddb6SLionel Sambuc if (__hm_ < this->pptr()) 4974684ddb6SLionel Sambuc __hm_ = this->pptr(); 4984684ddb6SLionel Sambuc if (this->eback() < this->gptr()) 4994684ddb6SLionel Sambuc { 5004684ddb6SLionel Sambuc if (traits_type::eq_int_type(__c, traits_type::eof())) 5014684ddb6SLionel Sambuc { 5024684ddb6SLionel Sambuc this->setg(this->eback(), this->gptr()-1, __hm_); 5034684ddb6SLionel Sambuc return traits_type::not_eof(__c); 5044684ddb6SLionel Sambuc } 5054684ddb6SLionel Sambuc if ((__mode_ & ios_base::out) || 5064684ddb6SLionel Sambuc traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1])) 5074684ddb6SLionel Sambuc { 5084684ddb6SLionel Sambuc this->setg(this->eback(), this->gptr()-1, __hm_); 5094684ddb6SLionel Sambuc *this->gptr() = traits_type::to_char_type(__c); 5104684ddb6SLionel Sambuc return __c; 5114684ddb6SLionel Sambuc } 5124684ddb6SLionel Sambuc } 5134684ddb6SLionel Sambuc return traits_type::eof(); 5144684ddb6SLionel Sambuc} 5154684ddb6SLionel Sambuc 5164684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 5174684ddb6SLionel Sambuctypename basic_stringbuf<_CharT, _Traits, _Allocator>::int_type 5184684ddb6SLionel Sambucbasic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c) 5194684ddb6SLionel Sambuc{ 5204684ddb6SLionel Sambuc if (!traits_type::eq_int_type(__c, traits_type::eof())) 5214684ddb6SLionel Sambuc { 5224684ddb6SLionel Sambuc ptrdiff_t __ninp = this->gptr() - this->eback(); 5234684ddb6SLionel Sambuc if (this->pptr() == this->epptr()) 5244684ddb6SLionel Sambuc { 5254684ddb6SLionel Sambuc if (!(__mode_ & ios_base::out)) 5264684ddb6SLionel Sambuc return traits_type::eof(); 5274684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 5284684ddb6SLionel Sambuc try 5294684ddb6SLionel Sambuc { 5304684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 5314684ddb6SLionel Sambuc ptrdiff_t __nout = this->pptr() - this->pbase(); 5324684ddb6SLionel Sambuc ptrdiff_t __hm = __hm_ - this->pbase(); 5334684ddb6SLionel Sambuc __str_.push_back(char_type()); 5344684ddb6SLionel Sambuc __str_.resize(__str_.capacity()); 5354684ddb6SLionel Sambuc char_type* __p = const_cast<char_type*>(__str_.data()); 5364684ddb6SLionel Sambuc this->setp(__p, __p + __str_.size()); 5374684ddb6SLionel Sambuc this->pbump(__nout); 5384684ddb6SLionel Sambuc __hm_ = this->pbase() + __hm; 5394684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 5404684ddb6SLionel Sambuc } 5414684ddb6SLionel Sambuc catch (...) 5424684ddb6SLionel Sambuc { 5434684ddb6SLionel Sambuc return traits_type::eof(); 5444684ddb6SLionel Sambuc } 5454684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 5464684ddb6SLionel Sambuc } 5474684ddb6SLionel Sambuc __hm_ = _VSTD::max(this->pptr() + 1, __hm_); 5484684ddb6SLionel Sambuc if (__mode_ & ios_base::in) 5494684ddb6SLionel Sambuc { 5504684ddb6SLionel Sambuc char_type* __p = const_cast<char_type*>(__str_.data()); 5514684ddb6SLionel Sambuc this->setg(__p, __p + __ninp, __hm_); 5524684ddb6SLionel Sambuc } 5534684ddb6SLionel Sambuc return this->sputc(__c); 5544684ddb6SLionel Sambuc } 5554684ddb6SLionel Sambuc return traits_type::not_eof(__c); 5564684ddb6SLionel Sambuc} 5574684ddb6SLionel Sambuc 5584684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 5594684ddb6SLionel Sambuctypename basic_stringbuf<_CharT, _Traits, _Allocator>::pos_type 5604684ddb6SLionel Sambucbasic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off, 5614684ddb6SLionel Sambuc ios_base::seekdir __way, 5624684ddb6SLionel Sambuc ios_base::openmode __wch) 5634684ddb6SLionel Sambuc{ 5644684ddb6SLionel Sambuc if (__hm_ < this->pptr()) 5654684ddb6SLionel Sambuc __hm_ = this->pptr(); 5664684ddb6SLionel Sambuc if ((__wch & (ios_base::in | ios_base::out)) == 0) 5674684ddb6SLionel Sambuc return pos_type(-1); 5684684ddb6SLionel Sambuc if ((__wch & (ios_base::in | ios_base::out)) == (ios_base::in | ios_base::out) 5694684ddb6SLionel Sambuc && __way == ios_base::cur) 5704684ddb6SLionel Sambuc return pos_type(-1); 5714684ddb6SLionel Sambuc off_type __noff; 5724684ddb6SLionel Sambuc switch (__way) 5734684ddb6SLionel Sambuc { 5744684ddb6SLionel Sambuc case ios_base::beg: 5754684ddb6SLionel Sambuc __noff = 0; 5764684ddb6SLionel Sambuc break; 5774684ddb6SLionel Sambuc case ios_base::cur: 5784684ddb6SLionel Sambuc if (__wch & ios_base::in) 5794684ddb6SLionel Sambuc __noff = this->gptr() - this->eback(); 5804684ddb6SLionel Sambuc else 5814684ddb6SLionel Sambuc __noff = this->pptr() - this->pbase(); 5824684ddb6SLionel Sambuc break; 5834684ddb6SLionel Sambuc case ios_base::end: 5844684ddb6SLionel Sambuc __noff = __hm_ - __str_.data(); 5854684ddb6SLionel Sambuc break; 5864684ddb6SLionel Sambuc default: 5874684ddb6SLionel Sambuc return pos_type(-1); 5884684ddb6SLionel Sambuc } 5894684ddb6SLionel Sambuc __noff += __off; 5904684ddb6SLionel Sambuc if (__noff < 0 || __hm_ - __str_.data() < __noff) 5914684ddb6SLionel Sambuc return pos_type(-1); 5924684ddb6SLionel Sambuc if (__noff != 0) 5934684ddb6SLionel Sambuc { 5944684ddb6SLionel Sambuc if ((__wch & ios_base::in) && this->gptr() == 0) 5954684ddb6SLionel Sambuc return pos_type(-1); 5964684ddb6SLionel Sambuc if ((__wch & ios_base::out) && this->pptr() == 0) 5974684ddb6SLionel Sambuc return pos_type(-1); 5984684ddb6SLionel Sambuc } 5994684ddb6SLionel Sambuc if (__wch & ios_base::in) 6004684ddb6SLionel Sambuc this->setg(this->eback(), this->eback() + __noff, __hm_); 6014684ddb6SLionel Sambuc if (__wch & ios_base::out) 6024684ddb6SLionel Sambuc { 6034684ddb6SLionel Sambuc this->setp(this->pbase(), this->epptr()); 6044684ddb6SLionel Sambuc this->pbump(__noff); 6054684ddb6SLionel Sambuc } 6064684ddb6SLionel Sambuc return pos_type(__noff); 6074684ddb6SLionel Sambuc} 6084684ddb6SLionel Sambuc 6094684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 6104684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 6114684ddb6SLionel Sambuctypename basic_stringbuf<_CharT, _Traits, _Allocator>::pos_type 6124684ddb6SLionel Sambucbasic_stringbuf<_CharT, _Traits, _Allocator>::seekpos(pos_type __sp, 6134684ddb6SLionel Sambuc ios_base::openmode __wch) 6144684ddb6SLionel Sambuc{ 6154684ddb6SLionel Sambuc return seekoff(__sp, ios_base::beg, __wch); 6164684ddb6SLionel Sambuc} 6174684ddb6SLionel Sambuc 6184684ddb6SLionel Sambuc// basic_istringstream 6194684ddb6SLionel Sambuc 6204684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 6214684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY basic_istringstream 6224684ddb6SLionel Sambuc : public basic_istream<_CharT, _Traits> 6234684ddb6SLionel Sambuc{ 6244684ddb6SLionel Sambucpublic: 6254684ddb6SLionel Sambuc typedef _CharT char_type; 6264684ddb6SLionel Sambuc typedef _Traits traits_type; 6274684ddb6SLionel Sambuc typedef typename traits_type::int_type int_type; 6284684ddb6SLionel Sambuc typedef typename traits_type::pos_type pos_type; 6294684ddb6SLionel Sambuc typedef typename traits_type::off_type off_type; 6304684ddb6SLionel Sambuc typedef _Allocator allocator_type; 6314684ddb6SLionel Sambuc 6324684ddb6SLionel Sambuc typedef basic_string<char_type, traits_type, allocator_type> string_type; 6334684ddb6SLionel Sambuc 6344684ddb6SLionel Sambucprivate: 6354684ddb6SLionel Sambuc basic_stringbuf<char_type, traits_type, allocator_type> __sb_; 6364684ddb6SLionel Sambuc 6374684ddb6SLionel Sambucpublic: 6384684ddb6SLionel Sambuc // 27.8.2.1 Constructors: 6394684ddb6SLionel Sambuc explicit basic_istringstream(ios_base::openmode __wch = ios_base::in); 6404684ddb6SLionel Sambuc explicit basic_istringstream(const string_type& __s, 6414684ddb6SLionel Sambuc ios_base::openmode __wch = ios_base::in); 6424684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 6434684ddb6SLionel Sambuc basic_istringstream(basic_istringstream&& __rhs); 6444684ddb6SLionel Sambuc 6454684ddb6SLionel Sambuc // 27.8.2.2 Assign and swap: 6464684ddb6SLionel Sambuc basic_istringstream& operator=(basic_istringstream&& __rhs); 6474684ddb6SLionel Sambuc#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 6484684ddb6SLionel Sambuc void swap(basic_istringstream& __rhs); 6494684ddb6SLionel Sambuc 6504684ddb6SLionel Sambuc // 27.8.2.3 Members: 6514684ddb6SLionel Sambuc basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; 6524684ddb6SLionel Sambuc string_type str() const; 6534684ddb6SLionel Sambuc void str(const string_type& __s); 6544684ddb6SLionel Sambuc}; 6554684ddb6SLionel Sambuc 6564684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 6574684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 6584684ddb6SLionel Sambucbasic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(ios_base::openmode __wch) 6594684ddb6SLionel Sambuc : basic_istream<_CharT, _Traits>(&__sb_), 6604684ddb6SLionel Sambuc __sb_(__wch | ios_base::in) 6614684ddb6SLionel Sambuc{ 6624684ddb6SLionel Sambuc} 6634684ddb6SLionel Sambuc 6644684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 6654684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 6664684ddb6SLionel Sambucbasic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const string_type& __s, 6674684ddb6SLionel Sambuc ios_base::openmode __wch) 6684684ddb6SLionel Sambuc : basic_istream<_CharT, _Traits>(&__sb_), 6694684ddb6SLionel Sambuc __sb_(__s, __wch | ios_base::in) 6704684ddb6SLionel Sambuc{ 6714684ddb6SLionel Sambuc} 6724684ddb6SLionel Sambuc 6734684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 6744684ddb6SLionel Sambuc 6754684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 6764684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 6774684ddb6SLionel Sambucbasic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(basic_istringstream&& __rhs) 6784684ddb6SLionel Sambuc : basic_istream<_CharT, _Traits>(_VSTD::move(__rhs)), 6794684ddb6SLionel Sambuc __sb_(_VSTD::move(__rhs.__sb_)) 6804684ddb6SLionel Sambuc{ 6814684ddb6SLionel Sambuc basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_); 6824684ddb6SLionel Sambuc} 6834684ddb6SLionel Sambuc 6844684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 6854684ddb6SLionel Sambucbasic_istringstream<_CharT, _Traits, _Allocator>& 6864684ddb6SLionel Sambucbasic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream&& __rhs) 6874684ddb6SLionel Sambuc{ 6884684ddb6SLionel Sambuc basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); 6894684ddb6SLionel Sambuc __sb_ = _VSTD::move(__rhs.__sb_); 6904684ddb6SLionel Sambuc return *this; 6914684ddb6SLionel Sambuc} 6924684ddb6SLionel Sambuc 6934684ddb6SLionel Sambuc#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 6944684ddb6SLionel Sambuc 6954684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 6964684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 6974684ddb6SLionel Sambucvoid 6984684ddb6SLionel Sambucbasic_istringstream<_CharT, _Traits, _Allocator>::swap(basic_istringstream& __rhs) 6994684ddb6SLionel Sambuc{ 7004684ddb6SLionel Sambuc basic_istream<char_type, traits_type>::swap(__rhs); 7014684ddb6SLionel Sambuc __sb_.swap(__rhs.__sb_); 7024684ddb6SLionel Sambuc} 7034684ddb6SLionel Sambuc 7044684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 7054684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7064684ddb6SLionel Sambucvoid 7074684ddb6SLionel Sambucswap(basic_istringstream<_CharT, _Traits, _Allocator>& __x, 7084684ddb6SLionel Sambuc basic_istringstream<_CharT, _Traits, _Allocator>& __y) 7094684ddb6SLionel Sambuc{ 7104684ddb6SLionel Sambuc __x.swap(__y); 7114684ddb6SLionel Sambuc} 7124684ddb6SLionel Sambuc 7134684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 7144684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7154684ddb6SLionel Sambucbasic_stringbuf<_CharT, _Traits, _Allocator>* 7164684ddb6SLionel Sambucbasic_istringstream<_CharT, _Traits, _Allocator>::rdbuf() const 7174684ddb6SLionel Sambuc{ 7184684ddb6SLionel Sambuc return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); 7194684ddb6SLionel Sambuc} 7204684ddb6SLionel Sambuc 7214684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 7224684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7234684ddb6SLionel Sambucbasic_string<_CharT, _Traits, _Allocator> 7244684ddb6SLionel Sambucbasic_istringstream<_CharT, _Traits, _Allocator>::str() const 7254684ddb6SLionel Sambuc{ 7264684ddb6SLionel Sambuc return __sb_.str(); 7274684ddb6SLionel Sambuc} 7284684ddb6SLionel Sambuc 7294684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 7304684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7314684ddb6SLionel Sambucvoid 7324684ddb6SLionel Sambucbasic_istringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s) 7334684ddb6SLionel Sambuc{ 7344684ddb6SLionel Sambuc __sb_.str(__s); 7354684ddb6SLionel Sambuc} 7364684ddb6SLionel Sambuc 7374684ddb6SLionel Sambuc// basic_ostringstream 7384684ddb6SLionel Sambuc 7394684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 7404684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY basic_ostringstream 7414684ddb6SLionel Sambuc : public basic_ostream<_CharT, _Traits> 7424684ddb6SLionel Sambuc{ 7434684ddb6SLionel Sambucpublic: 7444684ddb6SLionel Sambuc typedef _CharT char_type; 7454684ddb6SLionel Sambuc typedef _Traits traits_type; 7464684ddb6SLionel Sambuc typedef typename traits_type::int_type int_type; 7474684ddb6SLionel Sambuc typedef typename traits_type::pos_type pos_type; 7484684ddb6SLionel Sambuc typedef typename traits_type::off_type off_type; 7494684ddb6SLionel Sambuc typedef _Allocator allocator_type; 7504684ddb6SLionel Sambuc 7514684ddb6SLionel Sambuc typedef basic_string<char_type, traits_type, allocator_type> string_type; 7524684ddb6SLionel Sambuc 7534684ddb6SLionel Sambucprivate: 7544684ddb6SLionel Sambuc basic_stringbuf<char_type, traits_type, allocator_type> __sb_; 7554684ddb6SLionel Sambuc 7564684ddb6SLionel Sambucpublic: 7574684ddb6SLionel Sambuc // 27.8.2.1 Constructors: 7584684ddb6SLionel Sambuc explicit basic_ostringstream(ios_base::openmode __wch = ios_base::out); 7594684ddb6SLionel Sambuc explicit basic_ostringstream(const string_type& __s, 7604684ddb6SLionel Sambuc ios_base::openmode __wch = ios_base::out); 7614684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 7624684ddb6SLionel Sambuc basic_ostringstream(basic_ostringstream&& __rhs); 7634684ddb6SLionel Sambuc 7644684ddb6SLionel Sambuc // 27.8.2.2 Assign and swap: 7654684ddb6SLionel Sambuc basic_ostringstream& operator=(basic_ostringstream&& __rhs); 7664684ddb6SLionel Sambuc#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 7674684ddb6SLionel Sambuc void swap(basic_ostringstream& __rhs); 7684684ddb6SLionel Sambuc 7694684ddb6SLionel Sambuc // 27.8.2.3 Members: 7704684ddb6SLionel Sambuc basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; 7714684ddb6SLionel Sambuc string_type str() const; 7724684ddb6SLionel Sambuc void str(const string_type& __s); 7734684ddb6SLionel Sambuc}; 7744684ddb6SLionel Sambuc 7754684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 7764684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7774684ddb6SLionel Sambucbasic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(ios_base::openmode __wch) 7784684ddb6SLionel Sambuc : basic_ostream<_CharT, _Traits>(&__sb_), 7794684ddb6SLionel Sambuc __sb_(__wch | ios_base::out) 7804684ddb6SLionel Sambuc{ 7814684ddb6SLionel Sambuc} 7824684ddb6SLionel Sambuc 7834684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 7844684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7854684ddb6SLionel Sambucbasic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const string_type& __s, 7864684ddb6SLionel Sambuc ios_base::openmode __wch) 7874684ddb6SLionel Sambuc : basic_ostream<_CharT, _Traits>(&__sb_), 7884684ddb6SLionel Sambuc __sb_(__s, __wch | ios_base::out) 7894684ddb6SLionel Sambuc{ 7904684ddb6SLionel Sambuc} 7914684ddb6SLionel Sambuc 7924684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 7934684ddb6SLionel Sambuc 7944684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 7954684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7964684ddb6SLionel Sambucbasic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(basic_ostringstream&& __rhs) 7974684ddb6SLionel Sambuc : basic_ostream<_CharT, _Traits>(_VSTD::move(__rhs)), 7984684ddb6SLionel Sambuc __sb_(_VSTD::move(__rhs.__sb_)) 7994684ddb6SLionel Sambuc{ 8004684ddb6SLionel Sambuc basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_); 8014684ddb6SLionel Sambuc} 8024684ddb6SLionel Sambuc 8034684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 8044684ddb6SLionel Sambucbasic_ostringstream<_CharT, _Traits, _Allocator>& 8054684ddb6SLionel Sambucbasic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream&& __rhs) 8064684ddb6SLionel Sambuc{ 8074684ddb6SLionel Sambuc basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); 8084684ddb6SLionel Sambuc __sb_ = _VSTD::move(__rhs.__sb_); 8094684ddb6SLionel Sambuc return *this; 8104684ddb6SLionel Sambuc} 8114684ddb6SLionel Sambuc 8124684ddb6SLionel Sambuc#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 8134684ddb6SLionel Sambuc 8144684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 8154684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 8164684ddb6SLionel Sambucvoid 8174684ddb6SLionel Sambucbasic_ostringstream<_CharT, _Traits, _Allocator>::swap(basic_ostringstream& __rhs) 8184684ddb6SLionel Sambuc{ 8194684ddb6SLionel Sambuc basic_ostream<char_type, traits_type>::swap(__rhs); 8204684ddb6SLionel Sambuc __sb_.swap(__rhs.__sb_); 8214684ddb6SLionel Sambuc} 8224684ddb6SLionel Sambuc 8234684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 8244684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 8254684ddb6SLionel Sambucvoid 8264684ddb6SLionel Sambucswap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x, 8274684ddb6SLionel Sambuc basic_ostringstream<_CharT, _Traits, _Allocator>& __y) 8284684ddb6SLionel Sambuc{ 8294684ddb6SLionel Sambuc __x.swap(__y); 8304684ddb6SLionel Sambuc} 8314684ddb6SLionel Sambuc 8324684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 8334684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 8344684ddb6SLionel Sambucbasic_stringbuf<_CharT, _Traits, _Allocator>* 8354684ddb6SLionel Sambucbasic_ostringstream<_CharT, _Traits, _Allocator>::rdbuf() const 8364684ddb6SLionel Sambuc{ 8374684ddb6SLionel Sambuc return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); 8384684ddb6SLionel Sambuc} 8394684ddb6SLionel Sambuc 8404684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 8414684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 8424684ddb6SLionel Sambucbasic_string<_CharT, _Traits, _Allocator> 8434684ddb6SLionel Sambucbasic_ostringstream<_CharT, _Traits, _Allocator>::str() const 8444684ddb6SLionel Sambuc{ 8454684ddb6SLionel Sambuc return __sb_.str(); 8464684ddb6SLionel Sambuc} 8474684ddb6SLionel Sambuc 8484684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 8494684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 8504684ddb6SLionel Sambucvoid 8514684ddb6SLionel Sambucbasic_ostringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s) 8524684ddb6SLionel Sambuc{ 8534684ddb6SLionel Sambuc __sb_.str(__s); 8544684ddb6SLionel Sambuc} 8554684ddb6SLionel Sambuc 8564684ddb6SLionel Sambuc// basic_stringstream 8574684ddb6SLionel Sambuc 8584684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 8594684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY basic_stringstream 8604684ddb6SLionel Sambuc : public basic_iostream<_CharT, _Traits> 8614684ddb6SLionel Sambuc{ 8624684ddb6SLionel Sambucpublic: 8634684ddb6SLionel Sambuc typedef _CharT char_type; 8644684ddb6SLionel Sambuc typedef _Traits traits_type; 8654684ddb6SLionel Sambuc typedef typename traits_type::int_type int_type; 8664684ddb6SLionel Sambuc typedef typename traits_type::pos_type pos_type; 8674684ddb6SLionel Sambuc typedef typename traits_type::off_type off_type; 8684684ddb6SLionel Sambuc typedef _Allocator allocator_type; 8694684ddb6SLionel Sambuc 8704684ddb6SLionel Sambuc typedef basic_string<char_type, traits_type, allocator_type> string_type; 8714684ddb6SLionel Sambuc 8724684ddb6SLionel Sambucprivate: 8734684ddb6SLionel Sambuc basic_stringbuf<char_type, traits_type, allocator_type> __sb_; 8744684ddb6SLionel Sambuc 8754684ddb6SLionel Sambucpublic: 8764684ddb6SLionel Sambuc // 27.8.2.1 Constructors: 8774684ddb6SLionel Sambuc explicit basic_stringstream(ios_base::openmode __wch = ios_base::in | ios_base::out); 8784684ddb6SLionel Sambuc explicit basic_stringstream(const string_type& __s, 8794684ddb6SLionel Sambuc ios_base::openmode __wch = ios_base::in | ios_base::out); 8804684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 8814684ddb6SLionel Sambuc basic_stringstream(basic_stringstream&& __rhs); 8824684ddb6SLionel Sambuc 8834684ddb6SLionel Sambuc // 27.8.2.2 Assign and swap: 8844684ddb6SLionel Sambuc basic_stringstream& operator=(basic_stringstream&& __rhs); 8854684ddb6SLionel Sambuc#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 8864684ddb6SLionel Sambuc void swap(basic_stringstream& __rhs); 8874684ddb6SLionel Sambuc 8884684ddb6SLionel Sambuc // 27.8.2.3 Members: 8894684ddb6SLionel Sambuc basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; 8904684ddb6SLionel Sambuc string_type str() const; 8914684ddb6SLionel Sambuc void str(const string_type& __s); 8924684ddb6SLionel Sambuc}; 8934684ddb6SLionel Sambuc 8944684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 8954684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 8964684ddb6SLionel Sambucbasic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(ios_base::openmode __wch) 8974684ddb6SLionel Sambuc : basic_iostream<_CharT, _Traits>(&__sb_), 8984684ddb6SLionel Sambuc __sb_(__wch) 8994684ddb6SLionel Sambuc{ 9004684ddb6SLionel Sambuc} 9014684ddb6SLionel Sambuc 9024684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 9034684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 9044684ddb6SLionel Sambucbasic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string_type& __s, 9054684ddb6SLionel Sambuc ios_base::openmode __wch) 9064684ddb6SLionel Sambuc : basic_iostream<_CharT, _Traits>(&__sb_), 9074684ddb6SLionel Sambuc __sb_(__s, __wch) 9084684ddb6SLionel Sambuc{ 9094684ddb6SLionel Sambuc} 9104684ddb6SLionel Sambuc 9114684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 9124684ddb6SLionel Sambuc 9134684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 9144684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 9154684ddb6SLionel Sambucbasic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(basic_stringstream&& __rhs) 9164684ddb6SLionel Sambuc : basic_iostream<_CharT, _Traits>(_VSTD::move(__rhs)), 9174684ddb6SLionel Sambuc __sb_(_VSTD::move(__rhs.__sb_)) 9184684ddb6SLionel Sambuc{ 9194684ddb6SLionel Sambuc basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_); 9204684ddb6SLionel Sambuc} 9214684ddb6SLionel Sambuc 9224684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 9234684ddb6SLionel Sambucbasic_stringstream<_CharT, _Traits, _Allocator>& 9244684ddb6SLionel Sambucbasic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&& __rhs) 9254684ddb6SLionel Sambuc{ 9264684ddb6SLionel Sambuc basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); 9274684ddb6SLionel Sambuc __sb_ = _VSTD::move(__rhs.__sb_); 9284684ddb6SLionel Sambuc return *this; 9294684ddb6SLionel Sambuc} 9304684ddb6SLionel Sambuc 9314684ddb6SLionel Sambuc#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 9324684ddb6SLionel Sambuc 9334684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 9344684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 9354684ddb6SLionel Sambucvoid 9364684ddb6SLionel Sambucbasic_stringstream<_CharT, _Traits, _Allocator>::swap(basic_stringstream& __rhs) 9374684ddb6SLionel Sambuc{ 9384684ddb6SLionel Sambuc basic_iostream<char_type, traits_type>::swap(__rhs); 9394684ddb6SLionel Sambuc __sb_.swap(__rhs.__sb_); 9404684ddb6SLionel Sambuc} 9414684ddb6SLionel Sambuc 9424684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 9434684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 9444684ddb6SLionel Sambucvoid 9454684ddb6SLionel Sambucswap(basic_stringstream<_CharT, _Traits, _Allocator>& __x, 9464684ddb6SLionel Sambuc basic_stringstream<_CharT, _Traits, _Allocator>& __y) 9474684ddb6SLionel Sambuc{ 9484684ddb6SLionel Sambuc __x.swap(__y); 9494684ddb6SLionel Sambuc} 9504684ddb6SLionel Sambuc 9514684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 9524684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 9534684ddb6SLionel Sambucbasic_stringbuf<_CharT, _Traits, _Allocator>* 9544684ddb6SLionel Sambucbasic_stringstream<_CharT, _Traits, _Allocator>::rdbuf() const 9554684ddb6SLionel Sambuc{ 9564684ddb6SLionel Sambuc return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); 9574684ddb6SLionel Sambuc} 9584684ddb6SLionel Sambuc 9594684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 9604684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 9614684ddb6SLionel Sambucbasic_string<_CharT, _Traits, _Allocator> 9624684ddb6SLionel Sambucbasic_stringstream<_CharT, _Traits, _Allocator>::str() const 9634684ddb6SLionel Sambuc{ 9644684ddb6SLionel Sambuc return __sb_.str(); 9654684ddb6SLionel Sambuc} 9664684ddb6SLionel Sambuc 9674684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, class _Allocator> 9684684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 9694684ddb6SLionel Sambucvoid 9704684ddb6SLionel Sambucbasic_stringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s) 9714684ddb6SLionel Sambuc{ 9724684ddb6SLionel Sambuc __sb_.str(__s); 9734684ddb6SLionel Sambuc} 9744684ddb6SLionel Sambuc 9754684ddb6SLionel Sambuc_LIBCPP_END_NAMESPACE_STD 9764684ddb6SLionel Sambuc 9774684ddb6SLionel Sambuc#endif // _LIBCPP_SSTREAM 978