SourcePro C++ 12.0 |
SourcePro® C++ API Reference Guide |
SourcePro C++ Documentation Home |
Stores variables in binary format. More...
#include <rw/bstream.h>
Public Member Functions | |
RWbostream (std::ostream &str) | |
RWbostream (std::streambuf *s) | |
virtual | ~RWbostream () |
virtual int | eof () |
virtual int | fail () |
virtual int | bad () |
virtual int | good () |
virtual int | rdstate () |
virtual void | clear (int v=0) |
operator void * () | |
virtual RWvostream & | putString (const char *s, size_t N) |
virtual RWvostream & | operator<< (const char *s) |
virtual RWvostream & | operator<< (char c) |
virtual RWvostream & | operator<< (wchar_t wc) |
virtual RWvostream & | operator<< (unsigned char c) |
virtual RWvostream & | operator<< (long double d) |
virtual RWvostream & | operator<< (long long i) |
virtual RWvostream & | operator<< (unsigned long long i) |
virtual RWvostream & | operator<< (double d) |
virtual RWvostream & | operator<< (float f) |
virtual RWvostream & | operator<< (int i) |
virtual RWvostream & | operator<< (unsigned 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 & | flush () |
virtual RWvostream & | put (char c) |
virtual RWvostream & | put (const char *v, size_t N) |
virtual RWvostream & | put (wchar_t wc) |
virtual RWvostream & | put (const wchar_t *v, size_t N) |
virtual RWvostream & | put (unsigned char c) |
virtual RWvostream & | put (const unsigned char *v, 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 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 & | putSizeT (size_t sz) |
Class RWbostream specializes the abstract base class RWvostream to store variables in binary format. The results can be restored by using its counterpart RWbistream.
You can think of it as a binary veneer over an associated std::streambuf. Because the RWbostream retains no information about the state of its associated std::streambuf, its use can be freely exchanged with other users of the std::streambuf (such as std::ostream or std::ofstream).
RWbostream can be interrogated as to the stream state using member functions good(), bad(), eof(), etc.
#include <rw/bstream.h> RWbostream bstr(std::cout); // Construct an RWbostream using cout's streambuf
None
#include <iostream> #include <fstream> #include <rw/bstream.h> int main() { // Open an output file std::ofstream fstr ("data.dat"); // Construct a RWbostream from it RWbostream bstr (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 RWbostream!\n"; // Store a float & double bstr << i << f << d; return 0; }
Program output:
An integer, a float and a double sent out on an RWbostream!
RWbostream::RWbostream | ( | std::ostream & | str | ) |
Constructs an RWbostream from the std::streambuf associated with the std::ostream str. For DOS, the std::streambuf must have been opened in binary mode.
RWbostream::RWbostream | ( | std::streambuf * | s | ) |
Constructs an RWbostream from the std::streambuf s. For DOS, the std::streambuf must have been opened in binary mode.
virtual RWbostream::~RWbostream | ( | ) | [virtual] |
Empty Destructor.
virtual int RWbostream::bad | ( | ) | [inline, virtual] |
Returns a nonzero integer if the bad bit has been set. Normally this indicates that a severe error has occurred from which recovery is probably impossible.
Implements RWvostream.
virtual void RWbostream::clear | ( | int | v = 0 |
) | [inline, virtual] |
Sets the current error state to v. If v is zero, then this clears the error state.
Implements RWvostream.
virtual int RWbostream::eof | ( | ) | [inline, virtual] |
Returns a nonzero integer if an EOF
is encountered.
Implements RWvostream.
virtual int RWbostream::fail | ( | ) | [inline, virtual] |
Returns a nonzero integer if the failed or bad bit has been set. Normally, this indicates that some storage or retrieval has failed, but that the stream is still in a usable state.
Implements RWvostream.
virtual RWvostream& RWbostream::flush | ( | ) | [virtual] |
Sends the contents of the stream buffer to the output immediately.
Implements RWvostream.
virtual int RWbostream::good | ( | ) | [inline, virtual] |
Returns a nonzero integer if no error bits have been set.
Implements RWvostream.
RWbostream::operator void * | ( | ) | [inline] |
virtual RWvostream& RWbostream::operator<< | ( | unsigned short | i | ) | [virtual] |
Stores the unsigned short
i to the output stream in binary.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::operator<< | ( | short | i | ) | [virtual] |
Stores the short
i to the output stream in binary.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::operator<< | ( | unsigned long | i | ) | [virtual] |
Stores the unsigned long
i to the output stream in binary.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::operator<< | ( | long | i | ) | [virtual] |
Stores the long
i to the output stream in binary.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::operator<< | ( | unsigned int | i | ) | [virtual] |
virtual RWvostream& RWbostream::operator<< | ( | int | i | ) | [virtual] |
Stores the int
i to the output stream in binary.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::operator<< | ( | float | f | ) | [virtual] |
Stores the float
f to the output stream in binary.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::operator<< | ( | double | d | ) | [virtual] |
Stores the double
d to the output stream in binary.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::operator<< | ( | unsigned long long | i | ) | [virtual] |
Stores the unsigned long long
i to the output stream in binary.
unsigned long long
type. Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::operator<< | ( | long long | i | ) | [virtual] |
Stores the long long
i to the output stream in binary.
long long
type. Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::operator<< | ( | long double | d | ) | [virtual] |
Stores the long double
d to the output stream in binary.
long double
type. Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::operator<< | ( | unsigned char | c | ) | [virtual] |
Stores the unsigned char
c to the output stream in binary.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::operator<< | ( | wchar_t | wc | ) | [virtual] |
Stores the wchar_t
wc to the output stream in binary.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::operator<< | ( | char | c | ) | [virtual] |
Stores the char
c to the output stream in binary.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::operator<< | ( | const char * | s | ) | [virtual] |
Stores the null terminated character string starting at s to the output stream in binary.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::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.
unsigned long long
type. Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::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.
long long
type. Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::put | ( | const long double * | v, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N long double
starting at v to the output stream in binary.
long double
type. Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::put | ( | const double * | v, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N double
starting at v to the output stream in binary.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::put | ( | const float * | v, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N float
starting at v to the output stream in binary.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::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.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::put | ( | const long * | v, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N long
starting at v to the output stream in binary.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::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.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::put | ( | const int * | v, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N int
starting at v to the output stream in binary.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::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.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::put | ( | const short * | v, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N short
starting at v to the output stream in binary.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::put | ( | const unsigned char * | v, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N unsigned char
starting at v to the output stream in binary.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::put | ( | unsigned char | c | ) | [virtual] |
Stores the char
c to the output stream, preserving its value.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::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.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::put | ( | wchar_t | wc | ) | [virtual] |
Stores the wchar_t
wc
to the output stream, preserving its value.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::put | ( | const char * | v, | |
size_t | N | |||
) | [virtual] |
Stores the vector of N
char
starting at v to the output stream in binary.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::put | ( | char | c | ) | [virtual] |
Stores the char
c to the output stream, preserving its value.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::putSizeT | ( | size_t | sz | ) | [virtual] |
Store the size_t
sz to the output stream in binary.
Implements RWvostream.
Reimplemented in RWeostream.
virtual RWvostream& RWbostream::putString | ( | const char * | s, | |
size_t | N | |||
) | [virtual] |
Stores the character string, including embedded nulls, starting at s to the output stream.
Implements RWvostream.
Reimplemented in RWeostream.
virtual int RWbostream::rdstate | ( | ) | [inline, virtual] |
Returns the current error state.
Implements RWvostream.
© 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.