std::basic_ostringstream< _CharT, _Traits, _Alloc > Class Template Reference

Controlling output for std::string. More...

Inheritance diagram for std::basic_ostringstream< _CharT, _Traits, _Alloc >:

std::basic_ostream< _CharT, _Traits > std::basic_ios< _CharT, _Traits > std::ios_base List of all members.

Public Types

typedef _CharT char_type
typedef _Traits traits_type
typedef _Alloc allocator_type
typedef traits_type::int_type int_type
typedef traits_type::pos_type pos_type
typedef traits_type::off_type off_type
typedef basic_string< _CharT,
_Traits, _Alloc > 
__string_type
typedef basic_stringbuf< _CharT,
_Traits, _Alloc > 
__stringbuf_type
typedef basic_ostream< char_type,
traits_type
__ostream_type

Public Member Functions

 basic_ostringstream (ios_base::openmode __mode=ios_base::out)
 Default constructor starts with an empty string buffer.

 basic_ostringstream (const __string_type &__str, ios_base::openmode __mode=ios_base::out)
 Starts with an existing string buffer.

 ~basic_ostringstream ()
 The destructor does nothing.

__stringbuf_typerdbuf () const
 Accessing the underlying buffer.

__string_type str () const
 Copying out the string buffer.

void str (const __string_type &__s)
 Setting a new buffer.


Private Attributes

__stringbuf_type _M_stringbuf

Detailed Description

template<typename _CharT, typename _Traits, typename _Alloc>
class std::basic_ostringstream< _CharT, _Traits, _Alloc >

Controlling output for std::string.

This class supports writing to objects of type std::basic_string, using the inherited functions from std::basic_ostream. To control the associated sequence, an instance of std::basic_stringbuf is used, which this page refers to as sb.

Definition at line 429 of file sstream.


Member Typedef Documentation

template<typename _CharT, typename _Traits, typename _Alloc>
typedef basic_ostream<char_type, traits_type> std::basic_ostringstream< _CharT, _Traits, _Alloc >::__ostream_type
 

Reimplemented from std::basic_ostream< _CharT, _Traits >.

Definition at line 445 of file sstream.

template<typename _CharT, typename _Traits, typename _Alloc>
typedef basic_string<_CharT, _Traits, _Alloc> std::basic_ostringstream< _CharT, _Traits, _Alloc >::__string_type
 

Definition at line 443 of file sstream.

template<typename _CharT, typename _Traits, typename _Alloc>
typedef basic_stringbuf<_CharT, _Traits, _Alloc> std::basic_ostringstream< _CharT, _Traits, _Alloc >::__stringbuf_type
 

Definition at line 444 of file sstream.

template<typename _CharT, typename _Traits, typename _Alloc>
typedef _Alloc std::basic_ostringstream< _CharT, _Traits, _Alloc >::allocator_type
 

Definition at line 437 of file sstream.

template<typename _CharT, typename _Traits, typename _Alloc>
typedef _CharT std::basic_ostringstream< _CharT, _Traits, _Alloc >::char_type
 

These are standard types. They permit a standardized way of referring to names of (or names dependant on) the template parameters, which are specific to the implementation.

Reimplemented from std::basic_ostream< _CharT, _Traits >.

Definition at line 433 of file sstream.

template<typename _CharT, typename _Traits, typename _Alloc>
typedef traits_type::int_type std::basic_ostringstream< _CharT, _Traits, _Alloc >::int_type
 

Reimplemented from std::basic_ostream< _CharT, _Traits >.

Definition at line 438 of file sstream.

template<typename _CharT, typename _Traits, typename _Alloc>
typedef traits_type::off_type std::basic_ostringstream< _CharT, _Traits, _Alloc >::off_type
 

Reimplemented from std::basic_ostream< _CharT, _Traits >.

Definition at line 440 of file sstream.

template<typename _CharT, typename _Traits, typename _Alloc>
typedef traits_type::pos_type std::basic_ostringstream< _CharT, _Traits, _Alloc >::pos_type
 

Reimplemented from std::basic_ostream< _CharT, _Traits >.

Definition at line 439 of file sstream.

template<typename _CharT, typename _Traits, typename _Alloc>
typedef _Traits std::basic_ostringstream< _CharT, _Traits, _Alloc >::traits_type
 

Reimplemented from std::basic_ostream< _CharT, _Traits >.

Definition at line 434 of file sstream.


Constructor & Destructor Documentation

template<typename _CharT, typename _Traits, typename _Alloc>
std::basic_ostringstream< _CharT, _Traits, _Alloc >::basic_ostringstream ios_base::openmode  __mode = ios_base::out  )  [inline, explicit]
 

Default constructor starts with an empty string buffer.

Parameters:
mode Whether the buffer can read, or write, or both.
ios_base::out is automatically included in mode.

Initializes sb using mode|out, and passes &sb to the base class initializer. Does not allocate any buffer.

Definition at line 472 of file sstream.

References std::basic_ios< _CharT, _Traits >::init(), and std::ios_base::openmode.

template<typename _CharT, typename _Traits, typename _Alloc>
std::basic_ostringstream< _CharT, _Traits, _Alloc >::basic_ostringstream const __string_type __str,
ios_base::openmode  __mode = ios_base::out
[inline, explicit]
 

Starts with an existing string buffer.

Parameters:
str A string to copy as a starting buffer.
mode Whether the buffer can read, or write, or both.
ios_base::out is automatically included in mode.

Initializes sb using str and mode|out, and passes &sb to the base class initializer.

Definition at line 492 of file sstream.

References std::basic_ios< _CharT, _Traits >::init(), and std::ios_base::openmode.

template<typename _CharT, typename _Traits, typename _Alloc>
std::basic_ostringstream< _CharT, _Traits, _Alloc >::~basic_ostringstream  )  [inline]
 

The destructor does nothing.

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

Definition at line 503 of file sstream.


Member Function Documentation

template<typename _CharT, typename _Traits, typename _Alloc>
__stringbuf_type* std::basic_ostringstream< _CharT, _Traits, _Alloc >::rdbuf  )  const [inline]
 

Accessing the underlying buffer.

Returns:
The current basic_stringbuf buffer.
This hides both signatures of std::basic_ios::rdbuf().

Reimplemented from std::basic_ios< _CharT, _Traits >.

Definition at line 514 of file sstream.

template<typename _CharT, typename _Traits, typename _Alloc>
void std::basic_ostringstream< _CharT, _Traits, _Alloc >::str const __string_type __s  )  [inline]
 

Setting a new buffer.

Parameters:
s The string to use as a new sequence.
Calls rdbuf()->str(s).

Definition at line 532 of file sstream.

template<typename _CharT, typename _Traits, typename _Alloc>
__string_type std::basic_ostringstream< _CharT, _Traits, _Alloc >::str  )  const [inline]
 

Copying out the string buffer.

Returns:
rdbuf()->str()

Definition at line 522 of file sstream.

Referenced by std::operator<<().


Member Data Documentation

template<typename _CharT, typename _Traits, typename _Alloc>
__stringbuf_type std::basic_ostringstream< _CharT, _Traits, _Alloc >::_M_stringbuf [private]
 

Definition at line 453 of file sstream.


The documentation for this class was generated from the following file:
Generated on Tue Jan 30 17:32:18 2007 for GNU C++ STL by doxygen 1.3.6