"L. Spiro Engine"
Public Member Functions | Protected Attributes

lsstd::CExternalByteStream Class Reference

Allows treating an external array of bytes as a stream. More...

#include <LSSTDExternalByteStream.h>

Inheritance diagram for lsstd::CExternalByteStream:
lsstd::IStream

List of all members.

Public Member Functions

LSE_CALLCTOR CExternalByteStream (LSUINT8 *_pui8Buffer, LSUINTPTR _uiptrLen)
LSE_CALLCTOR CExternalByteStream (const LSUINT8 *_pui8Buffer, LSUINTPTR _uiptrLen)
virtual LSUINT32 LSE_CALL ReadBytes (LSUINT8 *_pui8Buffer, LSUINT32 _ui32BytesToRead) const
virtual LSUINT64 LSE_CALL ReadUInt64 () const
virtual LSUINT32 LSE_CALL ReadUInt32 () const
virtual LSUINT16 LSE_CALL ReadUInt16 () const
virtual LSUINT8 LSE_CALL ReadUInt8 () const
virtual LSFLOAT LSE_CALL ReadFloat () const
virtual LSDOUBLE LSE_CALL ReadDouble () const
virtual LSUINT32 LSE_CALL WriteBytes (const LSUINT8 *_pui8Buffer, LSUINT32 _ui32BytesToWrite)
virtual LSBOOL LSE_CALL WriteUInt64 (const LSUINT64 &_ui64Value)
virtual LSBOOL LSE_CALL WriteUInt32 (LSUINT32 _ui32Value)
virtual LSBOOL LSE_CALL WriteUInt16 (LSUINT16 _ui16Value)
virtual LSBOOL LSE_CALL WriteUInt8 (LSUINT8 _ui8Value)
virtual LSBOOL LSE_CALL WriteFloat (LSFLOAT _fValue)
virtual LSBOOL LSE_CALL WriteDouble (const LSDOUBLE &_dValue)
LSVOID LSE_CALL SetPos (LSUINTPTR _uiptrPos) const
LSUINTPTR LSE_CALL GetPos () const
LSUINTPTR LSE_CALL Length () const
const LSUINT8 *LSE_CALL GetBuffer () const

Protected Attributes

LSUINT8 * m_pui8Stream
LSUINTPTR m_uiptrCurPos
LSUINTPTR m_uiptrLength
LSBOOL m_bReadOnly

Detailed Description

Allows treating an external array of bytes as a stream.

Class CExternalByteStream Description: Allows treating an external array of bytes as a stream. Allows modifying the array but not beyond the actual length of the array. This is useful for situations when you have a file image loaded to memory and you wish to read from it in the fashion of a byte stream.


Member Function Documentation

const LSUINT8* LSE_CALL lsstd::CExternalByteStream::GetBuffer ( ) const

Get a pointer to the start of the buffer.

Returns:
Returns a pointer to the start of the buffer.
LSUINTPTR LSE_CALL lsstd::CExternalByteStream::GetPos ( ) const

Get the current position of the stream pointer.

Returns:
Returns the position of the stream pointer. The stream pointer indicates where the next stream operation (reading or writing) will take place.
LSUINTPTR LSE_CALL lsstd::CExternalByteStream::Length ( ) const

Get the length of the stream.

Returns:
Returns the length, in bytes, of the stream.
virtual LSUINT32 LSE_CALL lsstd::CExternalByteStream::ReadBytes ( LSUINT8 *  _pui8Buffer,
LSUINT32  _ui32BytesToRead 
) const [virtual]

Read bytes from the stream. Stream position is advanced by the amount read.

Parameters:
_pui8BufferBuffer to hold the bytes read from the stream.
_ui32BytesToReadNumber of bytes to read.
Returns:
Returns the actual number of bytes read or LSSTD_SE_ERROR on error.

Implements lsstd::IStream.

virtual LSDOUBLE LSE_CALL lsstd::CExternalByteStream::ReadDouble ( ) const [virtual]

Reads a 64-bit double from the stream and advances the stream position.

Returns:
Returns the 64-bit double at the current position in the stream.

Implements lsstd::IStream.

virtual LSFLOAT LSE_CALL lsstd::CExternalByteStream::ReadFloat ( ) const [virtual]

Reads a 32-bit float from the stream and advances the stream position.

Returns:
Returns the 32-bit float at the current position in the stream.

Implements lsstd::IStream.

virtual LSUINT16 LSE_CALL lsstd::CExternalByteStream::ReadUInt16 ( ) const [virtual]

Reads a 16-bit unsigned integer from the stream and advances the stream position.

Returns:
Returns the 16-bit unsigned integer at the current position in the stream.

Implements lsstd::IStream.

virtual LSUINT32 LSE_CALL lsstd::CExternalByteStream::ReadUInt32 ( ) const [virtual]

Reads a 32-bit unsigned integer from the stream and advances the stream position.

Returns:
Returns the 32-bit unsigned integer at the current position in the stream.

Implements lsstd::IStream.

virtual LSUINT64 LSE_CALL lsstd::CExternalByteStream::ReadUInt64 ( ) const [virtual]

Reads a 64-bit unsigned integer from the stream and advances the stream position.

Returns:
Returns the 64-bit unsigned integer at the current position in the stream.

Implements lsstd::IStream.

virtual LSUINT8 LSE_CALL lsstd::CExternalByteStream::ReadUInt8 ( ) const [virtual]

Reads an 8-bit unsigned integer from the stream and advances the stream position.

Returns:
Returns the 8-bit unsigned integer at the current position in the stream.

Implements lsstd::IStream.

LSVOID LSE_CALL lsstd::CExternalByteStream::SetPos ( LSUINTPTR  _uiptrPos) const

Set the stream position. Actual position set is clamped between 0 and the length of the stream.

Parameters:
_uiptrPosNew position of the stream.
virtual LSUINT32 LSE_CALL lsstd::CExternalByteStream::WriteBytes ( const LSUINT8 *  _pui8Buffer,
LSUINT32  _ui32BytesToWrite 
) [virtual]

Write bytes to the stream. Stream position is advanced by the amount written.

Parameters:
_pui8BufferBuffer containing the bytes to write to the stream.
_ui32BytesToWriteNumber of bytes to write.
Returns:
Returns the actual number of bytes written or LSSTD_SE_ERROR on error.

Implements lsstd::IStream.

virtual LSBOOL LSE_CALL lsstd::CExternalByteStream::WriteDouble ( const LSDOUBLE &  _dValue) [virtual]

Writes a 64-bit double from the stream and advances the stream position.

Returns:
Returns true if the value was fully written to the stream.

Implements lsstd::IStream.

virtual LSBOOL LSE_CALL lsstd::CExternalByteStream::WriteFloat ( LSFLOAT  _fValue) [virtual]

Writes a 32-bit float from the stream and advances the stream position.

Returns:
Returns true if the value was fully written to the stream.

Implements lsstd::IStream.

virtual LSBOOL LSE_CALL lsstd::CExternalByteStream::WriteUInt16 ( LSUINT16  _ui16Value) [virtual]

Writes a 16-bit unsigned integer to the stream and advances the stream position.

Returns:
Returns true if the value was fully written to the stream.

Implements lsstd::IStream.

virtual LSBOOL LSE_CALL lsstd::CExternalByteStream::WriteUInt32 ( LSUINT32  _ui32Value) [virtual]

Writes a 32-bit unsigned integer to the stream and advances the stream position.

Returns:
Returns true if the value was fully written to the stream.

Implements lsstd::IStream.

virtual LSBOOL LSE_CALL lsstd::CExternalByteStream::WriteUInt64 ( const LSUINT64 &  _ui64Value) [virtual]

Writes a 64-bit unsigned integer to the stream and advances the stream position.

Returns:
Returns true if the value was fully written to the stream.

Implements lsstd::IStream.

virtual LSBOOL LSE_CALL lsstd::CExternalByteStream::WriteUInt8 ( LSUINT8  _ui8Value) [virtual]

Writes an 8-bit unsigned integer from the stream and advances the stream position.

Returns:
Returns true if the value was fully written to the stream.

Implements lsstd::IStream.


Member Data Documentation

Are we read-only?

Pointer to the stream of bytes.

LSUINTPTR lsstd::CExternalByteStream::m_uiptrCurPos [mutable, protected]

Current position in the stream.

Length of the stream.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator