aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include/sstream
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/include/sstream')
-rw-r--r--libcxx/include/sstream87
1 files changed, 48 insertions, 39 deletions
diff --git a/libcxx/include/sstream b/libcxx/include/sstream
index 602a1b55b4a9..78cc28a50282 100644
--- a/libcxx/include/sstream
+++ b/libcxx/include/sstream
@@ -11,8 +11,9 @@
#define _LIBCPP_SSTREAM
/*
- sstream synopsis
+ sstream synopsis [sstream.syn]
+// Class template basic_stringbuf [stringbuf]
template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
class basic_stringbuf
: public basic_streambuf<charT, traits>
@@ -25,7 +26,7 @@ public:
typedef typename traits_type::off_type off_type;
typedef Allocator allocator_type;
- // 27.8.1.1 [stringbuf.cons], constructors:
+ // [stringbuf.cons] constructors:
explicit basic_stringbuf(ios_base::openmode which = ios_base::in | ios_base::out); // before C++20
basic_stringbuf() : basic_stringbuf(ios_base::in | ios_base::out) {} // C++20
explicit basic_stringbuf(ios_base::openmode which); // C++20
@@ -33,16 +34,16 @@ public:
ios_base::openmode which = ios_base::in | ios_base::out);
basic_stringbuf(basic_stringbuf&& rhs);
- // 27.8.1.2 Assign and swap:
+ // [stringbuf.assign] Assign and swap:
basic_stringbuf& operator=(basic_stringbuf&& rhs);
void swap(basic_stringbuf& rhs);
- // 27.8.1.3 Get and set:
+ // [stringbuf.members] Member functions:
basic_string<char_type, traits_type, allocator_type> str() const;
void str(const basic_string<char_type, traits_type, allocator_type>& s);
protected:
- // 27.8.1.4 Overridden virtual functions:
+ // [stringbuf.virtuals] Overridden virtual functions:
virtual int_type underflow();
virtual int_type pbackfail(int_type c = traits_type::eof());
virtual int_type overflow (int_type c = traits_type::eof());
@@ -53,6 +54,7 @@ protected:
ios_base::openmode which = ios_base::in | ios_base::out);
};
+// [stringbuf.assign] non member swap
template <class charT, class traits, class Allocator>
void swap(basic_stringbuf<charT, traits, Allocator>& x,
basic_stringbuf<charT, traits, Allocator>& y);
@@ -60,6 +62,7 @@ template <class charT, class traits, class Allocator>
typedef basic_stringbuf<char> stringbuf;
typedef basic_stringbuf<wchar_t> wstringbuf;
+// Class template basic_istringstream [istringstream]
template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
class basic_istringstream
: public basic_istream<charT, traits>
@@ -72,7 +75,7 @@ public:
typedef typename traits_type::off_type off_type;
typedef Allocator allocator_type;
- // 27.8.2.1 Constructors:
+ // [istringstream.cons] Constructors:
explicit basic_istringstream(ios_base::openmode which = ios_base::in); // before C++20
basic_istringstream() : basic_istringstream(ios_base::in) {} // C++20
explicit basic_istringstream(ios_base::openmode which); // C++20
@@ -81,11 +84,11 @@ public:
ios_base::openmode which = ios_base::in);
basic_istringstream(basic_istringstream&& rhs);
- // 27.8.2.2 Assign and swap:
+ // [istringstream.assign] Assign and swap:
basic_istringstream& operator=(basic_istringstream&& rhs);
void swap(basic_istringstream& rhs);
- // 27.8.2.3 Members:
+ // [istringstream.members] Member functions:
basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const;
basic_string<char_type, traits_type, allocator_type> str() const;
void str(const basic_string<char_type, traits_type, allocator_type>& s);
@@ -98,6 +101,7 @@ template <class charT, class traits, class Allocator>
typedef basic_istringstream<char> istringstream;
typedef basic_istringstream<wchar_t> wistringstream;
+// Class template basic_ostringstream [ostringstream]
template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
class basic_ostringstream
: public basic_ostream<charT, traits>
@@ -111,7 +115,7 @@ public:
typedef typename traits_type::off_type off_type;
typedef Allocator allocator_type;
- // 27.8.3.1 Constructors/destructor:
+ // [ostringstream.cons] Constructors:
explicit basic_ostringstream(ios_base::openmode which = ios_base::out); // before C++20
basic_ostringstream() : basic_ostringstream(ios_base::out) {} // C++20
explicit basic_ostringstream(ios_base::openmode which); // C++20
@@ -120,11 +124,11 @@ public:
ios_base::openmode which = ios_base::out);
basic_ostringstream(basic_ostringstream&& rhs);
- // 27.8.3.2 Assign/swap:
+ // [ostringstream.assign] Assign and swap:
basic_ostringstream& operator=(basic_ostringstream&& rhs);
void swap(basic_ostringstream& rhs);
- // 27.8.3.3 Members:
+ // [ostringstream.members] Member functions:
basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const;
basic_string<char_type, traits_type, allocator_type> str() const;
void str(const basic_string<char_type, traits_type, allocator_type>& s);
@@ -137,6 +141,7 @@ template <class charT, class traits, class Allocator>
typedef basic_ostringstream<char> ostringstream;
typedef basic_ostringstream<wchar_t> wostringstream;
+// Class template basic_stringstream [stringstream]
template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
class basic_stringstream
: public basic_iostream<charT, traits>
@@ -150,7 +155,7 @@ public:
typedef typename traits_type::off_type off_type;
typedef Allocator allocator_type;
- // constructors/destructor
+ // [stringstream.cons] constructors
explicit basic_stringstream(ios_base::openmode which = ios_base::out | ios_base::in); // before C++20
basic_stringstream() : basic_stringstream(ios_base::out | ios_base::in) {} // C++20
explicit basic_stringstream(ios_base::openmode which); // C++20
@@ -159,11 +164,11 @@ public:
ios_base::openmode which = ios_base::out|ios_base::in);
basic_stringstream(basic_stringstream&& rhs);
- // 27.8.5.1 Assign/swap:
+ // [stringstream.assign] Assign and swap:
basic_stringstream& operator=(basic_stringstream&& rhs);
void swap(basic_stringstream& rhs);
- // Members:
+ // [stringstream.members] Member functions:
basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const;
basic_string<char_type, traits_type, allocator_type> str() const;
void str(const basic_string<char_type, traits_type, allocator_type>& str);
@@ -198,7 +203,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-// basic_stringbuf
+// Class template basic_stringbuf [stringbuf]
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_TEMPLATE_VIS basic_stringbuf
@@ -221,7 +226,7 @@ private:
ios_base::openmode __mode_;
public:
- // 30.8.2.1 [stringbuf.cons], constructors
+ // [stringbuf.cons] constructors:
_LIBCPP_INLINE_VISIBILITY
basic_stringbuf()
: __hm_(nullptr), __mode_(ios_base::in | ios_base::out) {}
@@ -240,24 +245,24 @@ public:
basic_stringbuf(basic_stringbuf&& __rhs);
- // 27.8.1.2 Assign and swap:
+ // [stringbuf.assign] Assign and swap:
basic_stringbuf& operator=(basic_stringbuf&& __rhs);
void swap(basic_stringbuf& __rhs);
- // 27.8.1.3 Get and set:
+ // [stringbuf.members] Member functions:
string_type str() const;
void str(const string_type& __s);
protected:
- // 27.8.1.4 Overridden virtual functions:
- virtual int_type underflow();
- virtual int_type pbackfail(int_type __c = traits_type::eof());
- virtual int_type overflow (int_type __c = traits_type::eof());
- virtual pos_type seekoff(off_type __off, ios_base::seekdir __way,
- ios_base::openmode __wch = ios_base::in | ios_base::out);
- _LIBCPP_INLINE_VISIBILITY
- virtual pos_type seekpos(pos_type __sp,
- ios_base::openmode __wch = ios_base::in | ios_base::out) {
+ // [stringbuf.virtuals] Overridden virtual functions:
+ int_type underflow() override;
+ int_type pbackfail(int_type __c = traits_type::eof()) override;
+ int_type overflow (int_type __c = traits_type::eof()) override;
+ pos_type seekoff(off_type __off, ios_base::seekdir __way,
+ ios_base::openmode __wch = ios_base::in | ios_base::out) override;
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL
+ pos_type seekpos(pos_type __sp,
+ ios_base::openmode __wch = ios_base::in | ios_base::out) override {
return seekoff(__sp, ios_base::beg, __wch);
}
};
@@ -619,7 +624,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off,
return pos_type(__noff);
}
-// basic_istringstream
+// Class template basic_istringstream [istringstream]
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_TEMPLATE_VIS basic_istringstream
@@ -639,7 +644,7 @@ private:
basic_stringbuf<char_type, traits_type, allocator_type> __sb_;
public:
- // 30.8.3.1 [istringstream.cons], constructors
+ // [istringstream.cons] Constructors:
_LIBCPP_INLINE_VISIBILITY
basic_istringstream()
: basic_istream<_CharT, _Traits>(&__sb_), __sb_(ios_base::in) {}
@@ -663,7 +668,7 @@ public:
basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
}
- // 27.8.2.2 Assign and swap:
+ // [istringstream.assign] Assign and swap:
basic_istringstream& operator=(basic_istringstream&& __rhs) {
basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
@@ -675,7 +680,7 @@ public:
__sb_.swap(__rhs.__sb_);
}
- // 27.8.2.3 Members:
+ // [istringstream.members] Member functions:
_LIBCPP_INLINE_VISIBILITY
basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
@@ -699,7 +704,7 @@ swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
__x.swap(__y);
}
-// basic_ostringstream
+// Class template basic_ostringstream [ostringstream]
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_TEMPLATE_VIS basic_ostringstream
@@ -719,7 +724,7 @@ private:
basic_stringbuf<char_type, traits_type, allocator_type> __sb_;
public:
- // 30.8.4.1 [ostringstream.cons], constructors
+ // [ostringstream.cons] Constructors:
_LIBCPP_INLINE_VISIBILITY
basic_ostringstream()
: basic_ostream<_CharT, _Traits>(&__sb_), __sb_(ios_base::out) {}
@@ -743,7 +748,7 @@ public:
basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_);
}
- // 27.8.2.2 Assign and swap:
+ // [ostringstream.assign] Assign and swap:
basic_ostringstream& operator=(basic_ostringstream&& __rhs) {
basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
@@ -756,7 +761,7 @@ public:
__sb_.swap(__rhs.__sb_);
}
- // 27.8.2.3 Members:
+ // [ostringstream.members] Member functions:
_LIBCPP_INLINE_VISIBILITY
basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
@@ -780,7 +785,7 @@ swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
__x.swap(__y);
}
-// basic_stringstream
+// Class template basic_stringstream [stringstream]
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_TEMPLATE_VIS basic_stringstream
@@ -800,7 +805,7 @@ private:
basic_stringbuf<char_type, traits_type, allocator_type> __sb_;
public:
- // 30.8.5.1 [stringstream.cons], constructors
+ // [stringstream.cons] constructors
_LIBCPP_INLINE_VISIBILITY
basic_stringstream()
: basic_iostream<_CharT, _Traits>(&__sb_), __sb_(ios_base::in | ios_base::out) {}
@@ -824,7 +829,7 @@ public:
basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
}
- // 27.8.2.2 Assign and swap:
+ // [stringstream.assign] Assign and swap:
basic_stringstream& operator=(basic_stringstream&& __rhs) {
basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
@@ -836,7 +841,7 @@ public:
__sb_.swap(__rhs.__sb_);
}
- // 27.8.2.3 Members:
+ // [stringstream.members] Member functions:
_LIBCPP_INLINE_VISIBILITY
basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
@@ -871,4 +876,8 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+#if _LIBCPP_STD_VER <= 20 && !defined(_LIPCPP_REMOVE_TRANSITIVE_INCLUDES)
+# include <type_traits>
+#endif
+
#endif // _LIBCPP_SSTREAM