ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

Common::SubReadStream Class Reference

SubReadStream provides access to a ReadStream restricted to the range [currentPosition, currentPosition+end). More...

#include <substream.h>

Inheritance diagram for Common::SubReadStream:
Collaboration diagram for Common::SubReadStream:

List of all members.

Public Member Functions

 SubReadStream (ReadStream *parentStream, uint32 end, DisposeAfterUse::Flag disposeParentStream=DisposeAfterUse::NO)
virtual bool eos () const
 Returns true if a read failed because the stream end has been reached.
virtual bool err () const
 Returns true if an I/O failure occurred.
virtual void clearErr ()
 Reset the I/O error status as returned by err().
virtual uint32 read (void *dataPtr, uint32 dataSize)
 Read data from the stream.

Protected Attributes

DisposablePtr< ReadStream_parentStream
uint32 _pos
uint32 _end
bool _eos

Detailed Description

SubReadStream provides access to a ReadStream restricted to the range [currentPosition, currentPosition+end).

Manipulating the parent stream directly /will/ mess up a substream. Likewise, manipulating two substreams of a parent stream will cause them to step on each others toes.

Definition at line 40 of file substream.h.


Constructor & Destructor Documentation

Common::SubReadStream::SubReadStream ( ReadStream parentStream,
uint32  end,
DisposeAfterUse::Flag  disposeParentStream = DisposeAfterUse::NO 
) [inline]

Definition at line 47 of file substream.h.


Member Function Documentation

virtual void Common::SubReadStream::clearErr (  )  [inline, virtual]

Reset the I/O error status as returned by err().

For a ReadStream, also reset the end-of-stream status returned by eos().

Note:
The semantics of any implementation of this method are supposed to match those of ISO C clearerr().

Reimplemented from Common::Stream.

Definition at line 57 of file substream.h.

virtual bool Common::SubReadStream::eos (  )  const [inline, virtual]

Returns true if a read failed because the stream end has been reached.

This flag is cleared by clearErr(). For a SeekableReadStream, it is also cleared by a successful seek.

Note:
The semantics of any implementation of this method are supposed to match those of ISO C feof(). In particular, in a stream with N bytes, reading exactly N bytes from the start should *not* set eos; only reading *beyond* the available data should set it.

Implements Common::ReadStream.

Definition at line 55 of file substream.h.

virtual bool Common::SubReadStream::err (  )  const [inline, virtual]

Returns true if an I/O failure occurred.

This flag is never cleared automatically. In order to clear it, client code has to call clearErr() explicitly.

Note:
The semantics of any implementation of this method are supposed to match those of ISO C ferror().

Reimplemented from Common::Stream.

Definition at line 56 of file substream.h.

uint32 Common::SubReadStream::read ( void *  dataPtr,
uint32  dataSize 
) [virtual]

Read data from the stream.

Subclasses must implement this method; all other read methods are implemented using it.

Note:
The semantics of any implementation of this method are supposed to match those of ISO C fread(), in particular where it concerns setting error and end of file/stream flags.
Parameters:
dataPtr pointer to a buffer into which the data is read
dataSize number of bytes to be read
Returns:
the number of bytes which were actually read.

Implements Common::ReadStream.

Definition at line 193 of file stream.cpp.


Member Data Documentation

Definition at line 44 of file substream.h.

bool Common::SubReadStream::_eos [protected]

Definition at line 45 of file substream.h.

Definition at line 43 of file substream.h.


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


Generated on Sat Jul 20 2019 05:02:52 for ResidualVM by doxygen 1.7.1
curved edge   curved edge