Rogue Wave Software logo banner

Click on the banner to return to the Class Reference home page.

©Copyright 1996 Rogue Wave Software

RWvistream


RWvistreaminherits fromRWvios

Synopsis

#include <rw/vstream.h>

Description

Class RWvistream is an abstract base class. It provides an interface for format-independent retrieval of fundamental types and arrays of fundamental types. Its counterpart, RWvostream, provides a complementary interface for the storage of the fundamental types.

Because the interface of RWvistream and RWvostream is independent of formatting, the user of these classes need not be concerned with how variables will actually be stored or restored. That will be up to the derived class to decide. It might be done using an operating-system independent ASCII format (classes RWpistream and RWpostream), a binary format (classes RWbistream and RWbostream), or the user could define his or her own format (e.g., an interface to a network). Note that because it is an abstract base class, there is no way to actually enforce these goals -- the description here is merely the model of how a class derived from RWvistream and RWvostream should act.

See class RWvostream for additional explanations and examples of format-independent stream storage.

Persistence

None

Example

#include <rw/vstream.h>
void restoreStuff( RWvistream& str) {
   int i;
   double d;
   char string[80];
   str >> i;  // Restore an int
   str >> d;  // Restore a double
   // Restore a character string, up to 80 characters long:
   str.getString(string, sizeof(string));

   if(str.fail()) cerr << "Oh, oh, bad news.\n";
}

Public Destructor

virtual ~RWvistream();




Public Operators

virtual RWvistream&
operator>>(char& c) = 0;
virtual RWvistream&
operator>>(wchar_t& wc) = 0;
virtual RWvistream&
operator>>(double& d) = 0;
virtual RWvistream&
operator>>(float& f) = 0;
virtual RWvistream&
operator>>(int& i) = 0;
virtual RWvistream&
operator>>(long& l) = 0;
virtual RWvistream&
operator>>(short& s) = 0;
virtual RWvistream&
operator>>(unsigned char& c) = 0;
virtual RWvistream&
operator>>(unsigned short& s) = 0;
virtual RWvistream&
operator>>(unsigned int& i) = 0;
virtual RWvistream&
operator>>(unsigned long& l) = 0;
operator void*();

Public Member Functions

virtual int
get() = 0;
virtual RWvistream&
get(char& c) = 0;
virtual RWvistream&
get(wchar_t& wc) = 0;
virtual RWvistream&
get(unsigned char& c) = 0;
virtual RWvistream&
get(char* v, size_t N) = 0;
virtual RWvistream&
get(wchar_t* v, size_t N) = 0;
virtual RWvistream&
get(double* v, size_t N) = 0;
virtual RWvistream&
get(float* v, size_t N) = 0;
virtual RWvistream&
get(int* v, size_t N) = 0;
virtual RWvistream&
get(long* v, size_t N) = 0;
virtual RWvistream&
get(short* v, size_t N) = 0;
virtual RWvistream&
get(unsigned char* v, size_t N) = 0;
virtual RWvistream&
get(unsigned short* v, size_t N) = 0;
virtual RWvistream&
get(unsigned int* v, size_t N) = 0;
virtual RWvistream&
get(unsigned long* v, size_t N) = 0;
virtual RWvistream&
getString(char* s, size_t N) = 0;
virtual RWvistream&
getString(wchar_t* ws, size_t N) = 0;