comparison libcxx/include/strstream @ 221:79ff65ed7e25

LLVM12 Original
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 15 Jun 2021 19:15:29 +0900
parents 1d019706d866
children c4bab56944e8
comparison
equal deleted inserted replaced
220:42394fc6a535 221:79ff65ed7e25
15 15
16 class strstreambuf 16 class strstreambuf
17 : public basic_streambuf<char> 17 : public basic_streambuf<char>
18 { 18 {
19 public: 19 public:
20 explicit strstreambuf(streamsize alsize_arg = 0); 20 explicit strstreambuf(streamsize alsize_arg = 0); // before C++20
21 strstreambuf() : strstreambuf(0) {} // C++20
22 explicit strstreambuf(streamsize alsize_arg); // C++20
23
21 strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*)); 24 strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));
22 strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = 0); 25 strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = nullptr);
23 strstreambuf(const char* gnext_arg, streamsize n); 26 strstreambuf(const char* gnext_arg, streamsize n);
24 27
25 strstreambuf(signed char* gnext_arg, streamsize n, signed char* pbeg_arg = 0); 28 strstreambuf(signed char* gnext_arg, streamsize n, signed char* pbeg_arg = nullptr);
26 strstreambuf(const signed char* gnext_arg, streamsize n); 29 strstreambuf(const signed char* gnext_arg, streamsize n);
27 strstreambuf(unsigned char* gnext_arg, streamsize n, unsigned char* pbeg_arg = 0); 30 strstreambuf(unsigned char* gnext_arg, streamsize n, unsigned char* pbeg_arg = nullptr);
28 strstreambuf(const unsigned char* gnext_arg, streamsize n); 31 strstreambuf(const unsigned char* gnext_arg, streamsize n);
29 32
30 strstreambuf(strstreambuf&& rhs); 33 strstreambuf(strstreambuf&& rhs);
31 strstreambuf& operator=(strstreambuf&& rhs); 34 strstreambuf& operator=(strstreambuf&& rhs);
32 35
125 } // std 128 } // std
126 129
127 */ 130 */
128 131
129 #include <__config> 132 #include <__config>
133 #include <istream>
130 #include <ostream> 134 #include <ostream>
131 #include <istream>
132 135
133 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 136 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
134 #pragma GCC system_header 137 #pragma GCC system_header
135 #endif 138 #endif
136 139
138 141
139 class _LIBCPP_TYPE_VIS strstreambuf 142 class _LIBCPP_TYPE_VIS strstreambuf
140 : public streambuf 143 : public streambuf
141 { 144 {
142 public: 145 public:
146 #ifndef _LIBCPP_CXX03_LANG
147 strstreambuf() : strstreambuf(0) {}
148 explicit strstreambuf(streamsize __alsize);
149 #else
143 explicit strstreambuf(streamsize __alsize = 0); 150 explicit strstreambuf(streamsize __alsize = 0);
151 #endif
144 strstreambuf(void* (*__palloc)(size_t), void (*__pfree)(void*)); 152 strstreambuf(void* (*__palloc)(size_t), void (*__pfree)(void*));
145 strstreambuf(char* __gnext, streamsize __n, char* __pbeg = 0); 153 strstreambuf(char* __gnext, streamsize __n, char* __pbeg = nullptr);
146 strstreambuf(const char* __gnext, streamsize __n); 154 strstreambuf(const char* __gnext, streamsize __n);
147 155
148 strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg = 0); 156 strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg = nullptr);
149 strstreambuf(const signed char* __gnext, streamsize __n); 157 strstreambuf(const signed char* __gnext, streamsize __n);
150 strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = 0); 158 strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = nullptr);
151 strstreambuf(const unsigned char* __gnext, streamsize __n); 159 strstreambuf(const unsigned char* __gnext, streamsize __n);
152 160
153 #ifndef _LIBCPP_CXX03_LANG 161 #ifndef _LIBCPP_CXX03_LANG
154 _LIBCPP_INLINE_VISIBILITY 162 _LIBCPP_INLINE_VISIBILITY
155 strstreambuf(strstreambuf&& __rhs); 163 strstreambuf(strstreambuf&& __rhs);
156 _LIBCPP_INLINE_VISIBILITY 164 _LIBCPP_INLINE_VISIBILITY
157 strstreambuf& operator=(strstreambuf&& __rhs); 165 strstreambuf& operator=(strstreambuf&& __rhs);
158 #endif // _LIBCPP_CXX03_LANG 166 #endif // _LIBCPP_CXX03_LANG
159 167
160 virtual ~strstreambuf(); 168 virtual ~strstreambuf();
161 169
162 void swap(strstreambuf& __rhs); 170 void swap(strstreambuf& __rhs);
163 171
223 __rhs.setg(nullptr, nullptr, nullptr); 231 __rhs.setg(nullptr, nullptr, nullptr);
224 __rhs.setp(nullptr, nullptr); 232 __rhs.setp(nullptr, nullptr);
225 return *this; 233 return *this;
226 } 234 }
227 235
228 #endif // _LIBCPP_CXX03_LANG 236 #endif // _LIBCPP_CXX03_LANG
229 237
230 class _LIBCPP_TYPE_VIS istrstream 238 class _LIBCPP_TYPE_VIS istrstream
231 : public istream 239 : public istream
232 { 240 {
233 public: 241 public:
258 { 266 {
259 istream::operator=(_VSTD::move(__rhs)); 267 istream::operator=(_VSTD::move(__rhs));
260 __sb_ = _VSTD::move(__rhs.__sb_); 268 __sb_ = _VSTD::move(__rhs.__sb_);
261 return *this; 269 return *this;
262 } 270 }
263 #endif // _LIBCPP_CXX03_LANG 271 #endif // _LIBCPP_CXX03_LANG
264 272
265 virtual ~istrstream(); 273 virtual ~istrstream();
266 274
267 _LIBCPP_INLINE_VISIBILITY 275 _LIBCPP_INLINE_VISIBILITY
268 void swap(istrstream& __rhs) 276 void swap(istrstream& __rhs)
288 ostrstream() 296 ostrstream()
289 : ostream(&__sb_) {} 297 : ostream(&__sb_) {}
290 _LIBCPP_INLINE_VISIBILITY 298 _LIBCPP_INLINE_VISIBILITY
291 ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out) 299 ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out)
292 : ostream(&__sb_), 300 : ostream(&__sb_),
293 __sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0)) 301 __sb_(__s, __n, __s + (__mode & ios::app ? _VSTD::strlen(__s) : 0))
294 {} 302 {}
295 303
296 #ifndef _LIBCPP_CXX03_LANG 304 #ifndef _LIBCPP_CXX03_LANG
297 _LIBCPP_INLINE_VISIBILITY 305 _LIBCPP_INLINE_VISIBILITY
298 ostrstream(ostrstream&& __rhs) 306 ostrstream(ostrstream&& __rhs)
307 { 315 {
308 ostream::operator=(_VSTD::move(__rhs)); 316 ostream::operator=(_VSTD::move(__rhs));
309 __sb_ = _VSTD::move(__rhs.__sb_); 317 __sb_ = _VSTD::move(__rhs.__sb_);
310 return *this; 318 return *this;
311 } 319 }
312 #endif // _LIBCPP_CXX03_LANG 320 #endif // _LIBCPP_CXX03_LANG
313 321
314 virtual ~ostrstream(); 322 virtual ~ostrstream();
315 323
316 _LIBCPP_INLINE_VISIBILITY 324 _LIBCPP_INLINE_VISIBILITY
317 void swap(ostrstream& __rhs) 325 void swap(ostrstream& __rhs)
348 strstream() 356 strstream()
349 : iostream(&__sb_) {} 357 : iostream(&__sb_) {}
350 _LIBCPP_INLINE_VISIBILITY 358 _LIBCPP_INLINE_VISIBILITY
351 strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out) 359 strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out)
352 : iostream(&__sb_), 360 : iostream(&__sb_),
353 __sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0)) 361 __sb_(__s, __n, __s + (__mode & ios::app ? _VSTD::strlen(__s) : 0))
354 {} 362 {}
355 363
356 #ifndef _LIBCPP_CXX03_LANG 364 #ifndef _LIBCPP_CXX03_LANG
357 _LIBCPP_INLINE_VISIBILITY 365 _LIBCPP_INLINE_VISIBILITY
358 strstream(strstream&& __rhs) 366 strstream(strstream&& __rhs)
367 { 375 {
368 iostream::operator=(_VSTD::move(__rhs)); 376 iostream::operator=(_VSTD::move(__rhs));
369 __sb_ = _VSTD::move(__rhs.__sb_); 377 __sb_ = _VSTD::move(__rhs.__sb_);
370 return *this; 378 return *this;
371 } 379 }
372 #endif // _LIBCPP_CXX03_LANG 380 #endif // _LIBCPP_CXX03_LANG
373 381
374 virtual ~strstream(); 382 virtual ~strstream();
375 383
376 _LIBCPP_INLINE_VISIBILITY 384 _LIBCPP_INLINE_VISIBILITY
377 void swap(strstream& __rhs) 385 void swap(strstream& __rhs)
394 strstreambuf __sb_; // exposition only 402 strstreambuf __sb_; // exposition only
395 }; 403 };
396 404
397 _LIBCPP_END_NAMESPACE_STD 405 _LIBCPP_END_NAMESPACE_STD
398 406
399 #endif // _LIBCPP_STRSTREAM 407 #endif // _LIBCPP_STRSTREAM