SourcePro C++ 12.0 |
SourcePro® C++ API Reference Guide |
SourcePro C++ Documentation Home |
Specializes the base class RWbostream to store values in a portable binary format. More...
#include <rw/estream.h>
Public Types | |
enum | Endian { LittleEndian, BigEndian, HostEndian } |
Public Member Functions | |
RWeostream (std::ostream &str, Endian fmt=HostEndian) | |
RWeostream (std::streambuf *s, Endian fmt=HostEndian) | |
virtual RWvostream & | operator<< (char c) |
virtual RWvostream & | put (char c) |
virtual RWvostream & | put (const char *v, size_t N) |
virtual RWvostream & | put (unsigned char c) |
virtual RWvostream & | put (const unsigned char *v, size_t N) |
virtual RWvostream & | operator<< (unsigned char c) |
virtual RWvostream & | putSizeT (size_t sz) |
virtual RWvostream & | operator<< (unsigned int i) |
virtual RWvostream & | operator<< (int i) |
virtual RWvostream & | operator<< (long i) |
virtual RWvostream & | operator<< (unsigned long i) |
virtual RWvostream & | operator<< (short i) |
virtual RWvostream & | operator<< (unsigned short i) |
virtual RWvostream & | operator<< (double d) |
virtual RWvostream & | operator<< (float f) |
virtual RWvostream & | operator<< (unsigned long long i) |
virtual RWvostream & | operator<< (long long i) |
virtual RWvostream & | operator<< (long double) |
virtual RWvostream & | operator<< (wchar_t wc) |
virtual RWvostream & | put (wchar_t wc) |
virtual RWvostream & | operator<< (const char *s) |
virtual RWvostream & | putString (const char *s, size_t N) |
virtual RWvostream & | put (const short *v, size_t N) |
virtual RWvostream & | put (const unsigned short *v, size_t N) |
virtual RWvostream & | put (const int *v, size_t N) |
virtual RWvostream & | put (const unsigned int *v, size_t N) |
virtual RWvostream & | put (const long *v, size_t N) |
virtual RWvostream & | put (const unsigned long *v, size_t N) |
virtual RWvostream & | put (const float *v, size_t N) |
virtual RWvostream & | put (const double *v, size_t N) |
virtual RWvostream & | put (const long long *v, size_t N) |
virtual RWvostream & | put (const unsigned long long *v, size_t N) |
virtual RWvostream & | put (const long double *, size_t) |
virtual RWvostream & | put (const wchar_t *v, size_t N) |
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.
#include <rw/estream.h> // Construct an RWeostream that uses cout's streambuf, // and writes out values in little-endian format RWeostream estr(std::cout, RWeostream::LittleEndian);
None.
#include <iostream> #include <fstream> #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; }
enum RWeostream::Endian |
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.
RWStreamErr | if the underlying std::streambuf is not empty. |
RWeostream::RWeostream | ( | std::streambuf * | s, | |
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.
RWStreamErr | if the std::streambuf s is not empty. |
virtual RWvostream& RWeostream::operator<< | ( | const char * | s | ) | [virtual] |
Stores the null-terminated character string starting at s to the output stream.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::operator<< | ( | wchar_t | wc | ) | [virtual] |
Stores the wchar_t
wc to the output stream in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::operator<< | ( | long double | ) | [inline, virtual] |
RWInternalErr | is thrown. This function is not supported with endian streams. |
long double
type. Reimplemented from RWbostream.
virtual RWvostream& RWeostream::operator<< | ( | long long | i | ) | [virtual] |
Stores the long long
i to the output stream in binary, using the appropriate endian representation.
long long
type. Reimplemented from RWbostream.
virtual RWvostream& RWeostream::operator<< | ( | unsigned long long | i | ) | [virtual] |
Stores the unsigned long long
i to the output stream in binary, using the appropriate endian representation.
unsigned long long
type. Reimplemented from RWbostream.
virtual RWvostream& RWeostream::operator<< | ( | float | f | ) | [virtual] |
Stores the float
f to the output stream in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::operator<< | ( | double | d | ) | [virtual] |
Stores the double
d to the output stream in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::operator<< | ( | unsigned short | i | ) | [virtual] |
Stores the unsigned short
i to the output stream in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::operator<< | ( | short | i | ) | [virtual] |
Stores the short
i to the output stream in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::operator<< | ( | unsigned long | i | ) | [virtual] |
Stores the unsigned long
i to the output stream in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::operator<< | ( | long | i | ) | [virtual] |
Stores the long
i to the output stream in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::operator<< | ( | int | i | ) | [virtual] |
Stores the int
i to the output stream in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::operator<< | ( | unsigned int | i | ) | [virtual] |
Stores the unsigned int
i to the output stream in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::operator<< | ( | unsigned char | c | ) | [inline, virtual] |
Stores the unsigned char
c to the output stream in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::operator<< | ( | char | c | ) | [inline, virtual] |
Stores the char
c to the output stream.
Reimplemented from RWbostream.
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 in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::put | ( | const long double * | , | |
size_t | ||||
) | [inline, virtual] |
RWInternalErr | is thrown. This function is not supported with endian streams. |
long double
type. Reimplemented from RWbostream.
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 in binary, using the appropriate endian representation.
unsigned long long
type. Reimplemented from RWbostream.
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 in binary, using the appropriate endian representation.
long long
type. Reimplemented from RWbostream.
virtual RWvostream& RWeostream::put | ( | const double * | v, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N double
starting at v to the output stream in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
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.
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 in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::put | ( | const long * | v, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N long
starting at v to the output stream in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
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 in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::put | ( | const int * | v, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N int
starting at v to the output stream in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
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 in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::put | ( | const short * | v, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N short
starting at v to the output stream in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::put | ( | wchar_t | wc | ) | [inline, virtual] |
Stores the wchar_t
wc
to the output stream in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::put | ( | const unsigned char * | v, | |
size_t | N | |||
) | [inline, virtual] |
Stores the vector of N unsigned char
starting at v to the output stream in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::put | ( | unsigned char | c | ) | [inline, virtual] |
Stores the char
c to the output stream.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::put | ( | const char * | v, | |
size_t | N | |||
) | [inline, virtual] |
Stores the vector of N char
starting at v to the output stream in binary.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::put | ( | char | c | ) | [inline, virtual] |
Stores the char
c to the output stream.
Reimplemented from RWbostream.
virtual RWvostream& RWeostream::putSizeT | ( | size_t | sz | ) | [virtual] |
Stores the size_t
sz to the output stream in binary, using the appropriate endian representation.
Reimplemented from RWbostream.
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 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.