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

ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting) streamable objects. More...

#include <owl/objstrm.h>

Inheritance diagram for owl::ipstream:
owl::pstream owl::ifpstream

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.
 
ipstreamseekg (std::streampos)
 
ipstreamseekg (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.
 
charfreadString ()
 Reads a string from the stream.
 
charfreadString (char *buf, unsigned maxLen)
 Reads a string from the stream into the supplied far buffer (buf).
 
uint32 getVersion () const
 Returns the object version number.
 
TStreamableBasereadObject (TStreamableBase *&mem, ModuleId mid=GetModuleId())
 
TStreamableBasereadObjectPointer (TStreamableBase *&mem, ModuleId mid=GetModuleId())
 
TStreamableBasefind (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 ObjectBuilderreadPrefix (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
 
ipstreamoperator>> (ipstream &, int8 &)
 This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
 
ipstreamoperator>> (ipstream &, uint8 &)
 This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
 
ipstreamoperator>> (ipstream &, char &)
 This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
 
ipstreamoperator>> (ipstream &, signed short &)
 This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
 
ipstreamoperator>> (ipstream &, unsigned short &)
 This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
 
ipstreamoperator>> (ipstream &, signed int &)
 This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
 
ipstreamoperator>> (ipstream &, unsigned int &)
 This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
 
ipstreamoperator>> (ipstream &, bool &)
 This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
 
ipstreamoperator>> (ipstream &, signed long &)
 This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
 
ipstreamoperator>> (ipstream &, unsigned long &)
 This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
 
ipstreamoperator>> (ipstream &, int64 &)
 
ipstreamoperator>> (ipstream &, uint64 &)
 
ipstreamoperator>> (ipstream &, float &)
 This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
 
ipstreamoperator>> (ipstream &, double &)
 This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
 
ipstreamoperator>> (ipstream &, long double &)
 This friend operator of ipstream extracts (reads) from the ipstream ps, to the given argument.
 
ipstreamoperator>> (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
 

Detailed Description

ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting) streamable objects.

Definition at line 391 of file objstrm.h.

Member Function Documentation

◆ freadBytes()

void owl::ipstream::freadBytes ( void * data,
size_t sz )

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.

◆ freadString() [1/2]

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().

◆ freadString() [2/2]

char * owl::ipstream::freadString ( char * buf,
unsigned maxLen )

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.

◆ readByte()

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().

◆ readBytes()

void owl::ipstream::readBytes ( void * data,
size_t sz )

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.

◆ readData()

void owl::ipstream::readData ( const ObjectBuilder * c,
TStreamableBase *& mem )
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().

◆ readObject()

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().

◆ readObjectPointer()

◆ readPrefix()

const ObjectBuilder * owl::ipstream::readPrefix ( ModuleId mid)
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.

◆ readString() [1/2]

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().

◆ readString() [2/2]

LPSTR owl::ipstream::readString ( LPSTR buf,
unsigned maxLen )

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().

◆ readSuffix()

void owl::ipstream::readSuffix ( )
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().

◆ readVersion()

void owl::ipstream::readVersion ( )
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().

◆ readWord()

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().

◆ readWord16()

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().

◆ readWord32()

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().

◆ seekg() [1/2]

ipstream & owl::ipstream::seekg ( std::streamoff ,
std::ios::seekdir  )

References owl::GetModuleId().

◆ seekg() [2/2]

ipstream & owl::ipstream::seekg ( std::streampos )

◆ tellg()

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().

Friends And Related Symbol Documentation

◆ operator>> [1/16]

ipstream & operator>> ( ipstream & ps,
bool & b )
friend

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.

Definition at line 1029 of file objstrm.h.

◆ operator>> [2/16]

ipstream & operator>> ( ipstream & ps,
char & ch )
friend

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.

Definition at line 917 of file objstrm.h.

◆ operator>> [3/16]

ipstream & operator>> ( ipstream & ps,
double & d )
friend

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.

Definition at line 1009 of file objstrm.h.

◆ operator>> [4/16]

ipstream & operator>> ( ipstream & ps,
float & f )
friend

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.

Definition at line 999 of file objstrm.h.

◆ operator>> [5/16]

ipstream & operator>> ( ipstream & ps,
int64 & v )
friend

Definition at line 982 of file objstrm.h.

◆ operator>> [6/16]

ipstream & operator>> ( ipstream & ps,
int8 & ch )
friend

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.

Definition at line 896 of file objstrm.h.

◆ operator>> [7/16]

ipstream & operator>> ( ipstream & ps,
long double & l )
friend

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.

Definition at line 1019 of file objstrm.h.

◆ operator>> [8/16]

ipstream & operator>> ( ipstream & ps,
signed int & i )
friend

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.

Definition at line 947 of file objstrm.h.

◆ operator>> [9/16]

ipstream & operator>> ( ipstream & ps,
signed long & l )
friend

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.

Definition at line 967 of file objstrm.h.

◆ operator>> [10/16]

ipstream & operator>> ( ipstream & ps,
signed short & sh )
friend

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.

Definition at line 927 of file objstrm.h.

◆ operator>> [11/16]

ipstream & operator>> ( ipstream & is,
tstring & str )
friend

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.

◆ operator>> [12/16]

ipstream & operator>> ( ipstream & ps,
uint64 & v )
friend

Definition at line 988 of file objstrm.h.

◆ operator>> [13/16]

ipstream & operator>> ( ipstream & ps,
uint8 & ch )
friend

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.

Definition at line 907 of file objstrm.h.

◆ operator>> [14/16]

ipstream & operator>> ( ipstream & ps,
unsigned int & i )
friend

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.

Definition at line 957 of file objstrm.h.

◆ operator>> [15/16]

ipstream & operator>> ( ipstream & ps,
unsigned long & l )
friend

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.

Definition at line 977 of file objstrm.h.

◆ operator>> [16/16]

ipstream & operator>> ( ipstream & ps,
unsigned short & sh )
friend

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.

Definition at line 937 of file objstrm.h.

◆ TStreamableClass

Definition at line 392 of file objstrm.h.


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