47 #ifndef _BACKWARD_STRSTREAM
48 #define _BACKWARD_STRSTREAM
56 namespace std _GLIBCXX_VISIBILITY(default)
58 _GLIBCXX_BEGIN_NAMESPACE_VERSION
60 #if __glibcxx_spanstream
61 # define _GLIBCXX_STRSTREAM_DEPR(A, B) _GLIBCXX_DEPRECATED_SUGGEST(A "' or '" B)
63 # define _GLIBCXX_STRSTREAM_DEPR(A, B) _GLIBCXX_DEPRECATED_SUGGEST(A)
68 class strstreambuf :
public basic_streambuf<char, char_traits<char> >
72 typedef char_traits<char> _Traits;
73 typedef basic_streambuf<char, _Traits> _Base;
77 #if __cplusplus >= 201103L
78 strstreambuf() : strstreambuf(0) { }
79 explicit strstreambuf(
streamsize __initial_capacity);
81 explicit strstreambuf(
streamsize __initial_capacity = 0);
83 strstreambuf(
void* (*__alloc)(
size_t),
void (*__free)(
void*));
85 strstreambuf(
char* __get,
streamsize __n,
char* __put = 0) throw ();
86 strstreambuf(
signed char* __get,
streamsize __n,
signed char* __put = 0) throw ();
87 strstreambuf(
unsigned char* __get,
streamsize __n,
unsigned char* __put=0) throw ();
89 strstreambuf(const
char* __get,
streamsize __n) throw ();
90 strstreambuf(const
signed char* __get,
streamsize __n) throw ();
91 strstreambuf(const
unsigned char* __get,
streamsize __n) throw ();
93 virtual ~strstreambuf();
95 #if __cplusplus >= 201103L
96 strstreambuf(strstreambuf&& __rhs) noexcept
97 : _Base(__rhs), _M_alloc_fun(__rhs._M_alloc_fun),
98 _M_free_fun(__rhs._M_free_fun), _M_dynamic(__rhs._M_dynamic),
99 _M_frozen(__rhs._M_frozen), _M_constant(__rhs._M_constant)
101 __rhs.setg(
nullptr,
nullptr,
nullptr);
102 __rhs.setp(
nullptr,
nullptr);
106 operator=(strstreambuf&& __rhs) noexcept
108 if (_M_dynamic && !_M_frozen)
110 _Base::operator=(
static_cast<const _Base&
>(__rhs));
111 _M_alloc_fun = __rhs._M_alloc_fun;
112 _M_free_fun = __rhs._M_free_fun;
113 _M_dynamic = __rhs._M_dynamic;
114 _M_frozen = __rhs._M_frozen;
115 _M_constant = __rhs._M_constant;
116 __rhs.setg(
nullptr,
nullptr,
nullptr);
117 __rhs.setp(
nullptr,
nullptr);
123 void freeze(
bool =
true) throw ();
124 char* str() throw ();
125 _GLIBCXX_PURE
int pcount() const throw ();
128 virtual int_type overflow(int_type __c = _Traits::eof());
129 virtual int_type pbackfail(int_type __c = _Traits::eof());
130 virtual int_type underflow();
131 virtual _Base* setbuf(
char* __buf,
streamsize __n);
132 virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
133 ios_base::openmode __mode
134 = ios_base::in | ios_base::out);
135 virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode
136 = ios_base::in | ios_base::out);
139 #if __cplusplus < 201103L
141 operator=(
const strstreambuf&);
143 strstreambuf(
const strstreambuf&);
147 char* _M_alloc(
size_t);
151 void _M_setup(
char* __get,
char* __put,
streamsize __n)
throw ();
154 void* (*_M_alloc_fun)(size_t);
155 void (*_M_free_fun)(
void*);
159 bool _M_constant : 1;
160 } _GLIBCXX_STRSTREAM_DEPR(
"std::stringbuf",
"std::spanbuf");
162 #pragma GCC diagnostic push
163 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
166 class istrstream :
public basic_istream<char>
169 explicit istrstream(
char*);
170 explicit istrstream(
const char*);
173 virtual ~istrstream();
175 #if __cplusplus >= 201103L
176 istrstream(istrstream&& __rhs)
178 { set_rdbuf(&_M_buf); }
180 istrstream& operator=(istrstream&&) =
default;
183 _GLIBCXX_CONST strstreambuf*
rdbuf()
const throw ();
184 char* str() throw ();
191 class ostrstream : public basic_ostream<
char>
196 virtual ~ostrstream();
198 #if __cplusplus >= 201103L
199 ostrstream(ostrstream&& __rhs)
201 { set_rdbuf(&_M_buf); }
203 ostrstream& operator=(ostrstream&&) =
default;
206 _GLIBCXX_CONST strstreambuf*
rdbuf()
const throw ();
207 void freeze(
bool = true) throw();
208 char* str() throw ();
209 _GLIBCXX_PURE
int pcount() const throw ();
216 class strstream : public basic_iostream<
char>
219 typedef char char_type;
220 typedef char_traits<char>::int_type int_type;
221 typedef char_traits<char>::pos_type pos_type;
222 typedef char_traits<char>::off_type off_type;
226 virtual ~strstream();
228 #if __cplusplus >= 201103L
229 strstream(strstream&& __rhs)
231 { set_rdbuf(&_M_buf); }
233 strstream& operator=(strstream&&) =
default;
236 _GLIBCXX_CONST strstreambuf*
rdbuf()
const throw ();
237 void freeze(
bool = true) throw ();
238 _GLIBCXX_PURE
int pcount() const throw ();
239 char* str() throw ();
245 #undef _GLIBCXX_STRSTREAM_DEPR
246 #pragma GCC diagnostic pop
248 _GLIBCXX_END_NAMESPACE_VERSION
basic_stringstream< char > stringstream
Class for char mixed input and output memory streams.
basic_ostream< char > ostream
Base class for char output streams.
basic_iostream< char > iostream
Base class for char mixed input and output streams.
basic_istringstream< char > istringstream
Class for char input memory streams.
basic_istream< char > istream
Base class for char input streams.
basic_ostringstream< char > ostringstream
Class for char output memory streams.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
ISO C++ entities toplevel namespace is std.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
basic_streambuf< char, _Traits > * rdbuf(basic_streambuf< char, _Traits > *__sb)
Changing the underlying buffer.
char_type * eback() const
Access to the get area.
static const openmode in
Open for input. Default for ifstream and fstream.
static const openmode out
Open for output. Default for ofstream and fstream.
_Ios_Openmode openmode
This is a bitmask type.