Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CP_FileInStream Class Reference

Inheritance diagram for CP_FileInStream:

CP_InStream List of all members.

Public Member Functions

Constructor / Destructor
 CP_FileInStream (CP_File &inFile, bool inHasHeader=true)
 Constructor.
virtual ~CP_FileInStream () throw ()
 Destructor.
Getters
virtual UInt32 GetLength () const
Positioning
virtual UInt32 GetPosition () const
virtual void SetPosition (UInt32 inPosition)

Protected Member Functions

Reading
virtual UInt32 OnReadBytes (void *inDestBuffer, UInt32 inNumberBytes)

Protected Attributes

CP_FilefFile
bool fHasReadHeader
bool fNeedsByteSwap
UInt16 fCPLATStreamVersion
bool fHasTaggedData
bool fHasHeader
char fDesiredEdian

Constructor & Destructor Documentation

CP_FileInStream::CP_FileInStream CP_File inFile,
bool  inHasHeader = true
 

Constructor.

Parameters:
inFile The file that we are going to read our data from. This class assumes that this file has already been opened for read access.
inHasHeader Flag to indicate if the data in the file was written by CPLAT, and therefore will have a header at the beginning of the streamed data.
Exceptions:
none 

CP_FileInStream::~CP_FileInStream  )  throw () [virtual]
 

Destructor.

Exceptions:
none 


Member Function Documentation

UInt32 CP_FileInStream::GetLength  )  const [virtual]
 

Returns the length of the file used with this stream.

Exceptions:
OSStatus exceptions from the file.
Returns:
SInt32 const The length of the file used with this stream.

Implements CP_InStream.

UInt32 CP_FileInStream::GetPosition  )  const [virtual]
 

Returns the current file marker or position of the file used with this stream.

Exceptions:
OSStatus exceptions from the file.
Returns:
UInt32 const The current file marker or position.

Implements CP_InStream.

void CP_FileInStream::SetPosition UInt32  inPosition  )  [virtual]
 

Sets the current file marker or position of the file used with this stream.

Parameters:
inPosition The position to set the file marker.
Exceptions:
OSStatus exceptions from the file.
Returns:
void

Implements CP_InStream.

UInt32 CP_FileInStream::OnReadBytes void *  inBuffer,
UInt32  inBytesToRead
[protected, virtual]
 

Reads data from our file, placing the data in the passed in buffer. The buffer should be at least as large as the passed in inBytesToRead. This method will return the actual number of bytes read.

Parameters:
inBuffer The buffer to hold the data.
inBytesToRead The number of bytes to read from the buffer. The buffer should be at least this many bytes.
Exceptions:
OSStatus exceptions from the file.
Returns:
Actual number of bytes read.

Implements CP_InStream.

UInt32 CP_InStream::ReadBytes void *  inDestBuffer,
UInt32  inNumberBytes,
bool  inAllowPartialData = false
[virtual, inherited]
 

Reads some data from the stream. Used by the >> operators to read the data, but can also be used in an application.

Parameters:
inDestBuffer Location to read the data into.
inNumberBytes Length of the buffer to hold the data.
inAllowPartialData If true, less than the requested number of bytes may be read. Otherwise, if not enough data is available, an exception is raised.
Exceptions:
CP_OSErrorException(eofErr) raised if inAllowPartialData is false and not enough data can be read.
Returns:
UInt32 The number of bytes actually read. If inAllowPartialData is true, this may be less than the requested number of bytes.

bool CP_InStream::NeedsByteSwap  )  const [inherited]
 

void CP_InStream::SetNeedsByteSwap bool  doSwap  )  [inherited]
 

UInt16 CP_InStream::GetStreamVersion  )  const [inherited]
 

bool CP_InStream::HasHeader  )  const [inherited]
 

bool CP_InStream::IsEOF  )  const [virtual, inherited]
 

Returns true if the stream has reached the end.

Exceptions:
none 
Returns:
bool const True if the stream is at the end.

Reimplemented in CP_SocketInStream.

bool CP_InStream::HasTaggedData  )  const [inherited]
 

Returns true if the data type is written before each elemement. This is intended in debugging the stream data since it increases the size of the resulting stream.

Exceptions:
none 
Returns:
bool const True, if the stream has tags before each data element.

SInt32 CP_InStream::GetTag  )  [inherited]
 

Reads the tag before a data element if the streamed data has tagged data.

Exceptions:
none 
Returns:
SInt32 The tag being read.

void CP_InStream::ReadHeader  )  [protected, virtual, inherited]
 

Reads the header portion of our stream.

Exceptions:
none 
Returns:
void


Member Data Documentation

CP_File& CP_FileInStream::fFile [protected]
 

bool CP_InStream::fHasReadHeader [protected, inherited]
 

bool CP_InStream::fNeedsByteSwap [protected, inherited]
 

Flag to indicate if we have read the header.

UInt16 CP_InStream::fCPLATStreamVersion [protected, inherited]
 

Flag to indicate if we need to byte swap the data.

bool CP_InStream::fHasTaggedData [protected, inherited]
 

CPLAT stream version used to write this stream.

bool CP_InStream::fHasHeader [protected, inherited]
 

Flag to indicate if the data has its type written out also.

char CP_InStream::fDesiredEdian [protected, inherited]
 

Flag to indicate if we are want to read data not created by this framework and therefore won't have a correct header.


The documentation for this class was generated from the following files:
Generated on Sat Sep 17 20:01:40 2005 for CPLAT by  doxygen 1.4.0