Standard library header <sstream>
From cppreference.com
This header is part of the Input/Output library.
Classes | |
implements raw string device (class template) | |
implements high-level string stream input operations (class template) | |
implements high-level string stream output operations (class template) | |
implements high-level string stream input/output operations (class template) | |
Typedefs | |
stringbuf
|
basic_stringbuf<char> |
wstringbuf
|
basic_stringbuf<wchar_t> |
istringstream
|
basic_istringstream<char> |
wistringstream
|
basic_istringstream<wchar_t> |
ostringstream
|
basic_ostringstream<char> |
wostringstream
|
basic_ostringstream<wchar_t> |
stringstream
|
basic_stringstream<char> |
wstringstream
|
basic_stringstream<wchar_t> |
Functions | |
specializes the std::swap algorithm (function template) | |
specializes the std::swap algorithm (function template) | |
specializes the std::swap algorithm (function template) | |
specializes the std::swap algorithm (function template) |
Synopsis
namespace std { template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > class basic_stringbuf; typedef basic_stringbuf<char> stringbuf; typedef basic_stringbuf<wchar_t> wstringbuf; template <class charT, class traits, class Allocator> void swap(basic_stringbuf<charT, traits, Allocator>& x, basic_stringbuf<charT, traits, Allocator>& y); template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > class basic_istringstream; typedef basic_istringstream<char> istringstream; typedef basic_istringstream<wchar_t> wistringstream; template <class charT, class traits, class Allocator> void swap(basic_istringstream<charT, traits, Allocator>& x, basic_istringstream<charT, traits, Allocator>& y); template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > class basic_ostringstream; typedef basic_ostringstream<char> ostringstream; typedef basic_ostringstream<wchar_t> wostringstream; template <class charT, class traits, class Allocator> void swap(basic_ostringstream<charT, traits, Allocator>& x, basic_ostringstream<charT, traits, Allocator>& y); template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > class basic_stringstream; typedef basic_stringstream<char> stringstream; typedef basic_stringstream<wchar_t> wstringstream; template <class charT, class traits, class Allocator> void swap(basic_stringstream<charT, traits, Allocator>& x, basic_stringstream<charT, traits, Allocator>& y); }
Class std::basic_stringbuf
template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > class basic_stringbuf : public basic_streambuf<charT,traits> { public: typedef charT char_type; typedef typename traits::int_type int_type; typedef typename traits::pos_type pos_type; typedef typename traits::off_type off_type; typedef traits traits_type; typedef Allocator allocator_type; // Constructors: explicit basic_stringbuf(ios_base::openmode which = ios_base::in|ios_base::out); explicit basic_stringbuf(const basic_string<charT,traits,Allocator>& str, ios_base::openmode which = ios_base::in|ios_base::out); basic_stringbuf(const basic_stringbuf& rhs) = delete; basic_stringbuf(basic_stringbuf&& rhs); // Assign and swap: basic_stringbuf& operator=(const basic_stringbuf& rhs) = delete; basic_stringbuf& operator=(basic_stringbuf&& rhs); void swap(basic_stringbuf& rhs); // Get and set: basic_string<charT,traits,Allocator> str() const; void str(const basic_string<charT,traits,Allocator>& s); protected: // Overridden virtual functions: virtual int_type underflow(); virtual int_type pbackfail(int_type c = traits::eof()); virtual int_type overflow (int_type c = traits::eof()); virtual basic_streambuf<charT,traits>* setbuf(charT*, streamsize); virtual pos_type seekoff(off_type off, ios_base::seekdir way, ios_base::openmode which = ios_base::in|ios_base::out); virtual pos_type seekpos(pos_type sp, ios_base::openmode which = ios_base::in|ios_base::out); private: ios_base::openmode mode; // exposition only };
Class std::basic_istringstream
template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > class basic_istringstream : public basic_istream<charT,traits> { public: typedef charT char_type; typedef typename traits::int_type int_type; typedef typename traits::pos_type pos_type; typedef typename traits::off_type off_type; typedef traits traits_type; typedef Allocator allocator_type; // Constructors: explicit basic_istringstream(ios_base::openmode which = ios_base::in); explicit basic_istringstream(const basic_string<charT,traits,Allocator>& str, ios_base::openmode which = ios_base::in); basic_istringstream(const basic_istringstream& rhs) = delete; basic_istringstream(basic_istringstream&& rhs); // Assign and swap: basic_istringstream& operator=(const basic_istringstream& rhs) = delete; basic_istringstream& operator=(basic_istringstream&& rhs); void swap(basic_istringstream& rhs); // Members: basic_stringbuf<charT,traits,Allocator>* rdbuf() const; basic_string<charT,traits,Allocator> str() const; void str(const basic_string<charT,traits,Allocator>& s); private: basic_stringbuf<charT,traits,Allocator> sb; // exposition only };
Class std::basic_ostringstream
template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > class basic_ostringstream : public basic_ostream<charT,traits> { public: // types: typedef charT char_type; typedef typename traits::int_type int_type; typedef typename traits::pos_type pos_type; typedef typename traits::off_type off_type; typedef traits traits_type; typedef Allocator allocator_type; // Constructors/destructor: explicit basic_ostringstream(ios_base::openmode which = ios_base::out); explicit basic_ostringstream(const basic_string<charT,traits,Allocator>& str, ios_base::openmode which = ios_base::out); basic_ostringstream(const basic_ostringstream& rhs) = delete; basic_ostringstream(basic_ostringstream&& rhs); // Assign/swap: basic_ostringstream& operator=(const basic_ostringstream& rhs) = delete; basic_ostringstream& operator=(basic_ostringstream&& rhs); void swap(basic_ostringstream& rhs); // Members: basic_stringbuf<charT,traits,Allocator>* rdbuf() const; basic_string<charT,traits,Allocator> str() const; void str(const basic_string<charT,traits,Allocator>& s); private: basic_stringbuf<charT,traits,Allocator> sb; // exposition only };
Class std::basic_stringstream
template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > class basic_stringstream : public basic_iostream<charT,traits> { public: // types: typedef charT char_type; typedef typename traits::int_type int_type; typedef typename traits::pos_type pos_type; typedef typename traits::off_type off_type; typedef traits traits_type; typedef Allocator allocator_type; // constructors/destructor explicit basic_stringstream(ios_base::openmode which = ios_base::out|ios_base::in); explicit basic_stringstream(const basic_string<charT,traits,Allocator>& str, ios_base::openmode which = ios_base::out|ios_base::in); basic_stringstream(const basic_stringstream& rhs) = delete; basic_stringstream(basic_stringstream&& rhs); // Assign/swap: basic_stringstream& operator=(const basic_stringstream& rhs) = delete; basic_stringstream& operator=(basic_stringstream&& rhs); void swap(basic_stringstream& rhs); // Members: basic_stringbuf<charT,traits,Allocator>* rdbuf() const; basic_string<charT,traits,Allocator> str() const; void str(const basic_string<charT,traits,Allocator>& str); private: basic_stringbuf<charT, traits> sb; // exposition only };