Drag[en]gine Game Engine  1.21
decZFileReader Class Reference

Z-Compressed file reader. More...

#include <decZFileReader.h>

Inheritance diagram for decZFileReader:
decBaseFileReader deObject

Public Types

typedef deTObjectReference< decZFileReaderRef
 Type holding strong reference. More...
 
- Public Types inherited from decBaseFileReader
typedef deTObjectReference< decBaseFileReaderRef
 Type holding strong reference. More...
 
- Public Types inherited from deObject
typedef deTObjectReference< deObjectRef
 Type holding strong reference. More...
 

Constructors and Destructors

 decZFileReader (decBaseFileReader *reader)
 Create z-compressed file reader object for another file reader. More...
 
 decZFileReader (decBaseFileReader *reader, bool pureMode, int pureLength)
 Create z-compressed file reader object for another file reader. More...
 
virtual ~decZFileReader ()
 Close file and cleans up. More...
 

Management

virtual const char * GetFilename ()
 Name of the file. More...
 
virtual int GetLength ()
 Length of the file. More...
 
virtual TIME_SYSTEM GetModificationTime ()
 Modification time. More...
 
virtual int GetPosition ()
 Current reading position in the file. More...
 
virtual void SetPosition (int position)
 Set file position for the next read action. More...
 
virtual void MovePosition (int offset)
 Move file position by the given offset. More...
 
virtual void SetPositionEnd (int position)
 Set file position to the given position measured from the end of the file. More...
 
virtual void Read (void *buffer, int size)
 Read size bytes into buffer and advances the file pointer. More...
 
virtual decBaseFileReader::Ref Duplicate ()
 Duplicate file reader. More...
 

Additional Inherited Members

- Public Member Functions inherited from decBaseFileReader
bool IsEOF ()
 File pointer is at the end of the file. More...
 
int8_t ReadChar ()
 Read one byte and advances the file pointer. More...
 
uint8_t ReadByte ()
 Read one unsigned byte and advances the file pointer. More...
 
int16_t ReadShort ()
 Read one short integer (2 bytes) and advances the file pointer. More...
 
uint16_t ReadUShort ()
 Read one unsigned short integer (2 bytes) and advances the file pointer. More...
 
int32_t ReadInt ()
 Read one integer (4 bytes) and advances the file pointer. More...
 
uint32_t ReadUInt ()
 Read one unsigned integer (4 bytes) and advances the file pointer. More...
 
int64_t ReadLong ()
 Read one integer (8 bytes) and advances the file pointer. More...
 
uint64_t ReadULong ()
 Read one unsigned integer (8 bytes) and advances the file pointer. More...
 
float ReadFloat ()
 Read one float (4 bytes) and advances the file pointer. More...
 
double ReadDouble ()
 Read one double (8 bytes) and advances the file pointer. More...
 
decString ReadString8 ()
 Read a string prefixed by a 1-byte length field and advances the file pointer. More...
 
void ReadString8Into (decString &string)
 Read string prefixed by a 1-byte length field and advances the file pointer. More...
 
decString ReadString16 ()
 Read a string prefixed by a 2-byte2 length field and advances the file pointer. More...
 
void ReadString16Into (decString &string)
 Read string prefixed by a 2-byte2 length field and advances the file pointer. More...
 
decVector ReadVector ()
 Read a 3-float vector and advances the file pointer. More...
 
void ReadVectorInto (decVector &vector)
 Read a 3-float vector and advances the file pointer. More...
 
decVector2 ReadVector2 ()
 Read a 2-float vector and advances the file pointer. More...
 
void ReadVector2Into (decVector2 &vector)
 Read a 2-float vector and advances the file pointer. More...
 
decQuaternion ReadQuaternion ()
 Read a 4-float quaternion and advances the file pointer. More...
 
void ReadQuaternionInto (decQuaternion &quaternion)
 Read a 4-float quaternion and advances the file pointer. More...
 
decPoint ReadPoint ()
 Read a 2-int point and advances the file pointer. More...
 
void ReadPointInto (decPoint &point)
 Read a 2-int point and advances the file pointer. More...
 
decPoint3 ReadPoint3 ()
 Read a 3-int point and advances the file pointer. More...
 
void ReadPoint3Into (decPoint3 &point)
 Read a 3-int point and advances the file pointer. More...
 
decDVector ReadDVector ()
 Read a 3-double vector and advances the file pointer. More...
 
void ReadDVectorInto (decDVector &vector)
 Read a 3-double vector and advances the file pointer. More...
 
decColor ReadColor ()
 Read a 4-component color and advances the file pointer. More...
 
void ReadColorInto (decColor &color)
 Read a 4-component color and advances the file pointer. More...
 
decColor ReadColor3 ()
 Read a 3-component color and advances the file pointer. More...
 
void ReadColor3Into (decColor &color)
 Read a 3-component color and advances the file pointer. More...
 
void SkipChar ()
 Skip one byte and advances the file pointer. More...
 
void SkipByte ()
 Skip one unsigned byte and advances the file pointer. More...
 
void SkipShort ()
 Skip one short integer (2 bytes) and advances the file pointer. More...
 
void SkipUShort ()
 Skip one unsigned short integer (2 bytes) and advances the file pointer. More...
 
void SkipInt ()
 Skip one integer (4 bytes) and advances the file pointer. More...
 
void SkipUInt ()
 Skip one unsigned integer (4 bytes) and advances the file pointer. More...
 
void SkipLong ()
 Skip one integer (8 bytes) and advances the file pointer. More...
 
void SkipULong ()
 Skip one unsigned integer (8 bytes) and advances the file pointer. More...
 
void SkipFloat ()
 Skip one float (4 bytes) and advances the file pointer. More...
 
void SkipDouble ()
 Skip one double (8 bytes) and advances the file pointer. More...
 
void SkipString8 ()
 Skip a string prefixed by a 1-byte length field and advances the file pointer. More...
 
void SkipString16 ()
 Skip a string prefixed by a 2-byte2 length field and advances the file pointer. More...
 
void SkipVector ()
 Skip a 3-float vector and advances the file pointer. More...
 
void SkipVector2 ()
 Skip a 2-float vector and advances the file pointer. More...
 
void SkipQuaternion ()
 Skip a 4-float quaternion and advances the file pointer. More...
 
void SkipPoint ()
 Skip a 2-int point and advances the file pointer. More...
 
void SkipPoint3 ()
 Skip a 3-int point and advances the file pointer. More...
 
void SkipDVector ()
 Skip a 3-double vector and advances the file pointer. More...
 
void SkipColor ()
 Skip a 4-component color and advances the file pointer. More...
 
void SkipColor3 ()
 Skip a 3-component color and advances the file pointer. More...
 
 decBaseFileReader ()
 Create file reader. More...
 
- Public Member Functions inherited from deObject
int GetRefCount () const
 Reference count. More...
 
void AddReference ()
 Add reference increasing reference count by 1. More...
 
void FreeReference ()
 Decrease reference count by one and delete object if count reaches 0. More...
 
 deObject ()
 Create object with reference count of 1. More...
 
- Protected Member Functions inherited from decBaseFileReader
virtual ~decBaseFileReader ()
 Clean up file reader. More...
 
- Protected Member Functions inherited from deObject
virtual ~deObject ()
 Clean up object. More...
 

Detailed Description

Z-Compressed file reader.

Reads data from another file writer using Zlib compression. The user is responsible to place the file reader at the position where the Z-compressed data begins. This allows the user to place arbitrary headers in front of the z-compressed data. The compressed data is always read sequentially hence file readers unable to seek can be used. The z-reader takes over the original reader pointer deleting it once the z-reader itself is destroyed. The typical use case is to create a reader, read the header, creating the z-reader and then handing back the z-reader to read the compressed file content. This way pointers are handled properly and the z-reader can be transparently used everywhere a file reader is used.

Member Typedef Documentation

◆ Ref

Type holding strong reference.

Constructor & Destructor Documentation

◆ decZFileReader() [1/2]

decZFileReader::decZFileReader ( decBaseFileReader reader)

Create z-compressed file reader object for another file reader.

The file reader is taken over and deleted once the z-reader is deleted. The file pointer has to be set to the starting position of the compressed data.

Note
To ensure future feature compatibility this class reads private data stored in front of the actual compress data. To read a pure z compressed stream use decZFileReader(decBaseFileReader*,bool,int) .
Exceptions
deeInvalidParamreader is NULL.

◆ decZFileReader() [2/2]

decZFileReader::decZFileReader ( decBaseFileReader reader,
bool  pureMode,
int  pureLength 
)

Create z-compressed file reader object for another file reader.

The file reader is taken over and deleted once the z-reader is deleted. The file pointer has to be set to the starting position of the compressed data.

Parameters
[in]pureModeIf true does not read private compression data. Use this mode if you want to read pure z compressed data. If false behaves identical to decZFileReader(decBaseFileReader*) .
[in]pureLengthIf pureMode is true defines the length of the compressed data. The caller is responsible to obtain the correct length.
Exceptions
deeInvalidParamreader is NULL.

◆ ~decZFileReader()

virtual decZFileReader::~decZFileReader ( )
protectedvirtual

Close file and cleans up.

Note
Subclasses should set their destructor protected too to avoid users accidently deleting a reference counted object through the object pointer. Only FreeReference() is allowed to delete the object.

Member Function Documentation

◆ Duplicate()

virtual decBaseFileReader::Ref decZFileReader::Duplicate ( )
virtual

Duplicate file reader.

Implements decBaseFileReader.

◆ GetFilename()

virtual const char* decZFileReader::GetFilename ( )
virtual

Name of the file.

Implements decBaseFileReader.

◆ GetLength()

virtual int decZFileReader::GetLength ( )
virtual

Length of the file.

Implements decBaseFileReader.

◆ GetModificationTime()

virtual TIME_SYSTEM decZFileReader::GetModificationTime ( )
virtual

Modification time.

Implements decBaseFileReader.

◆ GetPosition()

virtual int decZFileReader::GetPosition ( )
virtual

Current reading position in the file.

Implements decBaseFileReader.

◆ MovePosition()

virtual void decZFileReader::MovePosition ( int  offset)
virtual

Move file position by the given offset.

Implements decBaseFileReader.

◆ Read()

virtual void decZFileReader::Read ( void *  buffer,
int  size 
)
virtual

Read size bytes into buffer and advances the file pointer.

Exceptions
deeInvalidParambuffer is NULL.
deeInvalidParamsize is less than 1.
deeInvalidParamError decompressing content.

Implements decBaseFileReader.

◆ SetPosition()

virtual void decZFileReader::SetPosition ( int  position)
virtual

Set file position for the next read action.

Implements decBaseFileReader.

◆ SetPositionEnd()

virtual void decZFileReader::SetPositionEnd ( int  position)
virtual

Set file position to the given position measured from the end of the file.

Implements decBaseFileReader.


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