libstdc++
std::basic_stringstream Class Reference
Inheritance diagram for std::basic_stringstream:

List of all members.

Public Types

Public Member Functions


Detailed Description

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.


Constructor & Destructor Documentation

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.

Parameters:
modeWhether 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.

Definition at line 517 of file sstream.

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.

Parameters:
strA string to copy as a starting buffer.
modeWhether 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.

Definition at line 533 of file sstream.

std::basic_stringstream::~basic_stringstream ( ) [inline]

The destructor does nothing.

The buffer is deallocated by the stringbuf object, not the formatting stream.

Definition at line 544 of file sstream.


Member Function Documentation

__stringbuf_type* std::basic_stringstream::rdbuf ( ) const [inline]

Accessing the underlying buffer.

Returns:
The current basic_stringbuf buffer.

This hides both signatures of std::basic_ios::rdbuf().

Definition at line 555 of file sstream.

__string_type std::basic_stringstream::str ( ) const [inline]

Copying out the string buffer.

Returns:
rdbuf()->str()

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.

Parameters:
sThe string to use as a new sequence.

Calls rdbuf()->str(s).

Definition at line 573 of file sstream.

References std::basic_stringbuf::str().


The documentation for this class was generated from the following file: