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

#include <packfile.h>

Inheritance diagram for Grim::PackFile:
Collaboration diagram for Grim::PackFile:

List of all members.

Public Member Functions

 PackFile (Common::SeekableReadStream *data)
 ~PackFile ()
bool err () const
 Returns true if an I/O failure occurred.
void clearErr ()
 Reset the I/O error status as returned by err().
uint32 read (void *dataPtr, uint32 dataSize)
 Read data from the stream.
bool eos () const
 Returns true if a read failed because the stream end has been reached.
int32 pos () const
 Obtains the current value of the stream position indicator of the stream.
int32 size () const
 Obtains the total size of the stream, measured in bytes.
bool seek (int32 offset, int whence=SEEK_SET)
 Sets the stream position indicator for the stream.

Private Member Functions

void createCodeTable (uint32 key)
void decode (uint8 *data, uint32 size, uint32 start_point)

Private Attributes

Common::SeekableReadStream_orgStream
int32 _offset
int32 _size
uint16_codeTable
const uint32 _kCodeTableSize

Static Private Attributes

static const uint32 _knownOffsets [5] = { 0x1c000, 0x21000, 0x23000, 0x24000, 0 }

Detailed Description

Definition at line 32 of file packfile.h.


Constructor & Destructor Documentation

Grim::PackFile::PackFile ( Common::SeekableReadStream data  ) 

Definition at line 32 of file packfile.cpp.

Grim::PackFile::~PackFile (  ) 

Definition at line 68 of file packfile.cpp.


Member Function Documentation

void Grim::PackFile::clearErr (  )  [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 78 of file packfile.cpp.

void Grim::PackFile::createCodeTable ( uint32  key  )  [private]

Definition at line 82 of file packfile.cpp.

void Grim::PackFile::decode ( uint8 data,
uint32  size,
uint32  start_point 
) [private]

Definition at line 96 of file packfile.cpp.

bool Grim::PackFile::eos (  )  const [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 118 of file packfile.cpp.

bool Grim::PackFile::err (  )  const [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 74 of file packfile.cpp.

int32 Grim::PackFile::pos (  )  const [virtual]

Obtains the current value of the stream position indicator of the stream.

Returns:
the current position indicator, or -1 if an error occurred.

Implements Common::SeekableReadStream.

Definition at line 122 of file packfile.cpp.

uint32 Grim::PackFile::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 103 of file packfile.cpp.

bool Grim::PackFile::seek ( int32  offset,
int  whence = SEEK_SET 
) [virtual]

Sets the stream position indicator for the stream.

The new position, measured in bytes, is obtained by adding offset bytes to the position specified by whence. If whence is set to SEEK_SET, SEEK_CUR, or SEEK_END, the offset is relative to the start of the file, the current position indicator, or end-of-file, respectively. A successful call to the seek() method clears the end-of-file indicator for the stream.

Note:
The semantics of any implementation of this method are supposed to match those of ISO C fseek().
Parameters:
offset the relative offset in bytes
whence the seek reference: SEEK_SET, SEEK_CUR, or SEEK_END
Returns:
true on success, false in case of a failure

Implements Common::SeekableReadStream.

Definition at line 130 of file packfile.cpp.

int32 Grim::PackFile::size (  )  const [virtual]

Obtains the total size of the stream, measured in bytes.

If this value is unknown or can not be computed, -1 is returned.

Returns:
the size of the stream, or -1 if an error occurred

Implements Common::SeekableReadStream.

Definition at line 126 of file packfile.cpp.


Member Data Documentation

Definition at line 49 of file packfile.h.

Definition at line 50 of file packfile.h.

const uint32 Grim::PackFile::_knownOffsets = { 0x1c000, 0x21000, 0x23000, 0x24000, 0 } [static, private]

Definition at line 55 of file packfile.h.

Definition at line 47 of file packfile.h.

Definition at line 46 of file packfile.h.

Definition at line 47 of file packfile.h.


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


Generated on Sat Mar 16 2019 05:06:18 for ResidualVM by doxygen 1.7.1
curved edge   curved edge