Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

opstream Class Reference

The base class for writing (inserting) streamable objects into streams. More...

#include <tobjstrm.h>

Inheritance diagram for opstream::

pstream iopstream ofpstream fpstream List of all members.

Public Methods

 opstream (streambuf *buf)
 ~opstream ()
streampos tellp ()
opstream& seekp (streampos pos)
opstream& seekp (streamoff off, ios::seek_dir dir)
opstream& flush ()
void writeByte (uchar ch)
void writeBytes (const void *data, size_t sz)
void writeWord (ushort us)
void writeString (const char *str)

Protected Methods

 opstream ()
void writePrefix (const TStreamable &)
void writeData (TStreamable &)
void writeSuffix (const TStreamable &)
P_id_type find (const void *adr)
void registerObject (const void *adr)

Friends

opstream& operator<< (opstream &, char)
opstream& operator<< (opstream &, signed char)
opstream& operator<< (opstream &, unsigned char)
opstream& operator<< (opstream &, signed short)
opstream& operator<< (opstream &, unsigned short)
opstream& operator<< (opstream &, signed int)
opstream& operator<< (opstream &, unsigned int)
opstream& operator<< (opstream &, signed long)
opstream& operator<< (opstream &, unsigned long)
opstream& operator<< (opstream &, float)
opstream& operator<< (opstream &, double)
opstream& operator<< (opstream &, long double)
opstream& operator<< (opstream &, TStreamable &)
opstream& operator<< (opstream &, TStreamable *)

Detailed Description

opstream, a specialized output stream derivative of pstream, is the base class for writing (inserting) streamable objects. opstream is analogous to ostream, defined in `iostream.h' for the standard C++ stream library. opstream is a friend class of TPWrittenObjects.

The overloaded operators << insert (write) the given argument to the given opstream object. A reference to the stream is returned, allowing you to chain << operations in the usual way. The data type of the argument determines the form of write operation employed. For example, writing a signed char is implemented using writeByte().

See also:
ipstream

Definition at line 750 of file tobjstrm.h.


Constructor & Destructor Documentation

opstream::opstream ( streambuf * buf )
 

This form creates a buffered opstream with the given buffer and sets the bp data member to `buf'. The state data member is set to 0.

opstream::~opstream ( )
 

Destroys the opstream object.

opstream::opstream ( ) [protected]
 

This form allocates a default buffer.


Member Function Documentation

P_id_type opstream::find ( const void * adr ) [protected]
 

Returns the type ID for the object ad address `adr'.

opstream & opstream::flush ( )
 

Flushes the stream.

void opstream::registerObject ( const void * adr ) [protected]
 

Registers the class of the object ad address `adr'.

opstream & opstream::seekp ( streamoff off,
ios::seek_dir dir )
 

This form moves to a position relative to the current position by an offset `off' (+ or -) starting at `dir'. Parameter `dir' can be set to:

 beg (start of stream)

 cur (current stream position)

 end (end of stream)
 

opstream & opstream::seekp ( streampos pos )
 

This form moves the stream's current position to the absolute position given by `pos'.

streampos opstream::tellp ( )
 

Returns the (absolute) current stream position.

void opstream::writeByte ( uchar ch )
 

Writes character `ch' to the stream.

void opstream::writeBytes ( const void * data,
size_t sz )
 

Writes `sz' bytes from `data' buffer to the stream.

void opstream::writeData ( TStreamable & ) [protected]
 

Writes data to the stream by calling the appropriate class's write member function for the object being written.

void opstream::writePrefix ( const TStreamable & ) [protected]
 

Writes the class name prefix to the stream.

The << operator uses this function to write a prefix and suffix around the data written with writeData(). The prefix/suffix is used to ensure type-safe stream I/O.

void opstream::writeString ( const char * str )
 

Writes `str' to the stream (together with a leading length byte).

void opstream::writeSuffix ( const TStreamable & ) [protected]
 

Writes the class name suffix to the stream.

The << operator uses this function to write a prefix and suffix around the data written with writeData(). The prefix/suffix is used to ensure type-safe stream I/O.

void opstream::writeWord ( ushort us )
 

Writes the word `us' to the stream.


Friends And Related Function Documentation

opstream & operator<< ( opstream &,
TStreamable * ) [friend]
 

Undocumented.

opstream & operator<< ( opstream &,
TStreamable & ) [friend]
 

Undocumented.

opstream & operator<< ( opstream &,
long double ) [friend]
 

Undocumented.

opstream & operator<< ( opstream &,
double ) [friend]
 

Undocumented.

opstream & operator<< ( opstream &,
float ) [friend]
 

Undocumented.

opstream & operator<< ( opstream &,
unsigned long ) [friend]
 

Undocumented.

opstream & operator<< ( opstream &,
signed long ) [friend]
 

Undocumented.

opstream & operator<< ( opstream &,
unsigned long ) [friend]
 

Undocumented.

opstream & operator<< ( opstream &,
signed long ) [friend]
 

Undocumented.

opstream & operator<< ( opstream &,
unsigned long ) [friend]
 

Undocumented.

opstream & operator<< ( opstream &,
signed long ) [friend]
 

Undocumented.

opstream & operator<< ( opstream &,
unsigned long ) [friend]
 

Undocumented.

opstream & operator<< ( opstream &,
signed long ) [friend]
 

Undocumented.

opstream & operator<< ( opstream &,
char ) [friend]
 

Undocumented.


The documentation for this class was generated from the following file:
Generated at Sat Sep 22 20:19:30 2001 for TVision by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001