| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | #ifndef _GLIBCXX_SSTREAM |
| 34 | #define _GLIBCXX_SSTREAM 1 |
| 35 | |
| 36 | #pragma GCC system_header |
| 37 | |
| 38 | #include <istream> |
| 39 | #include <ostream> |
| 40 | |
| 41 | namespace std _GLIBCXX_VISIBILITY(default) |
| 42 | { |
| 43 | _GLIBCXX_BEGIN_NAMESPACE_VERSION |
| 44 | _GLIBCXX_BEGIN_NAMESPACE_CXX11 |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | template<typename _CharT, typename _Traits, typename _Alloc> |
| 65 | class basic_stringbuf : public basic_streambuf<_CharT, _Traits> |
| 66 | { |
| 67 | struct __xfer_bufptrs; |
| 68 | public: |
| 69 | |
| 70 | typedef _CharT char_type; |
| 71 | typedef _Traits traits_type; |
| 72 | |
| 73 | |
| 74 | typedef _Alloc allocator_type; |
| 75 | typedef typename traits_type::int_type int_type; |
| 76 | typedef typename traits_type::pos_type pos_type; |
| 77 | typedef typename traits_type::off_type off_type; |
| 78 | |
| 79 | typedef basic_streambuf<char_type, traits_type> __streambuf_type; |
| 80 | typedef basic_string<char_type, _Traits, _Alloc> __string_type; |
| 81 | typedef typename __string_type::size_type __size_type; |
| 82 | |
| 83 | protected: |
| 84 | |
| 85 | ios_base::openmode _M_mode; |
| 86 | |
| 87 | |
| 88 | __string_type _M_string; |
| 89 | |
| 90 | public: |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | explicit |
| 100 | basic_stringbuf(ios_base::openmode __mode = ios_base::in | ios_base::out) |
| 101 | : __streambuf_type(), _M_mode(__mode), _M_string() |
| 102 | { } |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | explicit |
| 113 | basic_stringbuf(const __string_type& __str, |
| 114 | ios_base::openmode __mode = ios_base::in | ios_base::out) |
| 115 | : __streambuf_type(), _M_mode(), _M_string(__str.data(), __str.size()) |
| 116 | { _M_stringbuf_init(__mode); } |
| 117 | |
| 118 | #if __cplusplus >= 201103L |
| 119 | basic_stringbuf(const basic_stringbuf&) = delete; |
| 120 | |
| 121 | basic_stringbuf(basic_stringbuf&& __rhs) |
| 122 | : basic_stringbuf(std::move(__rhs), __xfer_bufptrs(__rhs, this)) |
| 123 | { __rhs._M_sync(const_cast<char_type*>(__rhs._M_string.data()), 0, 0); } |
| 124 | |
| 125 | |
| 126 | |
| 127 | basic_stringbuf& |
| 128 | operator=(const basic_stringbuf&) = delete; |
| 129 | |
| 130 | basic_stringbuf& |
| 131 | operator=(basic_stringbuf&& __rhs) |
| 132 | { |
| 133 | __xfer_bufptrs __st{__rhs, this}; |
| 134 | const __streambuf_type& __base = __rhs; |
| 135 | __streambuf_type::operator=(__base); |
| 136 | this->pubimbue(__rhs.getloc()); |
| 137 | _M_mode = __rhs._M_mode; |
| 138 | _M_string = std::move(__rhs._M_string); |
| 139 | __rhs._M_sync(const_cast<char_type*>(__rhs._M_string.data()), 0, 0); |
| 140 | return *this; |
| 141 | } |
| 142 | |
| 143 | void |
| 144 | swap(basic_stringbuf& __rhs) |
| 145 | { |
| 146 | __xfer_bufptrs __l_st{*this, std::__addressof(__rhs)}; |
| 147 | __xfer_bufptrs __r_st{__rhs, this}; |
| 148 | __streambuf_type& __base = __rhs; |
| 149 | __streambuf_type::swap(__base); |
| 150 | __rhs.pubimbue(this->pubimbue(__rhs.getloc())); |
| 151 | std::swap(_M_mode, __rhs._M_mode); |
| 152 | std::swap(_M_string, __rhs._M_string); |
| 153 | } |
| 154 | #endif |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | __string_type |
| 166 | str() const |
| 167 | { |
| 168 | __string_type __ret; |
| 169 | if (this->pptr()) |
| 170 | { |
| 171 | |
| 172 | if (this->pptr() > this->egptr()) |
| 173 | __ret = __string_type(this->pbase(), this->pptr()); |
| 174 | else |
| 175 | __ret = __string_type(this->pbase(), this->egptr()); |
| 176 | } |
| 177 | else |
| 178 | __ret = _M_string; |
| 179 | return __ret; |
| 180 | } |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | void |
| 190 | str(const __string_type& __s) |
| 191 | { |
| 192 | |
| 193 | |
| 194 | _M_string.assign(__s.data(), __s.size()); |
| 195 | _M_stringbuf_init(_M_mode); |
| 196 | } |
| 197 | |
| 198 | protected: |
| 199 | |
| 200 | void |
| 201 | _M_stringbuf_init(ios_base::openmode __mode) |
| 202 | { |
| 203 | _M_mode = __mode; |
| 204 | __size_type __len = 0; |
| 205 | if (_M_mode & (ios_base::ate | ios_base::app)) |
| 206 | __len = _M_string.size(); |
| 207 | _M_sync(const_cast<char_type*>(_M_string.data()), 0, __len); |
| 208 | } |
| 209 | |
| 210 | virtual streamsize |
| 211 | showmanyc() |
| 212 | { |
| 213 | streamsize __ret = -1; |
| 214 | if (_M_mode & ios_base::in) |
| 215 | { |
| 216 | _M_update_egptr(); |
| 217 | __ret = this->egptr() - this->gptr(); |
| 218 | } |
| 219 | return __ret; |
| 220 | } |
| 221 | |
| 222 | virtual int_type |
| 223 | underflow(); |
| 224 | |
| 225 | virtual int_type |
| 226 | pbackfail(int_type __c = traits_type::eof()); |
| 227 | |
| 228 | virtual int_type |
| 229 | overflow(int_type __c = traits_type::eof()); |
| 230 | |
| 231 | |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | |
| 238 | |
| 239 | |
| 240 | |
| 241 | |
| 242 | virtual __streambuf_type* |
| 243 | setbuf(char_type* __s, streamsize __n) |
| 244 | { |
| 245 | if (__s && __n >= 0) |
| 246 | { |
| 247 | |
| 248 | |
| 249 | |
| 250 | |
| 251 | |
| 252 | |
| 253 | _M_string.clear(); |
| 254 | |
| 255 | |
| 256 | _M_sync(__s, __n, 0); |
| 257 | } |
| 258 | return this; |
| 259 | } |
| 260 | |
| 261 | virtual pos_type |
| 262 | seekoff(off_type __off, ios_base::seekdir __way, |
| 263 | ios_base::openmode __mode = ios_base::in | ios_base::out); |
| 264 | |
| 265 | virtual pos_type |
| 266 | seekpos(pos_type __sp, |
| 267 | ios_base::openmode __mode = ios_base::in | ios_base::out); |
| 268 | |
| 269 | |
| 270 | |
| 271 | |
| 272 | void |
| 273 | _M_sync(char_type* __base, __size_type __i, __size_type __o); |
| 274 | |
| 275 | |
| 276 | |
| 277 | void |
| 278 | _M_update_egptr() |
| 279 | { |
| 280 | const bool __testin = _M_mode & ios_base::in; |
| 281 | if (this->pptr() && this->pptr() > this->egptr()) |
| 282 | { |
| 283 | if (__testin) |
| 284 | this->setg(this->eback(), this->gptr(), this->pptr()); |
| 285 | else |
| 286 | this->setg(this->pptr(), this->pptr(), this->pptr()); |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | |
| 291 | |
| 292 | void |
| 293 | _M_pbump(char_type* __pbeg, char_type* __pend, off_type __off); |
| 294 | |
| 295 | private: |
| 296 | #if __cplusplus >= 201103L |
| 297 | #if _GLIBCXX_USE_CXX11_ABI |
| 298 | |
| 299 | |
| 300 | struct __xfer_bufptrs |
| 301 | { |
| 302 | __xfer_bufptrs(const basic_stringbuf& __from, basic_stringbuf* __to) |
| 303 | : _M_to{__to}, _M_goff{-1, -1, -1}, _M_poff{-1, -1, -1} |
| 304 | { |
| 305 | const _CharT* const __str = __from._M_string.data(); |
| 306 | const _CharT* __end = nullptr; |
| 307 | if (__from.eback()) |
| 308 | { |
| 309 | _M_goff[0] = __from.eback() - __str; |
| 310 | _M_goff[1] = __from.gptr() - __str; |
| 311 | _M_goff[2] = __from.egptr() - __str; |
| 312 | __end = __from.egptr(); |
| 313 | } |
| 314 | if (__from.pbase()) |
| 315 | { |
| 316 | _M_poff[0] = __from.pbase() - __str; |
| 317 | _M_poff[1] = __from.pptr() - __from.pbase(); |
| 318 | _M_poff[2] = __from.epptr() - __str; |
| 319 | if (__from.pptr() > __end) |
| 320 | __end = __from.pptr(); |
| 321 | } |
| 322 | |
| 323 | |
| 324 | if (__end) |
| 325 | { |
| 326 | |
| 327 | |
| 328 | auto& __mut_from = const_cast<basic_stringbuf&>(__from); |
| 329 | __mut_from._M_string._M_length(__end - __str); |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | ~__xfer_bufptrs() |
| 334 | { |
| 335 | char_type* __str = const_cast<char_type*>(_M_to->_M_string.data()); |
| 336 | if (_M_goff[0] != -1) |
| 337 | _M_to->setg(__str+_M_goff[0], __str+_M_goff[1], __str+_M_goff[2]); |
| 338 | if (_M_poff[0] != -1) |
| 339 | _M_to->_M_pbump(__str+_M_poff[0], __str+_M_poff[2], _M_poff[1]); |
| 340 | } |
| 341 | |
| 342 | basic_stringbuf* _M_to; |
| 343 | off_type _M_goff[3]; |
| 344 | off_type _M_poff[3]; |
| 345 | }; |
| 346 | #else |
| 347 | |
| 348 | struct __xfer_bufptrs |
| 349 | { |
| 350 | __xfer_bufptrs(const basic_stringbuf&, basic_stringbuf*) { } |
| 351 | }; |
| 352 | #endif |
| 353 | |
| 354 | |
| 355 | |
| 356 | basic_stringbuf(basic_stringbuf&& __rhs, __xfer_bufptrs&&) |
| 357 | : __streambuf_type(static_cast<const __streambuf_type&>(__rhs)), |
| 358 | _M_mode(__rhs._M_mode), _M_string(std::move(__rhs._M_string)) |
| 359 | { } |
| 360 | #endif |
| 361 | }; |
| 362 | |
| 363 | |
| 364 | |
| 365 | |
| 366 | |
| 367 | |
| 368 | |
| 369 | |
| 370 | |
| 371 | |
| 372 | |
| 373 | |
| 374 | |
| 375 | |
| 376 | |
| 377 | |
| 378 | |
| 379 | template<typename _CharT, typename _Traits, typename _Alloc> |
| 380 | class basic_istringstream : public basic_istream<_CharT, _Traits> |
| 381 | { |
| 382 | public: |
| 383 | |
| 384 | typedef _CharT char_type; |
| 385 | typedef _Traits traits_type; |
| 386 | |
| 387 | |
| 388 | typedef _Alloc allocator_type; |
| 389 | typedef typename traits_type::int_type int_type; |
| 390 | typedef typename traits_type::pos_type pos_type; |
| 391 | typedef typename traits_type::off_type off_type; |
| 392 | |
| 393 | |
| 394 | typedef basic_string<_CharT, _Traits, _Alloc> __string_type; |
| 395 | typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type; |
| 396 | typedef basic_istream<char_type, traits_type> __istream_type; |
| 397 | |
| 398 | private: |
| 399 | __stringbuf_type _M_stringbuf; |
| 400 | |
| 401 | public: |
| 402 | |
| 403 | |
| 404 | |
| 405 | |
| 406 | |
| 407 | |
| 408 | |
| 409 | |
| 410 | |
| 411 | |
| 412 | |
| 413 | |
| 414 | |
| 415 | explicit |
| 416 | basic_istringstream(ios_base::openmode __mode = ios_base::in) |
| 417 | : __istream_type(), _M_stringbuf(__mode | ios_base::in) |
| 418 | { this->init(&_M_stringbuf); } |
| 419 | |
| 420 | |
| 421 | |
| 422 | |
| 423 | |
| 424 | |
| 425 | |
| 426 | |
| 427 | |
| 428 | |
| 429 | |
| 430 | |
| 431 | |
| 432 | |
| 433 | explicit |
| 434 | basic_istringstream(const __string_type& __str, |
| 435 | ios_base::openmode __mode = ios_base::in) |
| 436 | : __istream_type(), _M_stringbuf(__str, __mode | ios_base::in) |
| 437 | { this->init(&_M_stringbuf); } |
| 438 | |
| 439 | |
| 440 | |
| 441 | |
| 442 | |
| 443 | |
| 444 | |
| 445 | ~basic_istringstream() |
| 446 | { } |
| 447 | |
| 448 | #if __cplusplus >= 201103L |
| 449 | basic_istringstream(const basic_istringstream&) = delete; |
| 450 | |
| 451 | basic_istringstream(basic_istringstream&& __rhs) |
| 452 | : __istream_type(std::move(__rhs)), |
| 453 | _M_stringbuf(std::move(__rhs._M_stringbuf)) |
| 454 | { __istream_type::set_rdbuf(&_M_stringbuf); } |
| 455 | |
| 456 | |
| 457 | |
| 458 | basic_istringstream& |
| 459 | operator=(const basic_istringstream&) = delete; |
| 460 | |
| 461 | basic_istringstream& |
| 462 | operator=(basic_istringstream&& __rhs) |
| 463 | { |
| 464 | __istream_type::operator=(std::move(__rhs)); |
| 465 | _M_stringbuf = std::move(__rhs._M_stringbuf); |
| 466 | return *this; |
| 467 | } |
| 468 | |
| 469 | void |
| 470 | swap(basic_istringstream& __rhs) |
| 471 | { |
| 472 | __istream_type::swap(__rhs); |
| 473 | _M_stringbuf.swap(__rhs._M_stringbuf); |
| 474 | } |
| 475 | #endif |
| 476 | |
| 477 | |
| 478 | |
| 479 | |
| 480 | |
| 481 | |
| 482 | |
| 483 | |
| 484 | __stringbuf_type* |
| 485 | rdbuf() const |
| 486 | { return const_cast<__stringbuf_type*>(&_M_stringbuf); } |
| 487 | |
| 488 | |
| 489 | |
| 490 | |
| 491 | |
| 492 | __string_type |
| 493 | str() const |
| 494 | { return _M_stringbuf.str(); } |
| 495 | |
| 496 | |
| 497 | |
| 498 | |
| 499 | |
| 500 | |
| 501 | |
| 502 | void |
| 503 | str(const __string_type& __s) |
| 504 | { _M_stringbuf.str(__s); } |
| 505 | }; |
| 506 | |
| 507 | |
| 508 | |
| 509 | |
| 510 | |
| 511 | |
| 512 | |
| 513 | |
| 514 | |
| 515 | |
| 516 | |
| 517 | |
| 518 | |
| 519 | |
| 520 | |
| 521 | |
| 522 | |
| 523 | template <typename _CharT, typename _Traits, typename _Alloc> |
| 524 | class basic_ostringstream : public basic_ostream<_CharT, _Traits> |
| 525 | { |
| 526 | public: |
| 527 | |
| 528 | typedef _CharT char_type; |
| 529 | typedef _Traits traits_type; |
| 530 | |
| 531 | |
| 532 | typedef _Alloc allocator_type; |
| 533 | typedef typename traits_type::int_type int_type; |
| 534 | typedef typename traits_type::pos_type pos_type; |
| 535 | typedef typename traits_type::off_type off_type; |
| 536 | |
| 537 | |
| 538 | typedef basic_string<_CharT, _Traits, _Alloc> __string_type; |
| 539 | typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type; |
| 540 | typedef basic_ostream<char_type, traits_type> __ostream_type; |
| 541 | |
| 542 | private: |
| 543 | __stringbuf_type _M_stringbuf; |
| 544 | |
| 545 | public: |
| 546 | |
| 547 | |
| 548 | |
| 549 | |
| 550 | |
| 551 | |
| 552 | |
| 553 | |
| 554 | |
| 555 | |
| 556 | |
| 557 | |
| 558 | |
| 559 | explicit |
| 560 | basic_ostringstream(ios_base::openmode __mode = ios_base::out) |
| 561 | : __ostream_type(), _M_stringbuf(__mode | ios_base::out) |
| 562 | { this->init(&_M_stringbuf); } |
| 563 | |
| 564 | |
| 565 | |
| 566 | |
| 567 | |
| 568 | |
| 569 | |
| 570 | |
| 571 | |
| 572 | |
| 573 | |
| 574 | |
| 575 | |
| 576 | |
| 577 | explicit |
| 578 | basic_ostringstream(const __string_type& __str, |
| 579 | ios_base::openmode __mode = ios_base::out) |
| 580 | : __ostream_type(), _M_stringbuf(__str, __mode | ios_base::out) |
| 581 | { this->init(&_M_stringbuf); } |
| 582 | |
| 583 | |
| 584 | |
| 585 | |
| 586 | |
| 587 | |
| 588 | |
| 589 | ~basic_ostringstream() |
| 590 | { } |
| 591 | |
| 592 | #if __cplusplus >= 201103L |
| 593 | basic_ostringstream(const basic_ostringstream&) = delete; |
| 594 | |
| 595 | basic_ostringstream(basic_ostringstream&& __rhs) |
| 596 | : __ostream_type(std::move(__rhs)), |
| 597 | _M_stringbuf(std::move(__rhs._M_stringbuf)) |
| 598 | { __ostream_type::set_rdbuf(&_M_stringbuf); } |
| 599 | |
| 600 | |
| 601 | |
| 602 | basic_ostringstream& |
| 603 | operator=(const basic_ostringstream&) = delete; |
| 604 | |
| 605 | basic_ostringstream& |
| 606 | operator=(basic_ostringstream&& __rhs) |
| 607 | { |
| 608 | __ostream_type::operator=(std::move(__rhs)); |
| 609 | _M_stringbuf = std::move(__rhs._M_stringbuf); |
| 610 | return *this; |
| 611 | } |
| 612 | |
| 613 | void |
| 614 | swap(basic_ostringstream& __rhs) |
| 615 | { |
| 616 | __ostream_type::swap(__rhs); |
| 617 | _M_stringbuf.swap(__rhs._M_stringbuf); |
| 618 | } |
| 619 | #endif |
| 620 | |
| 621 | |
| 622 | |
| 623 | |
| 624 | |
| 625 | |
| 626 | |
| 627 | |
| 628 | __stringbuf_type* |
| 629 | rdbuf() const |
| 630 | { return const_cast<__stringbuf_type*>(&_M_stringbuf); } |
| 631 | |
| 632 | |
| 633 | |
| 634 | |
| 635 | |
| 636 | __string_type |
| 637 | str() const |
| 638 | { return _M_stringbuf.str(); } |
| 639 | |
| 640 | |
| 641 | |
| 642 | |
| 643 | |
| 644 | |
| 645 | |
| 646 | void |
| 647 | str(const __string_type& __s) |
| 648 | { _M_stringbuf.str(__s); } |
| 649 | }; |
| 650 | |
| 651 | |
| 652 | |
| 653 | |
| 654 | |
| 655 | |
| 656 | |
| 657 | |
| 658 | |
| 659 | |
| 660 | |
| 661 | |
| 662 | |
| 663 | |
| 664 | |
| 665 | |
| 666 | |
| 667 | template <typename _CharT, typename _Traits, typename _Alloc> |
| 668 | class basic_stringstream : public basic_iostream<_CharT, _Traits> |
| 669 | { |
| 670 | public: |
| 671 | |
| 672 | typedef _CharT char_type; |
| 673 | typedef _Traits traits_type; |
| 674 | |
| 675 | |
| 676 | typedef _Alloc allocator_type; |
| 677 | typedef typename traits_type::int_type int_type; |
| 678 | typedef typename traits_type::pos_type pos_type; |
| 679 | typedef typename traits_type::off_type off_type; |
| 680 | |
| 681 | |
| 682 | typedef basic_string<_CharT, _Traits, _Alloc> __string_type; |
| 683 | typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type; |
| 684 | typedef basic_iostream<char_type, traits_type> __iostream_type; |
| 685 | |
| 686 | private: |
| 687 | __stringbuf_type _M_stringbuf; |
| 688 | |
| 689 | public: |
| 690 | |
| 691 | |
| 692 | |
| 693 | |
| 694 | |
| 695 | |
| 696 | |
| 697 | |
| 698 | |
| 699 | |
| 700 | |
| 701 | |
| 702 | explicit |
| 703 | basic_stringstream(ios_base::openmode __m = ios_base::out | ios_base::in) |
| 704 | : __iostream_type(), _M_stringbuf(__m) |
| 705 | { this->init(&_M_stringbuf); } |
| 706 | |
| 707 | |
| 708 | |
| 709 | |
| 710 | |
| 711 | |
| 712 | |
| 713 | |
| 714 | |
| 715 | |
| 716 | |
| 717 | |
| 718 | explicit |
| 719 | basic_stringstream(const __string_type& __str, |
| 720 | ios_base::openmode __m = ios_base::out | ios_base::in) |
| 721 | : __iostream_type(), _M_stringbuf(__str, __m) |
| 722 | { this->init(&_M_stringbuf); } |
| 723 | |
| 724 | |
| 725 | |
| 726 | |
| 727 | |
| 728 | |
| 729 | |
| 730 | ~basic_stringstream() |
| 731 | { } |
| 732 | |
| 733 | #if __cplusplus >= 201103L |
| 734 | basic_stringstream(const basic_stringstream&) = delete; |
| 735 | |
| 736 | basic_stringstream(basic_stringstream&& __rhs) |
| 737 | : __iostream_type(std::move(__rhs)), |
| 738 | _M_stringbuf(std::move(__rhs._M_stringbuf)) |
| 739 | { __iostream_type::set_rdbuf(&_M_stringbuf); } |
| 740 | |
| 741 | |
| 742 | |
| 743 | basic_stringstream& |
| 744 | operator=(const basic_stringstream&) = delete; |
| 745 | |
| 746 | basic_stringstream& |
| 747 | operator=(basic_stringstream&& __rhs) |
| 748 | { |
| 749 | __iostream_type::operator=(std::move(__rhs)); |
| 750 | _M_stringbuf = std::move(__rhs._M_stringbuf); |
| 751 | return *this; |
| 752 | } |
| 753 | |
| 754 | void |
| 755 | swap(basic_stringstream& __rhs) |
| 756 | { |
| 757 | __iostream_type::swap(__rhs); |
| 758 | _M_stringbuf.swap(__rhs._M_stringbuf); |
| 759 | } |
| 760 | #endif |
| 761 | |
| 762 | |
| 763 | |
| 764 | |
| 765 | |
| 766 | |
| 767 | |
| 768 | |
| 769 | __stringbuf_type* |
| 770 | rdbuf() const |
| 771 | { return const_cast<__stringbuf_type*>(&_M_stringbuf); } |
| 772 | |
| 773 | |
| 774 | |
| 775 | |
| 776 | |
| 777 | __string_type |
| 778 | str() const |
| 779 | { return _M_stringbuf.str(); } |
| 780 | |
| 781 | |
| 782 | |
| 783 | |
| 784 | |
| 785 | |
| 786 | |
| 787 | void |
| 788 | str(const __string_type& __s) |
| 789 | { _M_stringbuf.str(__s); } |
| 790 | }; |
| 791 | |
| 792 | #if __cplusplus >= 201103L |
| 793 | |
| 794 | template <class _CharT, class _Traits, class _Allocator> |
| 795 | inline void |
| 796 | swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x, |
| 797 | basic_stringbuf<_CharT, _Traits, _Allocator>& __y) |
| 798 | { __x.swap(__y); } |
| 799 | |
| 800 | |
| 801 | template <class _CharT, class _Traits, class _Allocator> |
| 802 | inline void |
| 803 | swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x, |
| 804 | basic_istringstream<_CharT, _Traits, _Allocator>& __y) |
| 805 | { __x.swap(__y); } |
| 806 | |
| 807 | |
| 808 | template <class _CharT, class _Traits, class _Allocator> |
| 809 | inline void |
| 810 | swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x, |
| 811 | basic_ostringstream<_CharT, _Traits, _Allocator>& __y) |
| 812 | { __x.swap(__y); } |
| 813 | |
| 814 | |
| 815 | template <class _CharT, class _Traits, class _Allocator> |
| 816 | inline void |
| 817 | swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x, |
| 818 | basic_stringstream<_CharT, _Traits, _Allocator>& __y) |
| 819 | { __x.swap(__y); } |
| 820 | #endif |
| 821 | |
| 822 | _GLIBCXX_END_NAMESPACE_CXX11 |
| 823 | _GLIBCXX_END_NAMESPACE_VERSION |
| 824 | } |
| 825 | |
| 826 | #include <bits/sstream.tcc> |
| 827 | |
| 828 | #endif |
| 829 | |