VMS Help
CXXLSTD, IOStreams, basic_ostringstream

 *Conan The Librarian

 			   Standard C++	Library
 		 Copyright 1996, Rogue Wave Software, Inc.

 NAME

   basic_ostringstream

 SYNOPSIS

   #include <sstream>
   template<class charT,	class traits = char_traits<charT>,
 	  class	Allocator = allocator<void> >
   class	basic_ostringstream
   : public basic_ostream<charT,	traits>

 DESCRIPTION

   The template class basic_ostringstream<charT,traits,Allocator>
   provides functionality	to write to an array in	memory.	It
   supports writing objects of class
   basic_string<charT,traits,Allocator>. 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.

 INTERFACE

   template<class charT,	class traits = char_traits<charT>,
 	  class	Allocator = allocator<void> >
   class	basic_ostringstream
   : public basic_ostream<charT,	traits>	{

   public:

    typedef basic_stringbuf<charT, traits, Allocator> sb_type;
    typedef basic_ios<charT, traits>		     ios_type;

    typedef basic_string<charT, traits, Allocator>    string_type;

    typedef traits			    traits_type;
    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;

    explicit basic_ostringstream(ios_base::openmode which =
 				ios_base::out);

    explicit basic_ostringstream(const string_type& str,
 				ios_base::openmode which =
 				ios_base::out);

    virtual ~basic_ostringstream();

    basic_stringbuf<charT,traits,Allocator> *rdbuf() const;
    string_type str() const;

    void	str(const string_type& str);

   };

 TYPES

   char_type
      The type char_type	is a synonym for the template parameter	charT.

   int_type
      The type int_type is a synonym of type traits::in_type.

   ios_type
      The type ios_type is an instantiation of class basic_ios on type
      charT.

   off_type
      The type off_type is a synonym of type traits::off_type.

   ostringstream
      The type ostringstream is an instantiation	of class
      basic_ostringstream on	type char:

        typedef basic_ostringstream<char> ostringstream;

   pos_type
      The type pos_type is a synonym of type traits::pos_type.

   sb_type
      The type sb_type is an instantiation of class basic_stringbuf
      on type charT.

   string_type
      The type string_type is an	instantiation of class basic_string
      on type charT.

   traits_type
      The type traits_type is a synonym for the template	parameter
      traits.

   wostringstream
      The type wostringstream is	an instantiation of class
      basic_ostringstream on	type wchar_t:

        typedef basic_ostringstream<wchar_t> wostringstream;

 CONSTRUCTORS

   explicit basic_ostringstream(ios_base::openmode which	=
 			      ios_base::out);
 		Constructs an object of class
 		basic_ostringstream, initializing the base
 		class basic_ostream with the associated
 		string	buffer.	The string buffer is initial-
 		ized by calling the basic_stringbuf con-
 		structor
 		basic_stringbuf<charT,traits,Allocator>(which).

   explicit basic_ostringstream(const string_type& str,
 			      ios_base::openmode which =
 			      ios_base::out);
 		Constructs an object of class
 		basic_ostringstream, initializing the base
 		class basic_ostream with the associated
 		string	buffer.	The string buffer is initial-
 		ized by calling the basic_stringbuf con-
 		structor
 		basic_stringbuf<charT,traits,Allocator>(str,which).

 DESTRUCTOR

   virtual ~basic_ostringstream();
      Destroys an object	of class basic_ostringstream.

 MEMBER FUNCTIONS

   basic_stringbuf<charT,traits,Allocator>*
   rdbuf() const;
      Returns a pointer to the basic_stringbuf associated with the
      stream.

   string_type
   str()	const;
      Returns a string object of	type string_type whose contents	is a
      copy of the underlying buffer contents.

   void
   str(const string_type& str);
      Clears the	underlying string buffer and copies the	string object
      str into it. If the opening mode is in, initialize the	input
      sequence to point at the first	character of the buffer. If
      the	opening	mode is	out, initialize	the output sequence to
      point at	the first character of the buffer. If	the opening
      mode is out	| app, initialize the output sequence to
      point at the last character of the buffer.

 EXAMPLES

   See basic_stringstream, basic_istringstream and basic_stringbuf
   examples.

 SEE ALSO

   char_traits,	ios_base, basic_ios,
   basic_stringbuf, basic_string,
   basic_istringstream,	basic_stringstream

   Working Paper	for Draft Proposed International Standard for
   Information Systems--Programming Language	C++, Section 27.7.2.3

 STANDARDS CONFORMANCE
   ANSI X3J16/ISO WG21 Joint C++	Committee
  Close     Help