10b57cec5SDimitry Andric// -*- C++ -*- 2349cc55cSDimitry Andric//===----------------------------------------------------------------------===// 30b57cec5SDimitry Andric// 40b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 50b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 60b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 70b57cec5SDimitry Andric// 80b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 90b57cec5SDimitry Andric 100b57cec5SDimitry Andric#ifndef _LIBCPP_STRSTREAM 110b57cec5SDimitry Andric#define _LIBCPP_STRSTREAM 120b57cec5SDimitry Andric 130b57cec5SDimitry Andric/* 140b57cec5SDimitry Andric strstream synopsis 150b57cec5SDimitry Andric 16*0fca6ea1SDimitry Andricclass strstreambuf // Removed in C++26 170b57cec5SDimitry Andric : public basic_streambuf<char> 180b57cec5SDimitry Andric{ 190b57cec5SDimitry Andricpublic: 20e8d8bef9SDimitry Andric explicit strstreambuf(streamsize alsize_arg = 0); // before C++20 21e8d8bef9SDimitry Andric strstreambuf() : strstreambuf(0) {} // C++20 22e8d8bef9SDimitry Andric explicit strstreambuf(streamsize alsize_arg); // C++20 23e8d8bef9SDimitry Andric 240b57cec5SDimitry Andric strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*)); 25e8d8bef9SDimitry Andric strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = nullptr); 260b57cec5SDimitry Andric strstreambuf(const char* gnext_arg, streamsize n); 270b57cec5SDimitry Andric 28e8d8bef9SDimitry Andric strstreambuf(signed char* gnext_arg, streamsize n, signed char* pbeg_arg = nullptr); 290b57cec5SDimitry Andric strstreambuf(const signed char* gnext_arg, streamsize n); 30e8d8bef9SDimitry Andric strstreambuf(unsigned char* gnext_arg, streamsize n, unsigned char* pbeg_arg = nullptr); 310b57cec5SDimitry Andric strstreambuf(const unsigned char* gnext_arg, streamsize n); 320b57cec5SDimitry Andric 330b57cec5SDimitry Andric strstreambuf(strstreambuf&& rhs); 340b57cec5SDimitry Andric strstreambuf& operator=(strstreambuf&& rhs); 350b57cec5SDimitry Andric 360b57cec5SDimitry Andric virtual ~strstreambuf(); 370b57cec5SDimitry Andric 380b57cec5SDimitry Andric void swap(strstreambuf& rhs); 390b57cec5SDimitry Andric 400b57cec5SDimitry Andric void freeze(bool freezefl = true); 410b57cec5SDimitry Andric char* str(); 420b57cec5SDimitry Andric int pcount() const; 430b57cec5SDimitry Andric 440b57cec5SDimitry Andricprotected: 450b57cec5SDimitry Andric virtual int_type overflow (int_type c = EOF); 460b57cec5SDimitry Andric virtual int_type pbackfail(int_type c = EOF); 470b57cec5SDimitry Andric virtual int_type underflow(); 480b57cec5SDimitry Andric virtual pos_type seekoff(off_type off, ios_base::seekdir way, 490b57cec5SDimitry Andric ios_base::openmode which = ios_base::in | ios_base::out); 500b57cec5SDimitry Andric virtual pos_type seekpos(pos_type sp, 510b57cec5SDimitry Andric ios_base::openmode which = ios_base::in | ios_base::out); 520b57cec5SDimitry Andric virtual streambuf* setbuf(char* s, streamsize n); 530b57cec5SDimitry Andric 540b57cec5SDimitry Andricprivate: 550b57cec5SDimitry Andric typedef T1 strstate; // exposition only 560b57cec5SDimitry Andric static const strstate allocated; // exposition only 570b57cec5SDimitry Andric static const strstate constant; // exposition only 580b57cec5SDimitry Andric static const strstate dynamic; // exposition only 590b57cec5SDimitry Andric static const strstate frozen; // exposition only 600b57cec5SDimitry Andric strstate strmode; // exposition only 610b57cec5SDimitry Andric streamsize alsize; // exposition only 620b57cec5SDimitry Andric void* (*palloc)(size_t); // exposition only 630b57cec5SDimitry Andric void (*pfree)(void*); // exposition only 640b57cec5SDimitry Andric}; 650b57cec5SDimitry Andric 66*0fca6ea1SDimitry Andricclass istrstream // Removed in C++26 670b57cec5SDimitry Andric : public basic_istream<char> 680b57cec5SDimitry Andric{ 690b57cec5SDimitry Andricpublic: 700b57cec5SDimitry Andric explicit istrstream(const char* s); 710b57cec5SDimitry Andric explicit istrstream(char* s); 720b57cec5SDimitry Andric istrstream(const char* s, streamsize n); 730b57cec5SDimitry Andric istrstream(char* s, streamsize n); 740b57cec5SDimitry Andric 750b57cec5SDimitry Andric virtual ~istrstream(); 760b57cec5SDimitry Andric 770b57cec5SDimitry Andric strstreambuf* rdbuf() const; 780b57cec5SDimitry Andric char *str(); 790b57cec5SDimitry Andric 800b57cec5SDimitry Andricprivate: 810b57cec5SDimitry Andric strstreambuf sb; // exposition only 820b57cec5SDimitry Andric}; 830b57cec5SDimitry Andric 84*0fca6ea1SDimitry Andricclass ostrstream // Removed in C++26 850b57cec5SDimitry Andric : public basic_ostream<char> 860b57cec5SDimitry Andric{ 870b57cec5SDimitry Andricpublic: 880b57cec5SDimitry Andric ostrstream(); 890b57cec5SDimitry Andric ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out); 900b57cec5SDimitry Andric 910b57cec5SDimitry Andric virtual ~ostrstream(); 920b57cec5SDimitry Andric 930b57cec5SDimitry Andric strstreambuf* rdbuf() const; 940b57cec5SDimitry Andric void freeze(bool freezefl = true); 950b57cec5SDimitry Andric char* str(); 960b57cec5SDimitry Andric int pcount() const; 970b57cec5SDimitry Andric 980b57cec5SDimitry Andricprivate: 990b57cec5SDimitry Andric strstreambuf sb; // exposition only 1000b57cec5SDimitry Andric}; 1010b57cec5SDimitry Andric 102*0fca6ea1SDimitry Andricclass strstream // Removed in C++26 1030b57cec5SDimitry Andric : public basic_iostream<char> 1040b57cec5SDimitry Andric{ 1050b57cec5SDimitry Andricpublic: 1060b57cec5SDimitry Andric // Types 1070b57cec5SDimitry Andric typedef char char_type; 1080b57cec5SDimitry Andric typedef char_traits<char>::int_type int_type; 1090b57cec5SDimitry Andric typedef char_traits<char>::pos_type pos_type; 1100b57cec5SDimitry Andric typedef char_traits<char>::off_type off_type; 1110b57cec5SDimitry Andric 1120b57cec5SDimitry Andric // constructors/destructor 1130b57cec5SDimitry Andric strstream(); 1140b57cec5SDimitry Andric strstream(char* s, int n, ios_base::openmode mode = ios_base::in | ios_base::out); 1150b57cec5SDimitry Andric 1160b57cec5SDimitry Andric virtual ~strstream(); 1170b57cec5SDimitry Andric 1180b57cec5SDimitry Andric // Members: 1190b57cec5SDimitry Andric strstreambuf* rdbuf() const; 1200b57cec5SDimitry Andric void freeze(bool freezefl = true); 1210b57cec5SDimitry Andric int pcount() const; 1220b57cec5SDimitry Andric char* str(); 1230b57cec5SDimitry Andric 1240b57cec5SDimitry Andricprivate: 1250b57cec5SDimitry Andric strstreambuf sb; // exposition only 1260b57cec5SDimitry Andric}; 1270b57cec5SDimitry Andric 1280b57cec5SDimitry Andric} // std 1290b57cec5SDimitry Andric 1300b57cec5SDimitry Andric*/ 1310b57cec5SDimitry Andric 1320b57cec5SDimitry Andric#include <__config> 1330b57cec5SDimitry Andric#include <istream> 134fe6060f1SDimitry Andric#include <ostream> 13504eeddc0SDimitry Andric#include <version> 1360b57cec5SDimitry Andric 1370b57cec5SDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 1380b57cec5SDimitry Andric# pragma GCC system_header 1390b57cec5SDimitry Andric#endif 1400b57cec5SDimitry Andric 141*0fca6ea1SDimitry Andric#if _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_STRSTREAM) || defined(_LIBCPP_BUILDING_LIBRARY) 142*0fca6ea1SDimitry Andric 143b3edf446SDimitry Andric_LIBCPP_PUSH_MACROS 144b3edf446SDimitry Andric# include <__undef_macros> 145b3edf446SDimitry Andric 1460b57cec5SDimitry Andric_LIBCPP_BEGIN_NAMESPACE_STD 1470b57cec5SDimitry Andric 148cb14a3feSDimitry Andricclass _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstreambuf : public streambuf { 1490b57cec5SDimitry Andricpublic: 150e8d8bef9SDimitry Andric# ifndef _LIBCPP_CXX03_LANG 15106c3fb27SDimitry Andric _LIBCPP_HIDE_FROM_ABI strstreambuf() : strstreambuf(0) {} 152e8d8bef9SDimitry Andric explicit strstreambuf(streamsize __alsize); 153e8d8bef9SDimitry Andric# else 1540b57cec5SDimitry Andric explicit strstreambuf(streamsize __alsize = 0); 155e8d8bef9SDimitry Andric# endif 1560b57cec5SDimitry Andric strstreambuf(void* (*__palloc)(size_t), void (*__pfree)(void*)); 157e8d8bef9SDimitry Andric strstreambuf(char* __gnext, streamsize __n, char* __pbeg = nullptr); 1580b57cec5SDimitry Andric strstreambuf(const char* __gnext, streamsize __n); 1590b57cec5SDimitry Andric 160e8d8bef9SDimitry Andric strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg = nullptr); 1610b57cec5SDimitry Andric strstreambuf(const signed char* __gnext, streamsize __n); 162e8d8bef9SDimitry Andric strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = nullptr); 1630b57cec5SDimitry Andric strstreambuf(const unsigned char* __gnext, streamsize __n); 1640b57cec5SDimitry Andric 1650b57cec5SDimitry Andric# ifndef _LIBCPP_CXX03_LANG 166cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI strstreambuf(strstreambuf&& __rhs); 167cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI strstreambuf& operator=(strstreambuf&& __rhs); 1680b57cec5SDimitry Andric# endif // _LIBCPP_CXX03_LANG 1690b57cec5SDimitry Andric 170bdd1243dSDimitry Andric ~strstreambuf() override; 1710b57cec5SDimitry Andric 1720b57cec5SDimitry Andric void swap(strstreambuf& __rhs); 1730b57cec5SDimitry Andric 1740b57cec5SDimitry Andric void freeze(bool __freezefl = true); 1750b57cec5SDimitry Andric char* str(); 1760b57cec5SDimitry Andric int pcount() const; 1770b57cec5SDimitry Andric 1780b57cec5SDimitry Andricprotected: 179bdd1243dSDimitry Andric int_type overflow(int_type __c = EOF) override; 180bdd1243dSDimitry Andric int_type pbackfail(int_type __c = EOF) override; 181bdd1243dSDimitry Andric int_type underflow() override; 182cb14a3feSDimitry Andric pos_type 183cb14a3feSDimitry Andric seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __which = ios_base::in | ios_base::out) override; 184cb14a3feSDimitry Andric pos_type seekpos(pos_type __sp, ios_base::openmode __which = ios_base::in | ios_base::out) override; 1850b57cec5SDimitry Andric 1860b57cec5SDimitry Andricprivate: 1870b57cec5SDimitry Andric typedef unsigned __mode_type; 1880b57cec5SDimitry Andric static const __mode_type __allocated = 0x01; 1890b57cec5SDimitry Andric static const __mode_type __constant = 0x02; 1900b57cec5SDimitry Andric static const __mode_type __dynamic = 0x04; 1910b57cec5SDimitry Andric static const __mode_type __frozen = 0x08; 1920b57cec5SDimitry Andric static const streamsize __default_alsize = 4096; 1930b57cec5SDimitry Andric 1940b57cec5SDimitry Andric __mode_type __strmode_; 1950b57cec5SDimitry Andric streamsize __alsize_; 1960b57cec5SDimitry Andric void* (*__palloc_)(size_t); 1970b57cec5SDimitry Andric void (*__pfree_)(void*); 1980b57cec5SDimitry Andric 1990b57cec5SDimitry Andric void __init(char* __gnext, streamsize __n, char* __pbeg); 2000b57cec5SDimitry Andric}; 2010b57cec5SDimitry Andric 2020b57cec5SDimitry Andric# ifndef _LIBCPP_CXX03_LANG 2030b57cec5SDimitry Andric 204cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI strstreambuf::strstreambuf(strstreambuf&& __rhs) 2050b57cec5SDimitry Andric : streambuf(__rhs), 2060b57cec5SDimitry Andric __strmode_(__rhs.__strmode_), 2070b57cec5SDimitry Andric __alsize_(__rhs.__alsize_), 2080b57cec5SDimitry Andric __palloc_(__rhs.__palloc_), 209cb14a3feSDimitry Andric __pfree_(__rhs.__pfree_) { 2100b57cec5SDimitry Andric __rhs.setg(nullptr, nullptr, nullptr); 2110b57cec5SDimitry Andric __rhs.setp(nullptr, nullptr); 2120b57cec5SDimitry Andric} 2130b57cec5SDimitry Andric 214cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI strstreambuf& strstreambuf::operator=(strstreambuf&& __rhs) { 215cb14a3feSDimitry Andric if (eback() && (__strmode_ & __allocated) != 0 && (__strmode_ & __frozen) == 0) { 2160b57cec5SDimitry Andric if (__pfree_) 2170b57cec5SDimitry Andric __pfree_(eback()); 2180b57cec5SDimitry Andric else 2190b57cec5SDimitry Andric delete[] eback(); 2200b57cec5SDimitry Andric } 2210b57cec5SDimitry Andric streambuf::operator=(__rhs); 2220b57cec5SDimitry Andric __strmode_ = __rhs.__strmode_; 2230b57cec5SDimitry Andric __alsize_ = __rhs.__alsize_; 2240b57cec5SDimitry Andric __palloc_ = __rhs.__palloc_; 2250b57cec5SDimitry Andric __pfree_ = __rhs.__pfree_; 2260b57cec5SDimitry Andric __rhs.setg(nullptr, nullptr, nullptr); 2270b57cec5SDimitry Andric __rhs.setp(nullptr, nullptr); 2280b57cec5SDimitry Andric return *this; 2290b57cec5SDimitry Andric} 2300b57cec5SDimitry Andric 2310b57cec5SDimitry Andric# endif // _LIBCPP_CXX03_LANG 2320b57cec5SDimitry Andric 233cb14a3feSDimitry Andricclass _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI istrstream : public istream { 2340b57cec5SDimitry Andricpublic: 235cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI explicit istrstream(const char* __s) : istream(&__sb_), __sb_(__s, 0) {} 236cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI explicit istrstream(char* __s) : istream(&__sb_), __sb_(__s, 0) {} 237cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI istrstream(const char* __s, streamsize __n) : istream(&__sb_), __sb_(__s, __n) {} 238cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI istrstream(char* __s, streamsize __n) : istream(&__sb_), __sb_(__s, __n) {} 2390b57cec5SDimitry Andric 2400b57cec5SDimitry Andric# ifndef _LIBCPP_CXX03_LANG 241cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI istrstream(istrstream&& __rhs) // extension 242cb14a3feSDimitry Andric : istream(std::move(static_cast<istream&>(__rhs))), __sb_(std::move(__rhs.__sb_)) { 2430b57cec5SDimitry Andric istream::set_rdbuf(&__sb_); 2440b57cec5SDimitry Andric } 2450b57cec5SDimitry Andric 246cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI istrstream& operator=(istrstream&& __rhs) { 2475f757f3fSDimitry Andric __sb_ = std::move(__rhs.__sb_); 2485f757f3fSDimitry Andric istream::operator=(std::move(__rhs)); 2490b57cec5SDimitry Andric return *this; 2500b57cec5SDimitry Andric } 2510b57cec5SDimitry Andric# endif // _LIBCPP_CXX03_LANG 2520b57cec5SDimitry Andric 253bdd1243dSDimitry Andric ~istrstream() override; 2540b57cec5SDimitry Andric 255cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void swap(istrstream& __rhs) { 2560b57cec5SDimitry Andric istream::swap(__rhs); 2570b57cec5SDimitry Andric __sb_.swap(__rhs.__sb_); 2580b57cec5SDimitry Andric } 2590b57cec5SDimitry Andric 260cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); } 261cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); } 2620b57cec5SDimitry Andric 2630b57cec5SDimitry Andricprivate: 2640b57cec5SDimitry Andric strstreambuf __sb_; 2650b57cec5SDimitry Andric}; 2660b57cec5SDimitry Andric 267cb14a3feSDimitry Andricclass _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI ostrstream : public ostream { 2680b57cec5SDimitry Andricpublic: 269cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI ostrstream() : ostream(&__sb_) {} 270cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out) 271cb14a3feSDimitry Andric : ostream(&__sb_), __sb_(__s, __n, __s + (__mode & ios::app ? std::strlen(__s) : 0)) {} 2720b57cec5SDimitry Andric 2730b57cec5SDimitry Andric# ifndef _LIBCPP_CXX03_LANG 274cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI ostrstream(ostrstream&& __rhs) // extension 275cb14a3feSDimitry Andric : ostream(std::move(static_cast<ostream&>(__rhs))), __sb_(std::move(__rhs.__sb_)) { 2760b57cec5SDimitry Andric ostream::set_rdbuf(&__sb_); 2770b57cec5SDimitry Andric } 2780b57cec5SDimitry Andric 279cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI ostrstream& operator=(ostrstream&& __rhs) { 2805f757f3fSDimitry Andric __sb_ = std::move(__rhs.__sb_); 2815f757f3fSDimitry Andric ostream::operator=(std::move(__rhs)); 2820b57cec5SDimitry Andric return *this; 2830b57cec5SDimitry Andric } 2840b57cec5SDimitry Andric# endif // _LIBCPP_CXX03_LANG 2850b57cec5SDimitry Andric 286bdd1243dSDimitry Andric ~ostrstream() override; 2870b57cec5SDimitry Andric 288cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void swap(ostrstream& __rhs) { 2890b57cec5SDimitry Andric ostream::swap(__rhs); 2900b57cec5SDimitry Andric __sb_.swap(__rhs.__sb_); 2910b57cec5SDimitry Andric } 2920b57cec5SDimitry Andric 293cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); } 294cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void freeze(bool __freezefl = true) { __sb_.freeze(__freezefl); } 295cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); } 296cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI int pcount() const { return __sb_.pcount(); } 2970b57cec5SDimitry Andric 2980b57cec5SDimitry Andricprivate: 2990b57cec5SDimitry Andric strstreambuf __sb_; // exposition only 3000b57cec5SDimitry Andric}; 3010b57cec5SDimitry Andric 302cb14a3feSDimitry Andricclass _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstream : public iostream { 3030b57cec5SDimitry Andricpublic: 3040b57cec5SDimitry Andric // Types 3050b57cec5SDimitry Andric typedef char char_type; 3060b57cec5SDimitry Andric typedef char_traits<char>::int_type int_type; 3070b57cec5SDimitry Andric typedef char_traits<char>::pos_type pos_type; 3080b57cec5SDimitry Andric typedef char_traits<char>::off_type off_type; 3090b57cec5SDimitry Andric 3100b57cec5SDimitry Andric // constructors/destructor 311cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI strstream() : iostream(&__sb_) {} 312cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out) 313cb14a3feSDimitry Andric : iostream(&__sb_), __sb_(__s, __n, __s + (__mode & ios::app ? std::strlen(__s) : 0)) {} 3140b57cec5SDimitry Andric 3150b57cec5SDimitry Andric# ifndef _LIBCPP_CXX03_LANG 316cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI strstream(strstream&& __rhs) // extension 317cb14a3feSDimitry Andric : iostream(std::move(static_cast<iostream&>(__rhs))), __sb_(std::move(__rhs.__sb_)) { 3180b57cec5SDimitry Andric iostream::set_rdbuf(&__sb_); 3190b57cec5SDimitry Andric } 3200b57cec5SDimitry Andric 321cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI strstream& operator=(strstream&& __rhs) { 3225f757f3fSDimitry Andric __sb_ = std::move(__rhs.__sb_); 3235f757f3fSDimitry Andric iostream::operator=(std::move(__rhs)); 3240b57cec5SDimitry Andric return *this; 3250b57cec5SDimitry Andric } 3260b57cec5SDimitry Andric# endif // _LIBCPP_CXX03_LANG 3270b57cec5SDimitry Andric 328bdd1243dSDimitry Andric ~strstream() override; 3290b57cec5SDimitry Andric 330cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void swap(strstream& __rhs) { 3310b57cec5SDimitry Andric iostream::swap(__rhs); 3320b57cec5SDimitry Andric __sb_.swap(__rhs.__sb_); 3330b57cec5SDimitry Andric } 3340b57cec5SDimitry Andric 3350b57cec5SDimitry Andric // Members: 336cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); } 337cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void freeze(bool __freezefl = true) { __sb_.freeze(__freezefl); } 338cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI int pcount() const { return __sb_.pcount(); } 339cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); } 3400b57cec5SDimitry Andric 3410b57cec5SDimitry Andricprivate: 3420b57cec5SDimitry Andric strstreambuf __sb_; // exposition only 3430b57cec5SDimitry Andric}; 3440b57cec5SDimitry Andric 3450b57cec5SDimitry Andric_LIBCPP_END_NAMESPACE_STD 3460b57cec5SDimitry Andric 347b3edf446SDimitry Andric_LIBCPP_POP_MACROS 348b3edf446SDimitry Andric 349*0fca6ea1SDimitry Andric#endif // _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_STRSTREAM) || defined(_LIBCPP_BUILDING_LIBRARY) 350*0fca6ea1SDimitry Andric 3510b57cec5SDimitry Andric#endif // _LIBCPP_STRSTREAM 352