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
160b57cec5SDimitry Andricclass strstreambuf
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
660b57cec5SDimitry Andricclass istrstream
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
840b57cec5SDimitry Andricclass ostrstream
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
1020b57cec5SDimitry Andricclass strstream
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
13281ad6265SDimitry Andric#include <__assert> // all public C++ headers provide the assertion handler
1330b57cec5SDimitry Andric#include <__config>
1340b57cec5SDimitry Andric#include <istream>
135fe6060f1SDimitry Andric#include <ostream>
13604eeddc0SDimitry Andric#include <version>
1370b57cec5SDimitry Andric
1380b57cec5SDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1390b57cec5SDimitry Andric#  pragma GCC system_header
1400b57cec5SDimitry Andric#endif
1410b57cec5SDimitry Andric
142b3edf446SDimitry Andric_LIBCPP_PUSH_MACROS
143b3edf446SDimitry Andric#include <__undef_macros>
144b3edf446SDimitry Andric
1450b57cec5SDimitry Andric_LIBCPP_BEGIN_NAMESPACE_STD
1460b57cec5SDimitry Andric
147cb14a3feSDimitry Andricclass _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstreambuf : public streambuf {
1480b57cec5SDimitry Andricpublic:
149e8d8bef9SDimitry Andric#ifndef _LIBCPP_CXX03_LANG
15006c3fb27SDimitry Andric  _LIBCPP_HIDE_FROM_ABI strstreambuf() : strstreambuf(0) {}
151e8d8bef9SDimitry Andric  explicit strstreambuf(streamsize __alsize);
152e8d8bef9SDimitry Andric#else
1530b57cec5SDimitry Andric  explicit strstreambuf(streamsize __alsize = 0);
154e8d8bef9SDimitry Andric#endif
1550b57cec5SDimitry Andric  strstreambuf(void* (*__palloc)(size_t), void (*__pfree)(void*));
156e8d8bef9SDimitry Andric  strstreambuf(char* __gnext, streamsize __n, char* __pbeg = nullptr);
1570b57cec5SDimitry Andric  strstreambuf(const char* __gnext, streamsize __n);
1580b57cec5SDimitry Andric
159e8d8bef9SDimitry Andric  strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg = nullptr);
1600b57cec5SDimitry Andric  strstreambuf(const signed char* __gnext, streamsize __n);
161e8d8bef9SDimitry Andric  strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = nullptr);
1620b57cec5SDimitry Andric  strstreambuf(const unsigned char* __gnext, streamsize __n);
1630b57cec5SDimitry Andric
1640b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG
165cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI strstreambuf(strstreambuf&& __rhs);
166cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI strstreambuf& operator=(strstreambuf&& __rhs);
1670b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG
1680b57cec5SDimitry Andric
169bdd1243dSDimitry Andric  ~strstreambuf() override;
1700b57cec5SDimitry Andric
1710b57cec5SDimitry Andric  void swap(strstreambuf& __rhs);
1720b57cec5SDimitry Andric
1730b57cec5SDimitry Andric  void freeze(bool __freezefl = true);
1740b57cec5SDimitry Andric  char* str();
1750b57cec5SDimitry Andric  int pcount() const;
1760b57cec5SDimitry Andric
1770b57cec5SDimitry Andricprotected:
178bdd1243dSDimitry Andric  int_type overflow(int_type __c = EOF) override;
179bdd1243dSDimitry Andric  int_type pbackfail(int_type __c = EOF) override;
180bdd1243dSDimitry Andric  int_type underflow() override;
181cb14a3feSDimitry Andric  pos_type
182cb14a3feSDimitry Andric  seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __which = ios_base::in | ios_base::out) override;
183cb14a3feSDimitry Andric  pos_type seekpos(pos_type __sp, ios_base::openmode __which = ios_base::in | ios_base::out) override;
1840b57cec5SDimitry Andric
1850b57cec5SDimitry Andricprivate:
1860b57cec5SDimitry Andric  typedef unsigned __mode_type;
1870b57cec5SDimitry Andric  static const __mode_type __allocated     = 0x01;
1880b57cec5SDimitry Andric  static const __mode_type __constant      = 0x02;
1890b57cec5SDimitry Andric  static const __mode_type __dynamic       = 0x04;
1900b57cec5SDimitry Andric  static const __mode_type __frozen        = 0x08;
1910b57cec5SDimitry Andric  static const streamsize __default_alsize = 4096;
1920b57cec5SDimitry Andric
1930b57cec5SDimitry Andric  __mode_type __strmode_;
1940b57cec5SDimitry Andric  streamsize __alsize_;
1950b57cec5SDimitry Andric  void* (*__palloc_)(size_t);
1960b57cec5SDimitry Andric  void (*__pfree_)(void*);
1970b57cec5SDimitry Andric
1980b57cec5SDimitry Andric  void __init(char* __gnext, streamsize __n, char* __pbeg);
1990b57cec5SDimitry Andric};
2000b57cec5SDimitry Andric
2010b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG
2020b57cec5SDimitry Andric
203cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI strstreambuf::strstreambuf(strstreambuf&& __rhs)
2040b57cec5SDimitry Andric    : streambuf(__rhs),
2050b57cec5SDimitry Andric      __strmode_(__rhs.__strmode_),
2060b57cec5SDimitry Andric      __alsize_(__rhs.__alsize_),
2070b57cec5SDimitry Andric      __palloc_(__rhs.__palloc_),
208cb14a3feSDimitry Andric      __pfree_(__rhs.__pfree_) {
2090b57cec5SDimitry Andric  __rhs.setg(nullptr, nullptr, nullptr);
2100b57cec5SDimitry Andric  __rhs.setp(nullptr, nullptr);
2110b57cec5SDimitry Andric}
2120b57cec5SDimitry Andric
213cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI strstreambuf& strstreambuf::operator=(strstreambuf&& __rhs) {
214cb14a3feSDimitry Andric  if (eback() && (__strmode_ & __allocated) != 0 && (__strmode_ & __frozen) == 0) {
2150b57cec5SDimitry Andric    if (__pfree_)
2160b57cec5SDimitry Andric      __pfree_(eback());
2170b57cec5SDimitry Andric    else
2180b57cec5SDimitry Andric      delete[] eback();
2190b57cec5SDimitry Andric  }
2200b57cec5SDimitry Andric  streambuf::operator=(__rhs);
2210b57cec5SDimitry Andric  __strmode_ = __rhs.__strmode_;
2220b57cec5SDimitry Andric  __alsize_  = __rhs.__alsize_;
2230b57cec5SDimitry Andric  __palloc_  = __rhs.__palloc_;
2240b57cec5SDimitry Andric  __pfree_   = __rhs.__pfree_;
2250b57cec5SDimitry Andric  __rhs.setg(nullptr, nullptr, nullptr);
2260b57cec5SDimitry Andric  __rhs.setp(nullptr, nullptr);
2270b57cec5SDimitry Andric  return *this;
2280b57cec5SDimitry Andric}
2290b57cec5SDimitry Andric
2300b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG
2310b57cec5SDimitry Andric
232cb14a3feSDimitry Andricclass _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI istrstream : public istream {
2330b57cec5SDimitry Andricpublic:
234cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI explicit istrstream(const char* __s) : istream(&__sb_), __sb_(__s, 0) {}
235cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI explicit istrstream(char* __s) : istream(&__sb_), __sb_(__s, 0) {}
236cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI istrstream(const char* __s, streamsize __n) : istream(&__sb_), __sb_(__s, __n) {}
237cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI istrstream(char* __s, streamsize __n) : istream(&__sb_), __sb_(__s, __n) {}
2380b57cec5SDimitry Andric
2390b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG
240cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI istrstream(istrstream&& __rhs) // extension
241cb14a3feSDimitry Andric      : istream(std::move(static_cast<istream&>(__rhs))), __sb_(std::move(__rhs.__sb_)) {
2420b57cec5SDimitry Andric    istream::set_rdbuf(&__sb_);
2430b57cec5SDimitry Andric  }
2440b57cec5SDimitry Andric
245cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI istrstream& operator=(istrstream&& __rhs) {
2465f757f3fSDimitry Andric    __sb_ = std::move(__rhs.__sb_);
2475f757f3fSDimitry Andric    istream::operator=(std::move(__rhs));
2480b57cec5SDimitry Andric    return *this;
2490b57cec5SDimitry Andric  }
2500b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG
2510b57cec5SDimitry Andric
252bdd1243dSDimitry Andric  ~istrstream() override;
2530b57cec5SDimitry Andric
254cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI void swap(istrstream& __rhs) {
2550b57cec5SDimitry Andric    istream::swap(__rhs);
2560b57cec5SDimitry Andric    __sb_.swap(__rhs.__sb_);
2570b57cec5SDimitry Andric  }
2580b57cec5SDimitry Andric
259cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); }
260cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); }
2610b57cec5SDimitry Andric
2620b57cec5SDimitry Andricprivate:
2630b57cec5SDimitry Andric  strstreambuf __sb_;
2640b57cec5SDimitry Andric};
2650b57cec5SDimitry Andric
266cb14a3feSDimitry Andricclass _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI ostrstream : public ostream {
2670b57cec5SDimitry Andricpublic:
268cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI ostrstream() : ostream(&__sb_) {}
269cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out)
270cb14a3feSDimitry Andric      : ostream(&__sb_), __sb_(__s, __n, __s + (__mode & ios::app ? std::strlen(__s) : 0)) {}
2710b57cec5SDimitry Andric
2720b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG
273cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI ostrstream(ostrstream&& __rhs) // extension
274cb14a3feSDimitry Andric      : ostream(std::move(static_cast<ostream&>(__rhs))), __sb_(std::move(__rhs.__sb_)) {
2750b57cec5SDimitry Andric    ostream::set_rdbuf(&__sb_);
2760b57cec5SDimitry Andric  }
2770b57cec5SDimitry Andric
278cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI ostrstream& operator=(ostrstream&& __rhs) {
2795f757f3fSDimitry Andric    __sb_ = std::move(__rhs.__sb_);
2805f757f3fSDimitry Andric    ostream::operator=(std::move(__rhs));
2810b57cec5SDimitry Andric    return *this;
2820b57cec5SDimitry Andric  }
2830b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG
2840b57cec5SDimitry Andric
285bdd1243dSDimitry Andric  ~ostrstream() override;
2860b57cec5SDimitry Andric
287cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI void swap(ostrstream& __rhs) {
2880b57cec5SDimitry Andric    ostream::swap(__rhs);
2890b57cec5SDimitry Andric    __sb_.swap(__rhs.__sb_);
2900b57cec5SDimitry Andric  }
2910b57cec5SDimitry Andric
292cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); }
293cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI void freeze(bool __freezefl = true) { __sb_.freeze(__freezefl); }
294cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); }
295cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI int pcount() const { return __sb_.pcount(); }
2960b57cec5SDimitry Andric
2970b57cec5SDimitry Andricprivate:
2980b57cec5SDimitry Andric  strstreambuf __sb_; // exposition only
2990b57cec5SDimitry Andric};
3000b57cec5SDimitry Andric
301cb14a3feSDimitry Andricclass _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstream : public iostream {
3020b57cec5SDimitry Andricpublic:
3030b57cec5SDimitry Andric  // Types
3040b57cec5SDimitry Andric  typedef char char_type;
3050b57cec5SDimitry Andric  typedef char_traits<char>::int_type int_type;
3060b57cec5SDimitry Andric  typedef char_traits<char>::pos_type pos_type;
3070b57cec5SDimitry Andric  typedef char_traits<char>::off_type off_type;
3080b57cec5SDimitry Andric
3090b57cec5SDimitry Andric  // constructors/destructor
310cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI strstream() : iostream(&__sb_) {}
311cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out)
312cb14a3feSDimitry Andric      : iostream(&__sb_), __sb_(__s, __n, __s + (__mode & ios::app ? std::strlen(__s) : 0)) {}
3130b57cec5SDimitry Andric
3140b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG
315cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI strstream(strstream&& __rhs) // extension
316cb14a3feSDimitry Andric      : iostream(std::move(static_cast<iostream&>(__rhs))), __sb_(std::move(__rhs.__sb_)) {
3170b57cec5SDimitry Andric    iostream::set_rdbuf(&__sb_);
3180b57cec5SDimitry Andric  }
3190b57cec5SDimitry Andric
320cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI strstream& operator=(strstream&& __rhs) {
3215f757f3fSDimitry Andric    __sb_ = std::move(__rhs.__sb_);
3225f757f3fSDimitry Andric    iostream::operator=(std::move(__rhs));
3230b57cec5SDimitry Andric    return *this;
3240b57cec5SDimitry Andric  }
3250b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG
3260b57cec5SDimitry Andric
327bdd1243dSDimitry Andric  ~strstream() override;
3280b57cec5SDimitry Andric
329cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI void swap(strstream& __rhs) {
3300b57cec5SDimitry Andric    iostream::swap(__rhs);
3310b57cec5SDimitry Andric    __sb_.swap(__rhs.__sb_);
3320b57cec5SDimitry Andric  }
3330b57cec5SDimitry Andric
3340b57cec5SDimitry Andric  // Members:
335cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI strstreambuf* rdbuf() const { return const_cast<strstreambuf*>(&__sb_); }
336cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI void freeze(bool __freezefl = true) { __sb_.freeze(__freezefl); }
337cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI int pcount() const { return __sb_.pcount(); }
338cb14a3feSDimitry Andric  _LIBCPP_HIDE_FROM_ABI char* str() { return __sb_.str(); }
3390b57cec5SDimitry Andric
3400b57cec5SDimitry Andricprivate:
3410b57cec5SDimitry Andric  strstreambuf __sb_; // exposition only
3420b57cec5SDimitry Andric};
3430b57cec5SDimitry Andric
3440b57cec5SDimitry Andric_LIBCPP_END_NAMESPACE_STD
3450b57cec5SDimitry Andric
346b3edf446SDimitry Andric_LIBCPP_POP_MACROS
347b3edf446SDimitry Andric
3480b57cec5SDimitry Andric#endif // _LIBCPP_STRSTREAM
349