OWLNext 7.0
Borland's Object Windows Library for the modern age
|
ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting) streamable objects. More...
#include <owl/objstrm.h>
Public Member Functions | |
ipstream (std::streambuf *) | |
Creates a buffered ipstream with the given buffer. The state is set to 0. | |
std::streampos | tellg () |
Returns the (absolute) current stream position. | |
ipstream & | seekg (std::streampos) |
ipstream & | seekg (std::streamoff, std::ios::seekdir) |
uint8 | readByte () |
Returns the byte at the current stream position. | |
void | readBytes (void *, size_t) |
Reads sz bytes from current stream position, and writes them to data. | |
void | freadBytes (void *data, size_t sz) |
Reads the number of bytes specified by sz into the supplied buffer (data). | |
uint32 | readWord () |
Returns the word at the current stream position. | |
uint16 | readWord16 () |
Returns the 16-bit word at the current stream position. | |
uint32 | readWord32 () |
Returns the 32-bit word at the current stream position. | |
LPSTR | readString () |
Allocates a buffer large enough to contain the string at the current stream position and reads the string into the buffer. | |
LPSTR | readString (LPSTR, unsigned) |
Reads the string at the current stream position into the buffer specified by buf. | |
char * | freadString () |
Reads a string from the stream. | |
char * | freadString (char *buf, unsigned maxLen) |
Reads a string from the stream into the supplied far buffer (buf). | |
uint32 | getVersion () const |
Returns the object version number. | |
TStreamableBase * | readObject (TStreamableBase *&mem, ModuleId mid=GetModuleId()) |
TStreamableBase * | readObjectPointer (TStreamableBase *&mem, ModuleId mid=GetModuleId()) |
TStreamableBase * | find (P_id_type) |
Returns a pointer to the object corresponding to Id. | |
void | registerObject (TStreamableBase *adr) |
Registers the object pointed to by adr. | |
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 | |
ipstream () | |
Creates a buffered ipstream without initializing the buffer pointer, bp. | |
const ObjectBuilder * | readPrefix (ModuleId mid) |
Returns the TStreamableClass object corresponding to the class name stored at the current position in the stream. | |
void | readData (const ObjectBuilder *, TStreamableBase *&) |
If mem is 0, it calls the appropriate build function to allocate memory and initialize the virtual table pointer for the object. | |
void | readSuffix () |
Reads and checks the suffix of the object. | |
void | readVersion () |
Reads the version number of the input stream. | |
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 | |
class | TStreamableClass |
ipstream & | operator>> (ipstream &, int8 &) |
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument. | |
ipstream & | operator>> (ipstream &, uint8 &) |
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument. | |
ipstream & | operator>> (ipstream &, char &) |
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument. | |
ipstream & | operator>> (ipstream &, signed short &) |
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument. | |
ipstream & | operator>> (ipstream &, unsigned short &) |
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument. | |
ipstream & | operator>> (ipstream &, signed int &) |
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument. | |
ipstream & | operator>> (ipstream &, unsigned int &) |
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument. | |
ipstream & | operator>> (ipstream &, bool &) |
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument. | |
ipstream & | operator>> (ipstream &, signed long &) |
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument. | |
ipstream & | operator>> (ipstream &, unsigned long &) |
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument. | |
ipstream & | operator>> (ipstream &, int64 &) |
ipstream & | operator>> (ipstream &, uint64 &) |
ipstream & | operator>> (ipstream &, float &) |
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument. | |
ipstream & | operator>> (ipstream &, double &) |
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument. | |
ipstream & | operator>> (ipstream &, long double &) |
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument. | |
ipstream & | operator>> (ipstream &, tstring &) |
This operator of ipstream extracts (reads) from the ipstream is, to the string str. | |
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 |
ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting) streamable objects.
Reads the number of bytes specified by sz into the supplied buffer (data).
Definition at line 393 of file objstrm.cpp.
References owl::pstream::bp, owl::pstream::clear(), owl::pstream::good(), and PRECONDITION.
char * owl::ipstream::freadString | ( | ) |
Reads a string from the stream.
It determines the length of the string and allocates a character array of the appropriate length. It reads the string into this array and returns a pointer to the string. The caller is expected to free the allocated memory block.
Definition at line 503 of file objstrm.cpp.
References freadBytes(), and owl::pstream::good().
Reads a string from the stream into the supplied far buffer (buf).
If the length of the string is greater than maxLen-1, it reads nothing. Otherwise, it reads the string into the buffer and appends a null-terminating byte.
Definition at line 522 of file objstrm.cpp.
References freadBytes(), owl::pstream::good(), and PRECONDITION.
uint8 owl::ipstream::readByte | ( | ) |
Returns the byte at the current stream position.
Definition at line 368 of file objstrm.cpp.
References owl::pstream::bp, owl::pstream::clear(), and owl::pstream::good().
Reads sz bytes from current stream position, and writes them to data.
Definition at line 382 of file objstrm.cpp.
References owl::pstream::bp, owl::pstream::clear(), owl::pstream::good(), and PRECONDITION.
|
protected |
If mem is 0, it calls the appropriate build function to allocate memory and initialize the virtual table pointer for the object.
Finally, it invokes the appropriate read function to read the object from the stream into the memory pointed to by mem.
Definition at line 611 of file objstrm.cpp.
References getVersion(), readWord32(), and registerObject().
TStreamableBase * owl::ipstream::readObject | ( | TStreamableBase *& | mem, |
ModuleId | mid = GetModuleId() ) |
Definition at line 560 of file objstrm.cpp.
References owl::pstream::good(), readData(), readPrefix(), and readSuffix().
TStreamableBase * owl::ipstream::readObjectPointer | ( | TStreamableBase *& | mem, |
ModuleId | mid = GetModuleId() ) |
Definition at line 636 of file objstrm.cpp.
References CHECK, owl::pstream::clear(), find(), owl::pstream::good(), owl::pstream::ptIndexed, owl::pstream::ptNull, owl::pstream::ptObject, readByte(), readData(), readPrefix(), readSuffix(), and readWord().
|
protected |
Returns the TStreamableClass object corresponding to the class name stored at the current position in the stream.
Definition at line 577 of file objstrm.cpp.
References _A2W, _T, _USES_CONVERSION, owl::pstream::clear(), readByte(), readString(), TRACEX, and WARNX.
char * owl::ipstream::readString | ( | ) |
Allocates a buffer large enough to contain the string at the current stream position and reads the string into the buffer.
The caller must free the buffer.
Definition at line 461 of file objstrm.cpp.
References owl::pstream::good(), and readBytes().
Reads the string at the current stream position into the buffer specified by buf.
If the length of the string is greater than maxLen - 1, it reads nothing. Otherwise, it reads the string into the buffer and appends a null-terminating byte.
Definition at line 483 of file objstrm.cpp.
References owl::pstream::good(), PRECONDITION, and readBytes().
|
protected |
Reads and checks the suffix of the object.
Definition at line 627 of file objstrm.cpp.
References owl::pstream::clear(), owl::pstream::good(), and readByte().
|
protected |
Reads the version number of the input stream.
Definition at line 540 of file objstrm.cpp.
References owl::pstream::bp, owl::pstream::clear(), owl::pstream::good(), and readWord32().
uint32 owl::ipstream::readWord | ( | ) |
Returns the word at the current stream position.
Definition at line 408 of file objstrm.cpp.
References getVersion(), readWord16(), and readWord32().
uint16 owl::ipstream::readWord16 | ( | ) |
Returns the 16-bit word at the current stream position.
Definition at line 417 of file objstrm.cpp.
References owl::pstream::bp, owl::pstream::clear(), and owl::pstream::good().
uint32 owl::ipstream::readWord32 | ( | ) |
Returns the 32-bit word at the current stream position.
Definition at line 431 of file objstrm.cpp.
References owl::pstream::bp, owl::pstream::clear(), and owl::pstream::good().
ipstream & owl::ipstream::seekg | ( | std::streamoff | , |
std::ios::seekdir | ) |
References owl::GetModuleId().
ipstream & owl::ipstream::seekg | ( | std::streampos | ) |
streampos owl::ipstream::tellg | ( | ) |
Returns the (absolute) current stream position.
Definition at line 321 of file objstrm.cpp.
References owl::pstream::bp, owl::pstream::clear(), and owl::pstream::good().
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
It returns a reference to the stream that lets you chain >> operations in the usual way. The data type of the argument determines how the read is performed. For example, reading a signed char is implemented using readByte.
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
It returns a reference to the stream that lets you chain >> operations in the usual way. The data type of the argument determines how the read is performed. For example, reading a signed char is implemented using readByte.
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
It returns a reference to the stream that lets you chain >> operations in the usual way. The data type of the argument determines how the read is performed. For example, reading a signed char is implemented using readByte.
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
It returns a reference to the stream that lets you chain >> operations in the usual way. The data type of the argument determines how the read is performed. For example, reading a signed char is implemented using readByte.
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
Base class for reading streamable objects
It returns a reference to the stream that lets you chain >> operations in the usual way. The data type of the argument determines how the read is performed. For example, reading a signed char is implemented using readByte.
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
It returns a reference to the stream that lets you chain >> operations in the usual way. The data type of the argument determines how the read is performed. For example, reading a signed char is implemented using readByte.
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
It returns a reference to the stream that lets you chain >> operations in the usual way. The data type of the argument determines how the read is performed. For example, reading a signed char is implemented using readByte.
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
It returns a reference to the stream that lets you chain >> operations in the usual way. The data type of the argument determines how the read is performed. For example, reading a signed char is implemented using readByte.
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
It returns a reference to the stream that lets you chain >> operations in the usual way. The data type of the argument determines how the read is performed. For example, reading a signed char is implemented using readByte.
This operator of ipstream extracts (reads) from the ipstream is, to the string str.
It returns a reference to the stream that lets you chain >> operations in the usual way.
Definition at line 964 of file objstrm.cpp.
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
It returns a reference to the stream that lets you chain >> operations in the usual way. The data type of the argument determines how the read is performed. For example, reading a signed char is implemented using readByte.
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
It returns a reference to the stream that lets you chain >> operations in the usual way. The data type of the argument determines how the read is performed. For example, reading a signed char is implemented using readByte.
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
It returns a reference to the stream that lets you chain >> operations in the usual way. The data type of the argument determines how the read is performed. For example, reading a signed char is implemented using readByte.
This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
It returns a reference to the stream that lets you chain >> operations in the usual way. The data type of the argument determines how the read is performed. For example, reading a signed char is implemented using readByte.
|
friend |