2010-05-12 03:42:16 +08:00
|
|
|
// -*- C++ -*-
|
2021-11-18 05:25:01 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2010-05-12 03:42:16 +08:00
|
|
|
//
|
2019-01-19 18:56:40 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2010-05-12 03:42:16 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef _LIBCPP_STRSTREAM
|
|
|
|
#define _LIBCPP_STRSTREAM
|
|
|
|
|
|
|
|
/*
|
|
|
|
strstream synopsis
|
|
|
|
|
|
|
|
class strstreambuf
|
|
|
|
: public basic_streambuf<char>
|
|
|
|
{
|
|
|
|
public:
|
2021-01-19 15:21:09 +08:00
|
|
|
explicit strstreambuf(streamsize alsize_arg = 0); // before C++20
|
|
|
|
strstreambuf() : strstreambuf(0) {} // C++20
|
|
|
|
explicit strstreambuf(streamsize alsize_arg); // C++20
|
|
|
|
|
2010-05-12 03:42:16 +08:00
|
|
|
strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));
|
2020-11-25 01:53:53 +08:00
|
|
|
strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = nullptr);
|
2010-05-12 03:42:16 +08:00
|
|
|
strstreambuf(const char* gnext_arg, streamsize n);
|
|
|
|
|
2020-11-25 01:53:53 +08:00
|
|
|
strstreambuf(signed char* gnext_arg, streamsize n, signed char* pbeg_arg = nullptr);
|
2010-05-12 03:42:16 +08:00
|
|
|
strstreambuf(const signed char* gnext_arg, streamsize n);
|
2020-11-25 01:53:53 +08:00
|
|
|
strstreambuf(unsigned char* gnext_arg, streamsize n, unsigned char* pbeg_arg = nullptr);
|
2010-05-12 03:42:16 +08:00
|
|
|
strstreambuf(const unsigned char* gnext_arg, streamsize n);
|
|
|
|
|
|
|
|
strstreambuf(strstreambuf&& rhs);
|
|
|
|
strstreambuf& operator=(strstreambuf&& rhs);
|
|
|
|
|
|
|
|
virtual ~strstreambuf();
|
|
|
|
|
|
|
|
void swap(strstreambuf& rhs);
|
|
|
|
|
|
|
|
void freeze(bool freezefl = true);
|
|
|
|
char* str();
|
|
|
|
int pcount() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual int_type overflow (int_type c = EOF);
|
|
|
|
virtual int_type pbackfail(int_type c = EOF);
|
|
|
|
virtual int_type underflow();
|
|
|
|
virtual pos_type seekoff(off_type off, ios_base::seekdir way,
|
|
|
|
ios_base::openmode which = ios_base::in | ios_base::out);
|
|
|
|
virtual pos_type seekpos(pos_type sp,
|
|
|
|
ios_base::openmode which = ios_base::in | ios_base::out);
|
|
|
|
virtual streambuf* setbuf(char* s, streamsize n);
|
|
|
|
|
|
|
|
private:
|
|
|
|
typedef T1 strstate; // exposition only
|
|
|
|
static const strstate allocated; // exposition only
|
|
|
|
static const strstate constant; // exposition only
|
|
|
|
static const strstate dynamic; // exposition only
|
|
|
|
static const strstate frozen; // exposition only
|
|
|
|
strstate strmode; // exposition only
|
|
|
|
streamsize alsize; // exposition only
|
|
|
|
void* (*palloc)(size_t); // exposition only
|
|
|
|
void (*pfree)(void*); // exposition only
|
|
|
|
};
|
|
|
|
|
|
|
|
class istrstream
|
|
|
|
: public basic_istream<char>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit istrstream(const char* s);
|
|
|
|
explicit istrstream(char* s);
|
|
|
|
istrstream(const char* s, streamsize n);
|
|
|
|
istrstream(char* s, streamsize n);
|
|
|
|
|
|
|
|
virtual ~istrstream();
|
|
|
|
|
|
|
|
strstreambuf* rdbuf() const;
|
|
|
|
char *str();
|
|
|
|
|
|
|
|
private:
|
|
|
|
strstreambuf sb; // exposition only
|
|
|
|
};
|
|
|
|
|
|
|
|
class ostrstream
|
|
|
|
: public basic_ostream<char>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ostrstream();
|
|
|
|
ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out);
|
|
|
|
|
|
|
|
virtual ~ostrstream();
|
|
|
|
|
|
|
|
strstreambuf* rdbuf() const;
|
|
|
|
void freeze(bool freezefl = true);
|
|
|
|
char* str();
|
|
|
|
int pcount() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
strstreambuf sb; // exposition only
|
|
|
|
};
|
|
|
|
|
|
|
|
class strstream
|
|
|
|
: public basic_iostream<char>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Types
|
|
|
|
typedef char char_type;
|
|
|
|
typedef char_traits<char>::int_type int_type;
|
|
|
|
typedef char_traits<char>::pos_type pos_type;
|
|
|
|
typedef char_traits<char>::off_type off_type;
|
|
|
|
|
|
|
|
// constructors/destructor
|
|
|
|
strstream();
|
|
|
|
strstream(char* s, int n, ios_base::openmode mode = ios_base::in | ios_base::out);
|
|
|
|
|
|
|
|
virtual ~strstream();
|
|
|
|
|
|
|
|
// Members:
|
|
|
|
strstreambuf* rdbuf() const;
|
|
|
|
void freeze(bool freezefl = true);
|
|
|
|
int pcount() const;
|
|
|
|
char* str();
|
|
|
|
|
|
|
|
private:
|
|
|
|
strstreambuf sb; // exposition only
|
|
|
|
};
|
|
|
|
|
|
|
|
} // std
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <__config>
|
|
|
|
#include <istream>
|
2021-05-19 23:57:04 +08:00
|
|
|
#include <ostream>
|
2021-12-23 01:14:14 +08:00
|
|
|
#include <version>
|
2010-05-12 03:42:16 +08:00
|
|
|
|
2011-10-18 04:05:10 +08:00
|
|
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
2022-02-02 09:16:40 +08:00
|
|
|
# pragma GCC system_header
|
2011-10-18 04:05:10 +08:00
|
|
|
#endif
|
2010-05-12 03:42:16 +08:00
|
|
|
|
|
|
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
|
|
|
|
2013-03-07 07:30:19 +08:00
|
|
|
class _LIBCPP_TYPE_VIS strstreambuf
|
2010-05-12 03:42:16 +08:00
|
|
|
: public streambuf
|
|
|
|
{
|
|
|
|
public:
|
2021-01-19 15:21:09 +08:00
|
|
|
#ifndef _LIBCPP_CXX03_LANG
|
|
|
|
strstreambuf() : strstreambuf(0) {}
|
|
|
|
explicit strstreambuf(streamsize __alsize);
|
|
|
|
#else
|
2010-05-12 03:42:16 +08:00
|
|
|
explicit strstreambuf(streamsize __alsize = 0);
|
2021-01-19 15:21:09 +08:00
|
|
|
#endif
|
2010-05-12 03:42:16 +08:00
|
|
|
strstreambuf(void* (*__palloc)(size_t), void (*__pfree)(void*));
|
2020-11-25 01:53:53 +08:00
|
|
|
strstreambuf(char* __gnext, streamsize __n, char* __pbeg = nullptr);
|
2010-05-12 03:42:16 +08:00
|
|
|
strstreambuf(const char* __gnext, streamsize __n);
|
|
|
|
|
2020-11-25 01:53:53 +08:00
|
|
|
strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg = nullptr);
|
2010-05-12 03:42:16 +08:00
|
|
|
strstreambuf(const signed char* __gnext, streamsize __n);
|
2020-11-25 01:53:53 +08:00
|
|
|
strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = nullptr);
|
2010-05-12 03:42:16 +08:00
|
|
|
strstreambuf(const unsigned char* __gnext, streamsize __n);
|
|
|
|
|
2017-04-19 07:38:41 +08:00
|
|
|
#ifndef _LIBCPP_CXX03_LANG
|
2011-07-08 05:03:52 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
strstreambuf(strstreambuf&& __rhs);
|
2011-07-08 05:03:52 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
strstreambuf& operator=(strstreambuf&& __rhs);
|
2021-04-21 00:03:32 +08:00
|
|
|
#endif // _LIBCPP_CXX03_LANG
|
2010-05-12 03:42:16 +08:00
|
|
|
|
|
|
|
virtual ~strstreambuf();
|
|
|
|
|
|
|
|
void swap(strstreambuf& __rhs);
|
|
|
|
|
|
|
|
void freeze(bool __freezefl = true);
|
|
|
|
char* str();
|
|
|
|
int pcount() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual int_type overflow (int_type __c = EOF);
|
|
|
|
virtual int_type pbackfail(int_type __c = EOF);
|
|
|
|
virtual int_type underflow();
|
|
|
|
virtual pos_type seekoff(off_type __off, ios_base::seekdir __way,
|
|
|
|
ios_base::openmode __which = ios_base::in | ios_base::out);
|
|
|
|
virtual pos_type seekpos(pos_type __sp,
|
|
|
|
ios_base::openmode __which = ios_base::in | ios_base::out);
|
|
|
|
|
|
|
|
private:
|
|
|
|
typedef unsigned __mode_type;
|
|
|
|
static const __mode_type __allocated = 0x01;
|
|
|
|
static const __mode_type __constant = 0x02;
|
|
|
|
static const __mode_type __dynamic = 0x04;
|
|
|
|
static const __mode_type __frozen = 0x08;
|
|
|
|
static const streamsize __default_alsize = 4096;
|
|
|
|
|
|
|
|
__mode_type __strmode_;
|
|
|
|
streamsize __alsize_;
|
|
|
|
void* (*__palloc_)(size_t);
|
|
|
|
void (*__pfree_)(void*);
|
|
|
|
|
|
|
|
void __init(char* __gnext, streamsize __n, char* __pbeg);
|
|
|
|
};
|
|
|
|
|
2017-04-19 07:38:41 +08:00
|
|
|
#ifndef _LIBCPP_CXX03_LANG
|
2011-07-08 05:03:52 +08:00
|
|
|
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
strstreambuf::strstreambuf(strstreambuf&& __rhs)
|
|
|
|
: streambuf(__rhs),
|
|
|
|
__strmode_(__rhs.__strmode_),
|
|
|
|
__alsize_(__rhs.__alsize_),
|
|
|
|
__palloc_(__rhs.__palloc_),
|
|
|
|
__pfree_(__rhs.__pfree_)
|
|
|
|
{
|
|
|
|
__rhs.setg(nullptr, nullptr, nullptr);
|
|
|
|
__rhs.setp(nullptr, nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline _LIBCPP_INLINE_VISIBILITY
|
|
|
|
strstreambuf&
|
|
|
|
strstreambuf::operator=(strstreambuf&& __rhs)
|
|
|
|
{
|
|
|
|
if (eback() && (__strmode_ & __allocated) != 0 && (__strmode_ & __frozen) == 0)
|
|
|
|
{
|
|
|
|
if (__pfree_)
|
|
|
|
__pfree_(eback());
|
|
|
|
else
|
|
|
|
delete [] eback();
|
|
|
|
}
|
|
|
|
streambuf::operator=(__rhs);
|
|
|
|
__strmode_ = __rhs.__strmode_;
|
|
|
|
__alsize_ = __rhs.__alsize_;
|
|
|
|
__palloc_ = __rhs.__palloc_;
|
|
|
|
__pfree_ = __rhs.__pfree_;
|
|
|
|
__rhs.setg(nullptr, nullptr, nullptr);
|
|
|
|
__rhs.setp(nullptr, nullptr);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2021-04-21 00:03:32 +08:00
|
|
|
#endif // _LIBCPP_CXX03_LANG
|
2011-07-08 05:03:52 +08:00
|
|
|
|
2013-03-07 07:30:19 +08:00
|
|
|
class _LIBCPP_TYPE_VIS istrstream
|
2010-05-12 03:42:16 +08:00
|
|
|
: public istream
|
|
|
|
{
|
|
|
|
public:
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
explicit istrstream(const char* __s)
|
|
|
|
: istream(&__sb_), __sb_(__s, 0) {}
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
explicit istrstream(char* __s)
|
|
|
|
: istream(&__sb_), __sb_(__s, 0) {}
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
istrstream(const char* __s, streamsize __n)
|
|
|
|
: istream(&__sb_), __sb_(__s, __n) {}
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
istrstream(char* __s, streamsize __n)
|
|
|
|
: istream(&__sb_), __sb_(__s, __n) {}
|
|
|
|
|
2017-04-19 07:38:41 +08:00
|
|
|
#ifndef _LIBCPP_CXX03_LANG
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
istrstream(istrstream&& __rhs)
|
2011-07-01 05:18:19 +08:00
|
|
|
: istream(_VSTD::move(__rhs)),
|
|
|
|
__sb_(_VSTD::move(__rhs.__sb_))
|
2010-05-12 03:42:16 +08:00
|
|
|
{
|
|
|
|
istream::set_rdbuf(&__sb_);
|
|
|
|
}
|
|
|
|
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
istrstream& operator=(istrstream&& __rhs)
|
|
|
|
{
|
2011-07-01 05:18:19 +08:00
|
|
|
istream::operator=(_VSTD::move(__rhs));
|
|
|
|
__sb_ = _VSTD::move(__rhs.__sb_);
|
2010-05-12 03:42:16 +08:00
|
|
|
return *this;
|
|
|
|
}
|
2021-04-21 00:03:32 +08:00
|
|
|
#endif // _LIBCPP_CXX03_LANG
|
2010-05-12 03:42:16 +08:00
|
|
|
|
|
|
|
virtual ~istrstream();
|
|
|
|
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
void swap(istrstream& __rhs)
|
|
|
|
{
|
|
|
|
istream::swap(__rhs);
|
|
|
|
__sb_.swap(__rhs.__sb_);
|
|
|
|
}
|
|
|
|
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
char *str() {return __sb_.str();}
|
|
|
|
|
|
|
|
private:
|
|
|
|
strstreambuf __sb_;
|
|
|
|
};
|
|
|
|
|
2013-03-07 07:30:19 +08:00
|
|
|
class _LIBCPP_TYPE_VIS ostrstream
|
2010-05-12 03:42:16 +08:00
|
|
|
: public ostream
|
|
|
|
{
|
|
|
|
public:
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
ostrstream()
|
|
|
|
: ostream(&__sb_) {}
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out)
|
|
|
|
: ostream(&__sb_),
|
2020-12-08 10:50:15 +08:00
|
|
|
__sb_(__s, __n, __s + (__mode & ios::app ? _VSTD::strlen(__s) : 0))
|
2010-05-12 03:42:16 +08:00
|
|
|
{}
|
|
|
|
|
2017-04-19 07:38:41 +08:00
|
|
|
#ifndef _LIBCPP_CXX03_LANG
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
ostrstream(ostrstream&& __rhs)
|
2011-07-01 05:18:19 +08:00
|
|
|
: ostream(_VSTD::move(__rhs)),
|
|
|
|
__sb_(_VSTD::move(__rhs.__sb_))
|
2010-05-12 03:42:16 +08:00
|
|
|
{
|
|
|
|
ostream::set_rdbuf(&__sb_);
|
|
|
|
}
|
|
|
|
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
ostrstream& operator=(ostrstream&& __rhs)
|
|
|
|
{
|
2011-07-01 05:18:19 +08:00
|
|
|
ostream::operator=(_VSTD::move(__rhs));
|
|
|
|
__sb_ = _VSTD::move(__rhs.__sb_);
|
2010-05-12 03:42:16 +08:00
|
|
|
return *this;
|
|
|
|
}
|
2021-04-21 00:03:32 +08:00
|
|
|
#endif // _LIBCPP_CXX03_LANG
|
2010-05-12 03:42:16 +08:00
|
|
|
|
|
|
|
virtual ~ostrstream();
|
|
|
|
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
void swap(ostrstream& __rhs)
|
|
|
|
{
|
|
|
|
ostream::swap(__rhs);
|
|
|
|
__sb_.swap(__rhs.__sb_);
|
|
|
|
}
|
|
|
|
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
char* str() {return __sb_.str();}
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
int pcount() const {return __sb_.pcount();}
|
|
|
|
|
|
|
|
private:
|
|
|
|
strstreambuf __sb_; // exposition only
|
|
|
|
};
|
|
|
|
|
2013-03-07 07:30:19 +08:00
|
|
|
class _LIBCPP_TYPE_VIS strstream
|
2010-05-12 03:42:16 +08:00
|
|
|
: public iostream
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Types
|
|
|
|
typedef char char_type;
|
|
|
|
typedef char_traits<char>::int_type int_type;
|
|
|
|
typedef char_traits<char>::pos_type pos_type;
|
|
|
|
typedef char_traits<char>::off_type off_type;
|
|
|
|
|
|
|
|
// constructors/destructor
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
strstream()
|
|
|
|
: iostream(&__sb_) {}
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out)
|
|
|
|
: iostream(&__sb_),
|
2020-12-08 10:50:15 +08:00
|
|
|
__sb_(__s, __n, __s + (__mode & ios::app ? _VSTD::strlen(__s) : 0))
|
2010-05-12 03:42:16 +08:00
|
|
|
{}
|
|
|
|
|
2017-04-19 07:38:41 +08:00
|
|
|
#ifndef _LIBCPP_CXX03_LANG
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
strstream(strstream&& __rhs)
|
2011-07-01 05:18:19 +08:00
|
|
|
: iostream(_VSTD::move(__rhs)),
|
|
|
|
__sb_(_VSTD::move(__rhs.__sb_))
|
2010-05-12 03:42:16 +08:00
|
|
|
{
|
|
|
|
iostream::set_rdbuf(&__sb_);
|
|
|
|
}
|
|
|
|
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
strstream& operator=(strstream&& __rhs)
|
|
|
|
{
|
2011-07-01 05:18:19 +08:00
|
|
|
iostream::operator=(_VSTD::move(__rhs));
|
|
|
|
__sb_ = _VSTD::move(__rhs.__sb_);
|
2010-05-12 03:42:16 +08:00
|
|
|
return *this;
|
|
|
|
}
|
2021-04-21 00:03:32 +08:00
|
|
|
#endif // _LIBCPP_CXX03_LANG
|
2010-05-12 03:42:16 +08:00
|
|
|
|
|
|
|
virtual ~strstream();
|
|
|
|
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
void swap(strstream& __rhs)
|
|
|
|
{
|
|
|
|
iostream::swap(__rhs);
|
|
|
|
__sb_.swap(__rhs.__sb_);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Members:
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
int pcount() const {return __sb_.pcount();}
|
2010-09-24 01:31:07 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2010-05-12 03:42:16 +08:00
|
|
|
char* str() {return __sb_.str();}
|
|
|
|
|
|
|
|
private:
|
|
|
|
strstreambuf __sb_; // exposition only
|
|
|
|
};
|
|
|
|
|
|
|
|
_LIBCPP_END_NAMESPACE_STD
|
|
|
|
|
2021-04-21 00:03:32 +08:00
|
|
|
#endif // _LIBCPP_STRSTREAM
|