RWvistreamRWiosRWvios RWbistream ios
Member Functions | |||
get() |
getString() |
operator void*() |
operator>>() |
#include <rw/bstream.h> RWbistream bstr(cin); // Construct an RWbistream, // using cin's streambuf
Class RWbistream specializes the abstract base class RWvistream to restore variables stored in binary format by RWbostream.
You can think of RWbistream as a binary veneer over an associated streambuf. Because the RWbistream retains no information about the state of its associated streambuf, its use can be freely exchanged with other users of the streambuf, such as an istream or ifstream.
RWbistream can be interrogated as to the stream state using member functions good(), bad(), eof(), and so on.
See RWbostream for an example of how the file "data.dat" can be created.
#include <rw/bstream.h> #include <fstream.h> main(){ ifstream fstr("data.dat"); // Open an input file RWbistream bstr(fstr); // Construct RWbistream from it int i; float f; double d; bstr >> i; // Restore an int that was stored in binary bstr >> f >> d; // Restore a float and double }
RWbistream(streambuf* s);
Constructs an RWbistream from the streambuf s. For DOS, this streambuf must have been opened in binary mode.
RWbistream(istream& str);
Constructs an RWbistream using the streambuf associated with the istream str. For DOS, the streambuf must have been opened in binary mode. This can be done by specifying ios::binary as part of the second argument to the constructor for an ifstream. Using the example above, the line to create the ifstream would read:
ifstream fstr("data.dat", ios::in | ios::binary);
where | is the binary OR operator.
virtual RWvistream& operator>>(char& c);
Redefined from class RWvistream. Gets the next char from the input stream and stores it in c.
virtual RWvistream& operator>>(wchar_t& wc);
Redefined from class RWvistream. Gets the next wide char from the input stream and stores it in wc.
virtual RWvistream& operator>>(double& d);
Redefined from class RWvistream. Gets the next double from the input stream and stores it in d.
virtual RWvistream& operator>>(float& f);
Redefined from class RWvistream. Gets the next float from the input stream and stores it in f.
virtual RWvistream& operator>>(int& i);
Redefined from class RWvistream. Gets the next int from the input stream and stores it in i.
virtual RWvistream& operator>>(long& l);
Redefined from class RWvistream. Gets the next long from the input stream and store it in l.
virtual RWvistream& operator>>(short& s);
Redefined from class RWvistream. Gets the next short from the input stream and stores it in s.
virtual RWvistream& operator>>(unsigned char& c);
Redefined from class RWvistream. Gets the next unsigned char from the input stream and store it in c.
virtual RWvistream& operator>>(unsigned short& s);
Redefined from class RWvistream. Gets the next unsigned short from the input stream and stores it in s.
virtual RWvistream& operator>>(unsigned int& i);
Redefined from class RWvistream. Gets the next unsigned int from the input stream and store it in i.
virtual RWvistream& operator>>(unsigned long& l);
Redefined from class RWvistream. Gets the next unsigned long from the input stream and stores it in l.
operator void*();
Inherited via RWvistream from RWvios.
virtual int get();
Redefined from class RWvistream. Gets and returns the next char from the input stream. Returns EOF if the end of file is encountered.
virtual RWvistream& get(char& c);
Redefined from class RWvistream. Gets the next char and stores it in c.
virtual RWvistream& get(wchar_t& wc);
Redefined from class RWvistream. Get the next wide char and stores it in wc.
virtual RWvistream& get(unsigned char& c);
Redefined from class RWvistream. Gets the next unsigned char and stores it in c.
virtual RWvistream& get(char* v, size_t N);
Redefined from class RWvistream. Gets a vector of chars and stores them in the array beginning at v. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason, get stores what was already retrieved from the stream into v, and sets the failbit.
virtual RWvistream& get(wchar_t* v, size_t N);
Redefined from class RWvistream. Gets a vector of wide chars and stores them in the array beginning at v. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason, get stores what was already retrieved from the stream into v, and sets the failbit.
virtual RWvistream& get(double* v, size_t N);
Redefined from class RWvistream. Gets a vector of doubles and stores them in the array beginning at v. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason, get stores what was already retrieved from the stream into v, and sets the failbit.
virtual RWvistream& get(float* v, size_t N);
Redefined from class RWvistream. Gets a vector of floats and stores them in the array beginning at v. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason, get stores what was already retrieved from the stream into v, and sets the failbit.
virtual RWvistream& get(int* v, size_t N);
Redefined from class RWvistream. Gets a vector of ints and stores them in the array beginning at v. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason, get stores what has already been retrieved from the stream into v, and sets the failbit.
virtual RWvistream& get(long* v, size_t N);
Redefined from class RWvistream. Gets a vector of longs and stores them in the array beginning at v. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason, get stores what was already retrieved from the stream into v, and sets the failbit.
virtual RWvistream& get(short* v, size_t N);
Redefined from class RWvistream. Gets a vector of shorts and stores them in the array beginning at v. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason, get stores what was already retrieved from the stream into v, and sets the failbit.
virtual RWvistream& get(unsigned char* v, size_t N);
Redefined from class RWvistream. Gets a vector of unsigned chars and stores them in the array beginning at v. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason, get stores what was already retrieved from the stream into v, and sets the failbit.
virtual RWvistream& get(unsigned short* v, size_t N);
Redefined from class RWvistream. Gets a vector of unsigned shorts and stores them in the array beginning at v. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason, get stores what was already retrieved from the stream into v, and sets the failbit.
virtual RWvistream& get(unsigned int* v, size_t N);
Redefined from class RWvistream. Gets a vector of unsigned ints and stores them in the array beginning at v. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason, get stores what was already retrieved from the stream into v, and sets the failbit.
virtual RWvistream& get(unsigned long* v, size_t N);
Redefined from class RWvistream. Gets a vector of unsigned longs and stores them in the array beginning at v. If the restore operation stops prematurely, because there are no more data available on the stream, because an exception is thrown, or for some other reason, get stores what was already retrieved from the stream into v, and sets the failbit.
virtual RWvistream& getString(char* s, size_t N);
Redefined from class RWvistream. Restores a character string from the input stream and stores it in the array beginning at s. The function stops reading at the end of the string or after N-1 characters, whichever comes first. If N-1 characters are read and the Nth character is not the string terminator, the failbit of the stream is set. In either case, the string is terminated with a null byte.
virtual RWvistream& getString(wchar_t* ws, size_t N);
Redefined from class RWvistream. Restores a wide character string from the input stream and stores it in the array beginning at ws. The function stops reading at the end of the string or after N-1 characters, whichever comes first. If N-1 characters are read and the Nth character is not the string terminator, the failbit of the stream is set. In either case, the string is terminated with a null byte.
©Copyright 1999, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.