.\" ident @(#)basic_ostringstream.3 .\" Standard Template Library .\" $$RW_INSERT_HEADER "slyrs.man" .TH basic_ostringstream 3C++ "02 Apr 1998" "Rogue Wave Software" "-" .ce2 Standard C++ Library Copyright 1998, Rogue Wave Software, Inc. .SH NAME \f2basic_ostringstream\fP, \f2ostringstream\fP, \f2wostringstream\fP \ - Supports writing objects of class basic_string .SH SYNOPSIS .br #include .br template, .RE .RS 8 class Allocator = allocator > .RE .RS 0 class basic_ostringstream .br : public basic_ostream .SH DESCRIPTION The template class basic_ostringstream writes to an array in memory. It supports writing objects of class basic_string. It uses a basic_stringbuf object to control the associated storage. It inherits from basic_ostream and therefore can use all the formatted and unformatted output functions. .SH INTERFACE .br template, .RE .RS 8 class Allocator = allocator > .RE .RS 0 class basic_ostringstream .br : public basic_ostream { .br .br public: .br .RE .RS 1 typedef traits traits_type; .br typedef charT char_type; .br typedef typename traits::int_type int_type; .br typedef typename traits::pos_type pos_type; .br typedef typename traits::off_type off_type; .RE .RS 0 .RE .RS 1 typedef basic_stringbuf sb_type; .br typedef basic_ios ios_type; .br typedef basic_string .RE .RS 22 string_type; .RE .RS 0 .RE .RS 1 explicit basic_ostringstream(ios_base::openmode which = .RE .RS 30 ios_base::out); .RE .RS 0 .RE .RS 1 explicit basic_ostringstream(const string_type& str, .RE .RS 30 ios_base::openmode which = .br ios_base::out); .RE .RS 0 .RE .RS 1 virtual ~basic_ostringstream(); .RE .RS 0 .RE .RS 1 basic_stringbuf *rdbuf() const; .RE .RS 0 .RE .RS 1 string_type str() const; .RE .RS 0 .RE .RS 1 void str(const string_type& str); .RE .RS 0 .br }; .SH TYPES .br char_type .RE .RS 3 The type \f2char_type\fP is a synonym for the template parameter \f2charT\fP. .RE .br int_type .RE .RS 3 The type \f2int_type\fP is a synonym of type \f2traits::in_type\fP. .RE .br ios_type .RE .RS 3 The type\f2 ios_type\fP is an instantiation of class \f2basic_ios\fP on type \f2charT\fP. .RE .br off_type .RE .RS 3 The type \f2off_type\fP is a synonym of type \f2traits::off_type\fP. .RE .br ostringstream .RE .RS 3 The type \f2ostringstream\fP is an instantiation of class \f2basic_ostringstream \fPon type \f2char\fP: \f2typedef basic_ostringstream ostringstream;\fP .RE .br pos_type .RE .RS 3 The type \f2pos_type\fP is a synonym of type \f2traits::pos_type\fP. .RE .br sb_type .RE .RS 3 The type \f2sb_type\fP is an instantiation of class \f2basic_stringbuf \fPon type \f2charT\fP. .RE .br string_type .RE .RS 3 The type \f2string_type\fP is an instantiation of class \f2basic_string \fPon type \f2charT\fP. .RE .br traits_type .RE .RS 3 The type \f2traits_type\fP is a synonym for the template parameter \f2traits\fP. .RE .br wostringstream .RE .RS 3 The type \f2wostringstream\fP is an instantiation of class \f2basic_ostringstream\fP on type \f2wchar_t\fP: \f2typedef basic_ostringstream wostringstream;\fP .RE .SH CONSTRUCTORS .br explicit basic_ostringstream(ios_base::openmode which = .RE .RS 28 ios_base::out); .RE .RS 3 Constructs an object of class \f2basic_ostringstream\fP, initializing the base class \f2basic_ostream\fP with the associated string buffer. The string buffer is initialized by calling the \f2basic_stringbuf\fP constructor \f2basic_stringbuf(which)\fP. .RE .RE .RS 0 explicit basic_ostringstream(const string_type& str, .RE .RS 28 ios_base::openmode which = .br ios_base::out); .RE .RS 3 Constructs an object of class \f2basic_ostringstream\fP, initializing the base class \f2basic_ostream\fP with the associated string buffer. The string buffer is initialized by calling the \f2basic_stringbuf\fP constructor \f2basic_stringbuf(str,which)\fP. .RE .SH DESTRUCTORS .RE .RS 0 virtual ~basic_ostringstream(); .RE .RS 3 Destroys an object of class \f2basic_ostringstream\fP. .RE .SH MEMBER FUNCTIONS .br basic_stringbuf* .br rdbuf() const; .RE .RS 3 Returns a pointer to the \f2basic_stringbuf\fP associated with the stream. .RE .br string_type .br str() const; .RE .RS 3 Returns a string object of type \f2string_type\fP whose contents is a copy of the underlying buffer contents. .RE .br void .br str(const string_type& str); .RE .RS 3 Clears the underlying string buffer and copies the string object \f2str\fP into it. If the opening mode is \f2in\fP, initializes the input sequence to point to the first character of the buffer. If the opening mode is \f2out\fP, initializes the output sequence to point to the first character of the buffer. If the opening mode is \f2out | app\fP, initializes the output sequence to point to the last character of the buffer. .RE .SH EXAMPLE See basic_stringstream, basic_istringstream and basic_stringbuf examples. .SH SEE ALSO char_traits(3C++), ios_base(3C++), basic_ios(3C++), basic_stringbuf(3C++), basic_string(3C++), basic_istringstream(3C++), basic_stringstream(3C++) Working Paper for Draft Proposed International Standard for Information Systems--Programming Language C++, Section 27.7.3 .SH STANDARDS CONFORMANCE ANSI X3J16/ISO WG21 Joint C++ Committee