OWLNext 7.0
Borland's Object Windows Library for the modern age
|
Base class for writing streamable objects. More...
#include <owl/objstrm.h>
Public Member Functions | |
opstream (std::streambuf *) | |
virtual | ~opstream () |
std::streampos | tellp () |
Returns the (absolute) current stream position. | |
opstream & | seekp (std::streampos) |
opstream & | seekp (std::streamoff, std::ios::seekdir) |
opstream & | flush () |
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 | |
opstream & | operator<< (opstream &, int8) |
opstream, a specialized derivative of pstream, is the base class for writing (inserting) streamable objects. | |
opstream & | operator<< (opstream &, uint8) |
This friend operator of opstream inserts (writes) the given argument to the given ipstream object. | |
opstream & | operator<< (opstream &, char) |
This friend operator of opstream inserts (writes) the given argument to the given ipstream object. | |
opstream & | operator<< (opstream &, signed short) |
This friend operator of opstream inserts (writes) the given argument to the given ipstream object. | |
opstream & | operator<< (opstream &, unsigned short) |
This friend operator of opstream inserts (writes) the given argument to the given ipstream object. | |
opstream & | operator<< (opstream &, signed int) |
This friend operator of opstream inserts (writes) the given argument to the given ipstream object. | |
opstream & | operator<< (opstream &, unsigned int) |
This friend operator of opstream inserts (writes) the given argument to the given ipstream object. | |
opstream & | operator<< (opstream &, bool) |
This friend operator of opstream inserts (writes) the given argument to the given ipstream object. | |
opstream & | operator<< (opstream &, signed long) |
This friend operator of opstream inserts (writes) the given argument to the given ipstream object. | |
opstream & | operator<< (opstream &, unsigned long) |
This friend operator of opstream inserts (writes) the given argument to the given ipstream object. | |
opstream & | operator<< (opstream &, int64) |
opstream & | operator<< (opstream &, uint64) |
opstream & | operator<< (opstream &, float) |
This friend operator of opstream inserts (writes) the given argument to the given ipstream object. | |
opstream & | operator<< (opstream &, double) |
This friend operator of opstream inserts (writes) the given argument to the given ipstream object. | |
opstream & | operator<< (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 |
owl::opstream::opstream | ( | std::streambuf * | ) |
|
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().
opstream & owl::opstream::flush | ( | ) |
Flushes the stream.
Definition at line 745 of file objstrm.cpp.
References owl::pstream::bp, and owl::pstream::clear().
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.
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().
opstream & owl::opstream::seekp | ( | std::streamoff | , |
std::ios::seekdir | ) |
References owl::GetModuleId().
opstream & owl::opstream::seekp | ( | std::streampos | ) |
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().
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().
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.
|
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().
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().
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().
|
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().
Writes str to the stream.
Definition at line 810 of file objstrm.cpp.
References owl::pstream::good(), writeBytes(), and writeWord32().
|
protected |
Definition at line 736 of file objstrm.cpp.
References owl::pstream::good(), writeByte(), and writeWord32().
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().
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().
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.