47 #ifndef _BACKWARD_STRSTREAM
48 #define _BACKWARD_STRSTREAM
56 namespace std _GLIBCXX_VISIBILITY(default)
58 _GLIBCXX_BEGIN_NAMESPACE_VERSION
62 class strstreambuf :
public basic_streambuf<char, char_traits<char> >
66 typedef char_traits<char> _Traits;
67 typedef basic_streambuf<char, _Traits> _Base;
71 #if __cplusplus >= 201103L
72 strstreambuf() : strstreambuf(0) { }
73 explicit strstreambuf(
streamsize __initial_capacity);
75 explicit strstreambuf(
streamsize __initial_capacity = 0);
77 strstreambuf(
void* (*__alloc)(
size_t),
void (*__free)(
void*));
79 strstreambuf(
char* __get,
streamsize __n,
char* __put = 0) throw ();
80 strstreambuf(
signed char* __get,
streamsize __n,
signed char* __put = 0) throw ();
81 strstreambuf(
unsigned char* __get,
streamsize __n,
unsigned char* __put=0) throw ();
83 strstreambuf(const
char* __get,
streamsize __n) throw ();
84 strstreambuf(const
signed char* __get,
streamsize __n) throw ();
85 strstreambuf(const
unsigned char* __get,
streamsize __n) throw ();
87 virtual ~strstreambuf();
89 #if __cplusplus >= 201103L
90 strstreambuf(strstreambuf&& __rhs) noexcept
91 : _Base(__rhs), _M_alloc_fun(__rhs._M_alloc_fun),
92 _M_free_fun(__rhs._M_free_fun), _M_dynamic(__rhs._M_dynamic),
93 _M_frozen(__rhs._M_frozen), _M_constant(__rhs._M_constant)
95 __rhs.setg(
nullptr,
nullptr,
nullptr);
96 __rhs.setp(
nullptr,
nullptr);
100 operator=(strstreambuf&& __rhs) noexcept
102 if (_M_dynamic && !_M_frozen)
104 _Base::operator=(static_cast<const _Base&>(__rhs));
105 _M_alloc_fun = __rhs._M_alloc_fun;
106 _M_free_fun = __rhs._M_free_fun;
107 _M_dynamic = __rhs._M_dynamic;
108 _M_frozen = __rhs._M_frozen;
109 _M_constant = __rhs._M_constant;
110 __rhs.setg(
nullptr,
nullptr,
nullptr);
111 __rhs.setp(
nullptr,
nullptr);
117 void freeze(
bool =
true) throw ();
118 char* str() throw ();
119 _GLIBCXX_PURE
int pcount() const throw ();
122 virtual int_type overflow(int_type __c = _Traits::eof());
123 virtual int_type pbackfail(int_type __c = _Traits::eof());
124 virtual int_type underflow();
125 virtual _Base* setbuf(
char* __buf,
streamsize __n);
126 virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
127 ios_base::openmode __mode
128 = ios_base::in | ios_base::out);
129 virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode
130 = ios_base::in | ios_base::out);
133 #if __cplusplus < 201103L
135 operator=(
const strstreambuf&);
137 strstreambuf(
const strstreambuf&);
141 char* _M_alloc(
size_t);
145 void _M_setup(
char* __get,
char* __put,
streamsize __n)
throw ();
148 void* (*_M_alloc_fun)(size_t);
149 void (*_M_free_fun)(
void*);
153 bool _M_constant : 1;
157 class istrstream :
public basic_istream<char>
160 explicit istrstream(
char*);
161 explicit istrstream(
const char*);
164 virtual ~istrstream();
166 #if __cplusplus >= 201103L
167 istrstream(istrstream&& __rhs)
169 { set_rdbuf(&_M_buf); }
171 istrstream& operator=(istrstream&&) =
default;
174 _GLIBCXX_CONST strstreambuf*
rdbuf()
const throw ();
175 char* str() throw ();
182 class ostrstream : public basic_ostream<
char>
187 virtual ~ostrstream();
189 #if __cplusplus >= 201103L
190 ostrstream(ostrstream&& __rhs)
192 { set_rdbuf(&_M_buf); }
194 ostrstream& operator=(ostrstream&&) =
default;
197 _GLIBCXX_CONST strstreambuf*
rdbuf()
const throw ();
198 void freeze(
bool = true) throw();
199 char* str() throw ();
200 _GLIBCXX_PURE
int pcount() const throw ();
207 class strstream : public basic_iostream<
char>
210 typedef char char_type;
211 typedef char_traits<char>::int_type int_type;
212 typedef char_traits<char>::pos_type pos_type;
213 typedef char_traits<char>::off_type off_type;
217 virtual ~strstream();
219 #if __cplusplus >= 201103L
220 strstream(strstream&& __rhs)
222 { set_rdbuf(&_M_buf); }
224 strstream& operator=(strstream&&) =
default;
227 _GLIBCXX_CONST strstreambuf*
rdbuf()
const throw ();
228 void freeze(
bool = true) throw ();
229 _GLIBCXX_PURE
int pcount() const throw ();
230 char* str() throw ();
236 _GLIBCXX_END_NAMESPACE_VERSION
basic_streambuf< char, char_traits< char > > * rdbuf(basic_streambuf< char, char_traits< char > > *__sb)
Changing the underlying buffer.
char_type * eback() const
Access to the get area.
basic_ostream< char > ostream
Base class for char output streams.
static const openmode in
Open for input. Default for ifstream and fstream.
static const openmode out
Open for output. Default for ofstream and fstream.
basic_iostream< char > iostream
Base class for char mixed input and output streams.
basic_istream< char > istream
Base class for char input streams.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
_Ios_Openmode openmode
This is a bitmask type.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.