libstdc++
|
Controlling input and output for std::string.
This class supports reading from and writing to objects of type std::basic_string, using the inherited functions from std::basic_iostream. To control the associated sequence, an instance of std::basic_stringbuf is used, which this page refers to as sb
.
std::basic_stringstream::basic_stringstream | ( | ios_base::openmode | __m = ios_base::out | ios_base::in | ) | [inline, explicit] |
Default constructor starts with an empty string buffer.
mode | Whether the buffer can read, or write, or both. |
Initializes sb
using mode
, and passes &sb
to the base class initializer. Does not allocate any buffer.
That's a lie. We initialize the base class with NULL, because the string class does its own memory management.
std::basic_stringstream::basic_stringstream | ( | const __string_type & | __str, |
ios_base::openmode | __m = ios_base::out | ios_base::in |
||
) | [inline, explicit] |
Starts with an existing string buffer.
str | A string to copy as a starting buffer. |
mode | Whether the buffer can read, or write, or both. |
Initializes sb
using str and mode
, and passes &sb
to the base class initializer.
That's a lie. We initialize the base class with NULL, because the string class does its own memory management.
std::basic_stringstream::~basic_stringstream | ( | ) | [inline] |
__stringbuf_type* std::basic_stringstream::rdbuf | ( | ) | const [inline] |
Accessing the underlying buffer.
This hides both signatures of std::basic_ios::rdbuf().
__string_type std::basic_stringstream::str | ( | ) | const [inline] |
Copying out the string buffer.
Definition at line 563 of file sstream.
References std::basic_stringbuf::str().
void std::basic_stringstream::str | ( | const __string_type & | __s | ) | [inline] |
Setting a new buffer.
s | The string to use as a new sequence. |
Calls rdbuf()->str(s)
.
Definition at line 573 of file sstream.
References std::basic_stringbuf::str().