OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::opstream Class Reference

Base class for writing streamable objects. More...

#include <owl/objstrm.h>

Inheritance diagram for owl::opstream:
owl::pstream owl::ofpstream

Public Member Functions

 opstream (std::streambuf *)
 
virtual ~opstream ()
 
std::streampos tellp ()
 Returns the (absolute) current stream position.
 
opstreamseekp (std::streampos)
 
opstreamseekp (std::streamoff, std::ios::seekdir)
 
opstreamflush ()
 Flushes the stream.
 
void writeByte (uint8)
 Writes the byte ch to the stream.
 
void writeBytes (const void *, size_t)
 Writes sz bytes from the data buffer to the stream.
 
void fwriteBytes (const void *data, size_t sz)
 Writes the specified number of bytes (sz) from the supplied buffer (data) to the stream.
 
void writeWord (uint32)
 Writes the 32-bit word us to the stream.
 
void writeWord16 (uint16)
 Writes the 16-bit word us to the stream.
 
void writeWord32 (uint32)
 Writes the 32-bit word us to the stream.
 
void writeString (const char *)
 Writes str to the stream.
 
void fwriteString (const char *str)
 Writes the specified far character string (str) to the stream.
 
void writeObject (const TStreamableBase *t, int isPtr=0, ModuleId mid=GetModuleId())
 Writes the object, pointed to by t, to the output stream.
 
void writeObjectPointer (const TStreamableBase *t, ModuleId mid=GetModuleId())
 Writes the object pointer t to the output stream.
 
P_id_type findObject (TStreamableBase *adr)
 Returns the type ID for the object pointed to by adr.
 
void registerObject (TStreamableBase *adr)
 Registers the class of the object pointed to by adr.
 
P_id_type findVB (TStreamableBase *adr)
 Returns a pointer to the virtual base.
 
void registerVB (TStreamableBase *adr)
 Registers a virtual base class.
 
- Public Member Functions inherited from owl::pstream
 pstream (std::streambuf *)
 Creates a buffered pstream with the given buffer. The state is set to 0.
 
virtual ~pstream ()
 
int rdstate () const
 Returns the current state value.
 
int eof () const
 Returns nonzero on end of stream.
 
int fail () const
 Returns nonzero if a previous stream operation failed.
 
int bad () const
 Returns nonzero if an error occurs.
 
int good () const
 Returns nonzero if no error states have been recorded for the stream (that is, no errors have occurred).
 
void clear (int=0)
 Sets the stream state to the given value (defaults to 0).
 
 operator void * () const
 Converts to a void pointer.
 
int operator! () const
 Overloads the NOT operator.
 
std::streambuf * rdbuf () const
 Returns the pb pointer to the buffer assigned to the stream.
 

Protected Member Functions

 opstream ()
 Creates a buffered opstream with the given buffer and sets the bp data member to buf.
 
void writePrefix (const TStreamableBase *)
 Writes the class name prefix to the stream.
 
void writeData (const TStreamableBase *, ModuleId mid)
 Writes data to the stream by calling the write member function of the appropriate class for the object being written.
 
void writeSuffix (const TStreamableBase *)
 Writes the class name suffix to the stream.
 
void writeVersion ()
 
- Protected Member Functions inherited from owl::pstream
 pstream ()
 Creates a pstream without initializing the buffer pointer bp or state.
 
void init (std::streambuf *)
 The init member function initializes the stream and sets state to 0 and bp to sbp.
 
void setstate (int)
 Updates the state data member with state |= (b & 0xFF).
 

Friends

opstreamoperator<< (opstream &, int8)
 opstream, a specialized derivative of pstream, is the base class for writing (inserting) streamable objects.
 
opstreamoperator<< (opstream &, uint8)
 This friend operator of opstream inserts (writes) the given argument to the given ipstream object.
 
opstreamoperator<< (opstream &, char)
 This friend operator of opstream inserts (writes) the given argument to the given ipstream object.
 
opstreamoperator<< (opstream &, signed short)
 This friend operator of opstream inserts (writes) the given argument to the given ipstream object.
 
opstreamoperator<< (opstream &, unsigned short)
 This friend operator of opstream inserts (writes) the given argument to the given ipstream object.
 
opstreamoperator<< (opstream &, signed int)
 This friend operator of opstream inserts (writes) the given argument to the given ipstream object.
 
opstreamoperator<< (opstream &, unsigned int)
 This friend operator of opstream inserts (writes) the given argument to the given ipstream object.
 
opstreamoperator<< (opstream &, bool)
 This friend operator of opstream inserts (writes) the given argument to the given ipstream object.
 
opstreamoperator<< (opstream &, signed long)
 This friend operator of opstream inserts (writes) the given argument to the given ipstream object.
 
opstreamoperator<< (opstream &, unsigned long)
 This friend operator of opstream inserts (writes) the given argument to the given ipstream object.
 
opstreamoperator<< (opstream &, int64)
 
opstreamoperator<< (opstream &, uint64)
 
opstreamoperator<< (opstream &, float)
 This friend operator of opstream inserts (writes) the given argument to the given ipstream object.
 
opstreamoperator<< (opstream &, double)
 This friend operator of opstream inserts (writes) the given argument to the given ipstream object.
 
opstreamoperator<< (opstream &, long double)
 This friend operator of opstream inserts (writes) the given argument to the given ipstream object.
 

Additional Inherited Members

- Public Types inherited from owl::pstream
enum  PointerTypes { ptNull , ptIndexed , ptObject }
 Enumerates object pointer types. More...
 
- Protected Attributes inherited from owl::pstream
std::streambuf * bp
 
int state
 

Detailed Description

Base class for writing streamable objects.

Definition at line 480 of file objstrm.h.

Constructor & Destructor Documentation

◆ opstream() [1/2]

owl::opstream::opstream ( std::streambuf * )

◆ opstream() [2/2]

owl::opstream::opstream ( )
protected

Creates a buffered opstream with the given buffer and sets the bp data member to buf.

The state is set to 0.

Definition at line 668 of file objstrm.cpp.

References owl::pstream::bp, and writeVersion().

Member Function Documentation

◆ flush()

opstream & owl::opstream::flush ( )

Flushes the stream.

Definition at line 745 of file objstrm.cpp.

References owl::pstream::bp, and owl::pstream::clear().

◆ fwriteBytes()

void owl::opstream::fwriteBytes ( const void * data,
size_t sz )

Writes the specified number of bytes (sz) from the supplied buffer (data) to the stream.

Definition at line 794 of file objstrm.cpp.

References owl::pstream::bp, owl::pstream::clear(), owl::pstream::good(), and PRECONDITION.

◆ fwriteString()

void owl::opstream::fwriteString ( const char * str)

Writes the specified far character string (str) to the stream.

Definition at line 825 of file objstrm.cpp.

References fwriteBytes(), owl::pstream::good(), and writeWord32().

◆ seekp() [1/2]

opstream & owl::opstream::seekp ( std::streamoff ,
std::ios::seekdir  )

References owl::GetModuleId().

◆ seekp() [2/2]

opstream & owl::opstream::seekp ( std::streampos )

◆ tellp()

streampos owl::opstream::tellp ( )

Returns the (absolute) current stream position.

Definition at line 685 of file objstrm.cpp.

References owl::pstream::bp, owl::pstream::clear(), and owl::pstream::good().

◆ writeByte()

void owl::opstream::writeByte ( uint8 ch)

Writes the byte ch to the stream.

Definition at line 753 of file objstrm.cpp.

References owl::pstream::bp, owl::pstream::clear(), and owl::pstream::good().

◆ writeBytes()

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

Writes sz bytes from the data buffer to the stream.

Definition at line 762 of file objstrm.cpp.

References owl::pstream::bp, owl::pstream::clear(), owl::pstream::good(), and PRECONDITION.

◆ writeData()

void owl::opstream::writeData ( const TStreamableBase * t,
ModuleId mid )
protected

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

Definition at line 893 of file objstrm.cpp.

References _A2W, _OBJ_FULLTYPENAME, _OBJ_TYPENAME, _USES_CONVERSION, CHECKX, CONST_CAST, owl::pstream::good(), registerObject(), and writeWord32().

◆ writeObject()

void owl::opstream::writeObject ( const TStreamableBase * t,
int isPtr = 0,
ModuleId mid = GetModuleId() )

Writes the object, pointed to by t, to the output stream.

The isPtrargument indicates whether the object was allocated from the heap.

Definition at line 844 of file objstrm.cpp.

References _A2W, _OBJ_FULLTYPENAME, _T, _USES_CONVERSION, CONST_CAST, findObject(), owl::pstream::good(), WARNX, writeData(), writePrefix(), and writeSuffix().

◆ writeObjectPointer()

void owl::opstream::writeObjectPointer ( const TStreamableBase * t,
ModuleId mid = GetModuleId() )

Writes the object pointer t to the output stream.

Definition at line 863 of file objstrm.cpp.

References CONST_CAST, findObject(), owl::pstream::good(), owl::pstream::ptIndexed, owl::pstream::ptNull, owl::pstream::ptObject, writeByte(), writeObject(), and writeWord().

◆ writePrefix()

void owl::opstream::writePrefix ( const TStreamableBase * t)
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.

Definition at line 883 of file objstrm.cpp.

References _OBJ_TYPENAME, owl::pstream::good(), writeByte(), and writeString().

◆ writeString()

void owl::opstream::writeString ( const char * str)

Writes str to the stream.

Definition at line 810 of file objstrm.cpp.

References owl::pstream::good(), writeBytes(), and writeWord32().

◆ writeVersion()

void owl::opstream::writeVersion ( )
protected

Definition at line 736 of file objstrm.cpp.

References owl::pstream::good(), writeByte(), and writeWord32().

◆ writeWord16()

void owl::opstream::writeWord16 ( uint16 word16)

Writes the 16-bit word us to the stream.

Definition at line 773 of file objstrm.cpp.

References owl::pstream::bp, owl::pstream::clear(), and owl::pstream::good().

◆ writeWord32()

void owl::opstream::writeWord32 ( uint32 word32)

Writes the 32-bit word us to the stream.

Definition at line 783 of file objstrm.cpp.

References owl::pstream::bp, owl::pstream::clear(), and owl::pstream::good().

Friends And Related Symbol Documentation

◆ operator<< [1/15]

opstream & operator<< ( opstream & ps,
bool b )
friend

This friend operator of opstream inserts (writes) the given argument to the given ipstream object.

The data type of the argument determines the form of write operation employed.

Definition at line 1145 of file objstrm.h.

◆ operator<< [2/15]

opstream & operator<< ( opstream & ps,
char ch )
friend

This friend operator of opstream inserts (writes) the given argument to the given ipstream object.

The data type of the argument determines the form of write operation employed.

Definition at line 1053 of file objstrm.h.

◆ operator<< [3/15]

opstream & operator<< ( opstream & ps,
double d )
friend

This friend operator of opstream inserts (writes) the given argument to the given ipstream object.

The data type of the argument determines the form of write operation employed.

Definition at line 1129 of file objstrm.h.

◆ operator<< [4/15]

opstream & operator<< ( opstream & ps,
float f )
friend

This friend operator of opstream inserts (writes) the given argument to the given ipstream object.

The data type of the argument determines the form of write operation employed.

Definition at line 1121 of file objstrm.h.

◆ operator<< [5/15]

opstream & operator<< ( opstream & ps,
int64 v )
friend

Definition at line 1106 of file objstrm.h.

◆ operator<< [6/15]

opstream & operator<< ( opstream & ps,
int8 ch )
friend

opstream, a specialized derivative of pstream, is the base class for writing (inserting) streamable objects.

This friend operator of opstream inserts (writes) the given argument to the given ipstream object.

The data type of the argument determines the form of write operation employed.

Definition at line 1037 of file objstrm.h.

◆ operator<< [7/15]

opstream & operator<< ( opstream & ps,
long double l )
friend

This friend operator of opstream inserts (writes) the given argument to the given ipstream object.

The data type of the argument determines the form of write operation employed.

Definition at line 1137 of file objstrm.h.

◆ operator<< [8/15]

opstream & operator<< ( opstream & ps,
signed int i )
friend

This friend operator of opstream inserts (writes) the given argument to the given ipstream object.

The data type of the argument determines the form of write operation employed.

Definition at line 1077 of file objstrm.h.

◆ operator<< [9/15]

opstream & operator<< ( opstream & ps,
signed long l )
friend

This friend operator of opstream inserts (writes) the given argument to the given ipstream object.

The data type of the argument determines the form of write operation employed.

Definition at line 1093 of file objstrm.h.

◆ operator<< [10/15]

opstream & operator<< ( opstream & ps,
signed short sh )
friend

This friend operator of opstream inserts (writes) the given argument to the given ipstream object.

The data type of the argument determines the form of write operation employed.

Definition at line 1061 of file objstrm.h.

◆ operator<< [11/15]

opstream & operator<< ( opstream & ps,
uint64 v )
friend

Definition at line 1112 of file objstrm.h.

◆ operator<< [12/15]

opstream & operator<< ( opstream & ps,
uint8 ch )
friend

This friend operator of opstream inserts (writes) the given argument to the given ipstream object.

The data type of the argument determines the form of write operation employed.

Definition at line 1045 of file objstrm.h.

◆ operator<< [13/15]

opstream & operator<< ( opstream & ps,
unsigned int i )
friend

This friend operator of opstream inserts (writes) the given argument to the given ipstream object.

The data type of the argument determines the form of write operation employed.

Definition at line 1085 of file objstrm.h.

◆ operator<< [14/15]

opstream & operator<< ( opstream & ps,
unsigned long l )
friend

This friend operator of opstream inserts (writes) the given argument to the given ipstream object.

The data type of the argument determines the form of write operation employed.

Definition at line 1101 of file objstrm.h.

◆ operator<< [15/15]

opstream & operator<< ( opstream & ps,
unsigned short sh )
friend

This friend operator of opstream inserts (writes) the given argument to the given ipstream object.

The data type of the argument determines the form of write operation employed.

Definition at line 1069 of file objstrm.h.


The documentation for this class was generated from the following files: