SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWeostream Class Reference

Specializes the base class RWbostream to store values in a portable binary format. More...

#include <rw/estream.h>

Inheritance diagram for RWeostream:
RWbostream RWvostream RWvios

Public Types

enum  Endian { LittleEndian , BigEndian , HostEndian }
 

Public Member Functions

 RWeostream (std::ostream &str, Endian fmt=HostEndian)
 
 RWeostream (std::streambuf *sb, Endian fmt=HostEndian)
 
virtual RWvostreamflush ()
 
virtual RWvostreamput (bool b)
 
virtual RWvostreamput (char c)
 
virtual RWvostreamput (const bool *v, size_t n)
 
virtual RWvostreamput (const char *v, size_t n)
 
virtual RWvostreamput (const double *v, size_t n)
 
virtual RWvostreamput (const float *v, size_t n)
 
virtual RWvostreamput (const int *v, size_t n)
 
virtual RWvostreamput (const long *v, size_t n)
 
virtual RWvostreamput (const long double *, size_t)
 
virtual RWvostreamput (const long long *v, size_t n)
 
virtual RWvostreamput (const short *v, size_t n)
 
virtual RWvostreamput (const signed char *v, size_t n)
 
virtual RWvostreamput (const unsigned char *v, size_t n)
 
virtual RWvostreamput (const unsigned int *v, size_t n)
 
virtual RWvostreamput (const unsigned long *v, size_t n)
 
virtual RWvostreamput (const unsigned long long *v, size_t n)
 
virtual RWvostreamput (const unsigned short *v, size_t n)
 
virtual RWvostreamput (const wchar_t *v, size_t n)
 
virtual RWvostreamput (double d)
 
virtual RWvostreamput (float f)
 
virtual RWvostreamput (int i)
 
virtual RWvostreamput (long double)
 
virtual RWvostreamput (long i)
 
virtual RWvostreamput (long long i)
 
virtual RWvostreamput (short i)
 
virtual RWvostreamput (signed char c)
 
virtual RWvostreamput (unsigned char c)
 
virtual RWvostreamput (unsigned int i)
 
virtual RWvostreamput (unsigned long i)
 
virtual RWvostreamput (unsigned long long i)
 
virtual RWvostreamput (unsigned short i)
 
virtual RWvostreamput (wchar_t wc)
 
virtual RWvostreamputChar (char c)
 
virtual RWvostreamputChar (signed char c)
 
virtual RWvostreamputChar (unsigned char c)
 
virtual RWvostreamputChar (wchar_t wc)
 
virtual RWvostreamputChars (const char *s, size_t n)
 
virtual RWvostreamputSizeT (size_t sz)
 
virtual RWvostreamputString (const char *s, size_t n)
 
- Public Member Functions inherited from RWbostream
 RWbostream (std::ostream &str)
 
 RWbostream (std::streambuf *sb)
 
virtual int bad ()
 
virtual void clear (int v=0)
 
virtual int eof ()
 
virtual int fail ()
 
virtual int good ()
 
virtual int rdstate ()
 
- Public Member Functions inherited from RWvostream
virtual ~RWvostream ()
 
unsigned version () const
 
void version (unsigned v)
 
- Public Member Functions inherited from RWvios
 operator void * ()
 

Additional Inherited Members

Detailed Description

Class RWeostream specializes the base class RWbostream to store values in a portable binary format. The results can be restored via its counterpart, RWeistream.

See the entry for RWeistream for a general description of the endian stream classes.

Synopsis
#include <rw/estream.h>
// Construct an RWeostream that uses cout's streambuf,
// and writes out values in little-endian format
Specializes the base class RWbostream to store values in a portable binary format.
Definition estream.h:84
@ LittleEndian
Definition estream.h:94
Persistence
None.
Example
#include <fstream>
#include <iostream>
#include <rw/estream.h>
int main() {
// Open an output file
std::ofstream fstr("data.dat");
// Construct an RWeostream from it
RWeostream estr(fstr);
int i = 5;
float f = 22.1f;
double d = -0.05;
std::cout << "An integer, a float and a double "
"sent out on a RWeostream!\n";
// Store a float & double
estr << i << f << d;
return 0;
}

Member Enumeration Documentation

◆ Endian

Specifies the format to use to represent numeric values in the stream.

Enumerator
LittleEndian 

Use little-endian format.

BigEndian 

Use big-endian format.

HostEndian 

Use native format of the current environment.

Constructor & Destructor Documentation

◆ RWeostream() [1/2]

RWeostream::RWeostream ( std::ostream & str,
Endian fmt = HostEndian )

Constructs an RWeostream from the std::streambuf associated with the std::ostream str. Values placed into the stream have an endian format given by fmt. For DOS, the str must have been opened in binary mode.

Exceptions
RWStreamErrThrown if the underlying std::streambuf is not empty.

◆ RWeostream() [2/2]

RWeostream::RWeostream ( std::streambuf * sb,
Endian fmt = HostEndian )

Constructs an RWeostream from the std::streambuf s. Values placed into the stream have an endian format given by fmt. For DOS, the std::streambuf s must have been created in binary mode.

Exceptions
RWStreamErrThrown if the std::streambuf sb is not empty.

Member Function Documentation

◆ flush()

virtual RWvostream & RWeostream::flush ( )
inlinevirtual

Sends the contents of the stream buffer to output immediately.

Reimplemented from RWbostream.

◆ put() [1/32]

virtual RWvostream & RWeostream::put ( bool b)
inlinevirtual

Stores the bool b to the output stream.

Reimplemented from RWbostream.

◆ put() [2/32]

virtual RWvostream & RWeostream::put ( char c)
inlinevirtual

Stores the char c to the output stream, preserving its value.

Reimplemented from RWbostream.

◆ put() [3/32]

virtual RWvostream & RWeostream::put ( const bool * v,
size_t n )
inlinevirtual

Stores the vector of n bool starting at v to the output stream.

Reimplemented from RWbostream.

◆ put() [4/32]

virtual RWvostream & RWeostream::put ( const char * v,
size_t n )
inlinevirtual

Stores the vector of n char starting at v to the output stream. The characters should be treated as literal numbers (i.e., not as a character string).

Reimplemented from RWbostream.

◆ put() [5/32]

virtual RWvostream & RWeostream::put ( const double * v,
size_t n )
virtual

Stores the vector of n double starting at v to the output stream.

Reimplemented from RWbostream.

◆ put() [6/32]

virtual RWvostream & RWeostream::put ( const float * v,
size_t n )
virtual

Stores the vector of n float starting at v to the output stream.

Reimplemented from RWbostream.

◆ put() [7/32]

virtual RWvostream & RWeostream::put ( const int * v,
size_t n )
virtual

Stores the vector of n int starting at v to the output stream.

Reimplemented from RWbostream.

◆ put() [8/32]

virtual RWvostream & RWeostream::put ( const long * v,
size_t n )
virtual

Stores the vector of n long starting at v to the output stream.

Reimplemented from RWbostream.

◆ put() [9/32]

virtual RWvostream & RWeostream::put ( const long double * ,
size_t  )
inlinevirtual
Exceptions
RWInternalErrThis function is not supported with endian streams.
Note
This operator function is available only if your compiler supports the long double type.

Reimplemented from RWbostream.

◆ put() [10/32]

virtual RWvostream & RWeostream::put ( const long long * v,
size_t n )
virtual

Stores the vector of n long long starting at v to the output stream.

Note
This operator function is available only if your compiler supports the long long type.

Reimplemented from RWbostream.

◆ put() [11/32]

virtual RWvostream & RWeostream::put ( const short * v,
size_t n )
virtual

Stores the vector of n short starting at v to the output stream.

Reimplemented from RWbostream.

◆ put() [12/32]

virtual RWvostream & RWeostream::put ( const signed char * v,
size_t n )
inlinevirtual

Stores the vector of n signed char starting at v to the output stream. The characters should be treated as literal numbers (i.e., not as a character string).

Reimplemented from RWbostream.

◆ put() [13/32]

virtual RWvostream & RWeostream::put ( const unsigned char * v,
size_t n )
inlinevirtual

Stores the vector of n unsigned char starting at v to the output stream. The characters should be treated as literal numbers (i.e., not as a character string).

Reimplemented from RWbostream.

◆ put() [14/32]

virtual RWvostream & RWeostream::put ( const unsigned int * v,
size_t n )
virtual

Stores the vector of n unsigned int starting at v to the output stream.

Reimplemented from RWbostream.

◆ put() [15/32]

virtual RWvostream & RWeostream::put ( const unsigned long * v,
size_t n )
virtual

Stores the vector of n unsigned long starting at v to the output stream.

Reimplemented from RWbostream.

◆ put() [16/32]

virtual RWvostream & RWeostream::put ( const unsigned long long * v,
size_t n )
virtual

Stores the vector of n unsigned long long starting at v to the output stream.

Note
This operator function is available only if your compiler supports the unsigned long long type.

Reimplemented from RWbostream.

◆ put() [17/32]

virtual RWvostream & RWeostream::put ( const unsigned short * v,
size_t n )
virtual

Stores the vector of n unsigned short starting at v to the output stream.

Reimplemented from RWbostream.

◆ put() [18/32]

virtual RWvostream & RWeostream::put ( const wchar_t * v,
size_t n )
virtual

Stores the vector of n wchar_t starting at v to the output stream. The characters should be treated as literal numbers (i.e., not as a character string).

Reimplemented from RWbostream.

◆ put() [19/32]

virtual RWvostream & RWeostream::put ( double d)
virtual

Stores the double d to the output stream.

Reimplemented from RWbostream.

◆ put() [20/32]

virtual RWvostream & RWeostream::put ( float f)
virtual

Stores the float f to the output stream.

Reimplemented from RWbostream.

◆ put() [21/32]

virtual RWvostream & RWeostream::put ( int i)
virtual

Stores the int i to the output stream.

Reimplemented from RWbostream.

◆ put() [22/32]

virtual RWvostream & RWeostream::put ( long double )
inlinevirtual
Exceptions
RWInternalErrThis function is not supported with endian streams.
Note
This operator function is available only if your compiler supports the long double type.

Reimplemented from RWbostream.

◆ put() [23/32]

virtual RWvostream & RWeostream::put ( long i)
virtual

Stores the long i to the output stream.

Reimplemented from RWbostream.

◆ put() [24/32]

virtual RWvostream & RWeostream::put ( long long i)
virtual

Stores the long long i to the output stream.

Note
This operator function is available only if your compiler supports the long long type.

Reimplemented from RWbostream.

◆ put() [25/32]

virtual RWvostream & RWeostream::put ( short i)
virtual

Stores the short i to the output stream.

Reimplemented from RWbostream.

◆ put() [26/32]

virtual RWvostream & RWeostream::put ( signed char c)
inlinevirtual

Stores the signed char c to the output stream, preserving its value.

Reimplemented from RWbostream.

◆ put() [27/32]

virtual RWvostream & RWeostream::put ( unsigned char c)
inlinevirtual

Stores the unsigned char c to the output stream, preserving its value.

Reimplemented from RWbostream.

◆ put() [28/32]

virtual RWvostream & RWeostream::put ( unsigned int i)
virtual

Stores the unsigned int i to the output stream.

Reimplemented from RWbostream.

◆ put() [29/32]

virtual RWvostream & RWeostream::put ( unsigned long i)
virtual

Stores the unsigned long i to the output stream.

Reimplemented from RWbostream.

◆ put() [30/32]

virtual RWvostream & RWeostream::put ( unsigned long long i)
virtual

Stores the unsigned long long i to the output stream.

Note
This operator function is available only if your compiler supports the unsigned long long type.

Reimplemented from RWbostream.

◆ put() [31/32]

virtual RWvostream & RWeostream::put ( unsigned short i)
virtual

Stores the unsigned short i to the output stream.

Reimplemented from RWbostream.

◆ put() [32/32]

virtual RWvostream & RWeostream::put ( wchar_t wc)
virtual

Stores the wchar_t wc to the output stream, preserving its value.

Reimplemented from RWbostream.

◆ putChar() [1/4]

virtual RWvostream & RWeostream::putChar ( char c)
inlinevirtual

Stores the char c to the output stream, preserving its meaning. c is treated as a character.

Reimplemented from RWbostream.

◆ putChar() [2/4]

virtual RWvostream & RWeostream::putChar ( signed char c)
inlinevirtual

Stores the signed char c to the output stream, preserving its meaning. c is treated as a character.

Reimplemented from RWbostream.

◆ putChar() [3/4]

virtual RWvostream & RWeostream::putChar ( unsigned char c)
inlinevirtual

Stores the unsigned char c to the output stream, preserving its meaning. c is treated as a character.

Reimplemented from RWbostream.

◆ putChar() [4/4]

virtual RWvostream & RWeostream::putChar ( wchar_t wc)
inlinevirtual

Stores the wchar_t wc to the output stream, preserving its value. wc is treated as a character.

Reimplemented from RWbostream.

◆ putChars()

virtual RWvostream & RWeostream::putChars ( const char * s,
size_t n )
virtual

Stores n char starting at s to the output stream.

Reimplemented from RWbostream.

◆ putSizeT()

virtual RWvostream & RWeostream::putSizeT ( size_t sz)
virtual

Stores the size_t sz to the output stream.

Reimplemented from RWbostream.

◆ putString()

virtual RWvostream & RWeostream::putString ( const char * s,
size_t n )
virtual

Stores the character string, including embedded nulls, starting at s to the output stream.

Reimplemented from RWbostream.

Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.