basic_stringstream man page on Solaris

Man page or keyword search:  
man Server   20652 pages
apropos Keyword Search (all sections)
Output format
Solaris logo
[printable version]

basic_stringstream(3C++)	       -	      basic_stringstream(3C++)

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

NAME
       basic_stringstream, stringstream

	-     Supports	   writing    and    reading	objects	   of	 class
       basic_string<charT,traits,Alocator> to/from an array in memory.

SYNOPSIS
       #include <sstream>
       template<class charT, class traits = char_traits<charT>,
	class Allocator = allocator<charT> >
class basic_stringstream
: public basic_iostream<charT, traits>

DESCRIPTION
       The template class basic_stringstream<charT,traits,Allocator> reads and
       writes  to  an array in memory. It supports writing and reading objects
       of class basic_string<charT,traits,Alocator>. It uses a basic_stringbuf
       object	to   control   the   associated	  storage.  It	inherits  from
       basic_iostream_and therefore can use all the formatted and  unformatted
       output and input functions.

INTERFACE
       template<class charT, class traits = char_traits<charT>,
	class Allocator = allocator<charT> >
class basic_stringstream
: public basic_iostream<charT, traits> {
public:
 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;

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

 explicit basic_stringstream(ios_base::openmode which =
			     ios_base::out | ios_base::in);

 explicit basic_stringstream(const string_type& str,
			     ios_base::openmode which =
			     ios_base::out | ios_base::in);

 virtual ~basic_stringstream();

 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.

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.

stringstream

   The	type  stringstream  is an instantiation of class basic_stringstream on
   type char:

   typedef basic_stringstream<char> stringstream;

traits_type

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

wstringstream

   The type wstringstream is an instantiation of class	basic_stringstream  on
   type wchar_t:

   typedef basic_stringstream<wchar_t> wstringstream;

CONSTRUCTORS
       explicit basic_stringstream(ios_base::openmode which =
		  ios_base::in | ios_base::out);

   Constructs  an  object  of  class basic_stringstream, initializing the base
   class basic_iostream with the associated string buffer. The	string	buffer
   is  initialized  by	calling	 the basic_stringbuf constructor basic_string‐
   buf<charT,traits,Allocator>(which).

explicit basic_stringstream(const string_type& str,
		  ios_base::openmode which =
		  ios_base::in | ios_base::out);

   Constructs an object of class  basic_stringstream,  initializing  the  base
   class  basic_iostream  with the associated string buffer. The string buffer
   is initialized by calling  the  basic_stringbuf  constructor	 basic_string‐
   buf<charT,traits,Allocator>(str,which).

DESTRUCTORS
virtual ~basic_stringstream();

   Destroys an object of class basic_stringstream.

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 string buffer and copies the string object str into it.  If  the
   opening  mode  is  in, initializes the input sequence to point to the first
   character of the buffer. If the opening mode is out, initializes the output
   sequence to point to the first character of the buffer. If the opening mode
   is out | app, initializes the output sequence to point to the last  charac‐
   ter of the buffer.

EXAMPLE
       //
       // stdlib/examples/manual/stringstream.cpp
       //
       #include<iostream>
       #include<sstream>

       void main ( )
       {
 using namespace std;

  // create a bi-directional wstringstream object
 wstringstream inout;

  // output characters
 inout << L"Das ist die rede von einem man" << endl;
 inout << L"C'est l'histoire d'un home" << endl;
 inout << L"This is the story of a man" << endl;

 wchar_t p[100];

  // extract the first line
 inout.getline(p,100);

  // output the first line to stdout
 wcout << endl << L"Deutch :" << endl;
 wcout << p;

  // extract the second line
 inout.getline(p,100);

  // output the second line to stdout
 wcout << endl << L"Francais :" << endl;
 wcout << p;

  // extract the third line
 inout.getline(p,100);

  // output the third line to stdout
 wcout << endl << L"English :" << endl;
 wcout << p;

  // output the all content of the
  //wstringstream object to stdout
 wcout << endl << endl << inout.str();
}

SEE ALSO
       char_traits(3C++),   ios_base(3C++),   basic_ios(3C++),	 basic_string‐
       buf(3C++),	 basic_string(3C++),	    basic_istringstream(3C++),
       basic_ostringstream(3c++)

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

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

Rogue Wave Software		  02 Apr 1998	      basic_stringstream(3C++)
[top]

List of man pages available for Solaris

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net