Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Tools Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWpostream

Module:  Essential Tools Module   Group:  Virtual Stream Classes


RWpostreamRWvostreamRWvios

Local Index

Members

Synopsis

#include <rw/pstream.h>
// Construct an RWpostream, using cout's streambuf:
RWpostream pstr(cout) ;

Description

Class RWpostream specializes the abstract base class RWvostream to store variables in a portable (printable) ASCII format. The results can be restored by using its counterpart RWpistream.

You can think of RWpistream and RWpostream as an ASCII veneer over an associated streambuf which are responsible for formatting variables and escaping characters such that the results can be interchanged between any machines. As such, they are slower than their binary counterparts RWbistream and RWbostream which are more machine dependent. Because RWpistream and RWpostream retain no information about the state of their associated std::streambufs, their use can be freely exchanged with other users of the streambuf (such as std::istream or std::ifstream).

The goal of class RWpostream and RWpistream is to store variables using nothing but printable ASCII characters. Hence, nonprintable characters must be converted into an external representation where they can be recognized. Furthermore, other characters may be merely bit values (a bit image, for example), having nothing to do with characters as symbols. For example,

The expression "pstr << c"treats c as a symbol for a newline, an unprintable character. The expression "pstr.put(c)" treats c as the literal number "10".

Note that variables should not be separated with white space. Such white space would be interpreted literally and would have to be read back in as a character string.

RWpostream can be interrogated as to the stream state using member functions good(), bad(), eof(), precision(), etc.

Persistence

None

Example

See RWpistream for an example of how to read back in the results of this program.

Program output:

Public Constructors

RWpostream(streambuf* s);
RWpostream(ostream& str);

Public Destructor

virtual ~RWpostream();

Public Operators

virtual RWvostream&
operator<<(const char* s);
virtual RWvostream&
operator<<(const wchar_t* ws);
virtual RWvostream&
operator<<(char c);
virtual RWvostream&
operator<<(wchar_t wc);
virtual RWvostream&
operator<<(unsigned char c);
virtual RWvostream&
operator<<(double d);
virtual RWvostream&
operator<<(long double d);
virtual RWvostream&
operator<<(float f);
virtual RWvostream&
operator<<(int i);
virtual RWvostream&
operator<<(unsigned int i);
virtual RWvostream&
operator<<(long l);
virtual RWvostream&
operator<<(long long l);
virtual RWvostream&
operator<<(unsigned long l);
virtual RWvostream&
operator<<(unsigned long long l);
virtual RWvostream&
operator<<(short s);
virtual RWvostream&
operator<<(unsigned short s);
operator void*();

Public Member Functions

virtual RWvostream&
flush();
int 
precision() const;
int 
precision(int p);
virtual RWvostream&
put(char c);
virtual RWvostream&
put(wchar_t wc);
virtual RWvostream&
put(unsigned char c);
virtual RWvostream&
put(const char* p, size_t N);
virtual RWvostream&
put(const wchar_t* p, size_t N);
virtual RWvostream&
put(const unsigned char* p, size_t N);
virtual RWvostream&
put(const short* p, size_t N);
virtual RWvostream&
put(const unsigned short* p, size_t N);
virtual RWvostream&
put(const int* p, size_t N);
virtual RWvostream&
put(const unsigned int* p, size_t N);
virtual RWvostream&
put(const long* p, size_t N);
virtual RWvostream&
put(const long long* p, size_t N);
virtual RWvostream&
put(const unsigned long* p, size_t N);
virtual RWvostream&
put(const unsigned long long* p, size_t N);
virtual RWvostream&
put(const float* p, size_t N);
virtual RWvostream&
put(const double* p, size_t N);
virtual RWvostream&
put(const long double* p, size_t N);
virtual RWvostream&
putString(const char*s, size_t N);
std::ostream& 
std ();
const std::ostream& 
std () const;


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.