Drag[en]gine Game Engine 1.32.3
Loading...
Searching...
No Matches
decBaseFileReader Class Referenceabstract

File reader interface. More...

#include <decBaseFileReader.h>

Inheritance diagram for decBaseFileReader:
deObject deNetworkMessageReader decDiskFileReader decMemoryFileReader decWeakFileReader decZFileReader

Public Types

using Ref = deTObjectReference< decBaseFileReader >
 Type holding strong reference.
 
- Public Types inherited from deObject
using Ref = deTObjectReference< deObject >
 Type holding strong reference.
 

Public Member Functions

Management
virtual const char * GetFilename ()=0
 Name of the file.
 
virtual int GetLength ()=0
 Length of the file.
 
virtual TIME_SYSTEM GetModificationTime ()=0
 Modification time.
 
virtual int GetPosition ()=0
 Current reading position in the file.
 
virtual void SetPosition (int position)=0
 Set file position for the next read action.
 
virtual void MovePosition (int offset)=0
 Move file position by the given offset.
 
virtual void SetPositionEnd (int position)=0
 Set file position to the given position measured from the end of the file.
 
virtual void Read (void *buffer, int size)=0
 Read size bytes into buffer and advances the file pointer.
 
virtual Ref Duplicate ()=0
 Duplicate file reader.
 
Helper Functions
bool IsEOF ()
 File pointer is at the end of the file.
 
int8_t ReadChar ()
 Read one byte and advances the file pointer.
 
uint8_t ReadByte ()
 Read one unsigned byte and advances the file pointer.
 
int16_t ReadShort ()
 Read one short integer (2 bytes) and advances the file pointer.
 
uint16_t ReadUShort ()
 Read one unsigned short integer (2 bytes) and advances the file pointer.
 
int32_t ReadInt ()
 Read one integer (4 bytes) and advances the file pointer.
 
uint32_t ReadUInt ()
 Read one unsigned integer (4 bytes) and advances the file pointer.
 
int64_t ReadLong ()
 Read one integer (8 bytes) and advances the file pointer.
 
uint64_t ReadULong ()
 Read one unsigned integer (8 bytes) and advances the file pointer.
 
uint32_t ReadVarUInt ()
 Read variable length unsigned integer (1-4 bytes) and advances file pointer.
 
float ReadFloat ()
 Read one float (4 bytes) and advances the file pointer.
 
double ReadDouble ()
 Read one double (8 bytes) and advances the file pointer.
 
decString ReadString8 ()
 Read a string prefixed by a 1-byte length field and advances the file pointer.
 
void ReadString8Into (decString &string)
 Read string prefixed by a 1-byte length field and advances the file pointer.
 
decString ReadString16 ()
 Read a string prefixed by a 2-bytes length field and advances the file pointer.
 
void ReadString16Into (decString &string)
 Read string prefixed by a 2-bytes length field and advances the file pointer.
 
decString ReadString32 ()
 Read a string prefixed by a 4-bytes length field and advances the file pointer.
 
void ReadString32Into (decString &string)
 Read string prefixed by a 4-bytes length field and advances the file pointer.
 
decString ReadVarString ()
 Read a variable string prefixed by a 1-4 bytes length field and advances the file pointer.
 
void ReadVarStringInto (decString &string)
 Read variable string prefixed by a 1-4 bytes length field and advances the file pointer.
 
decVector ReadVector ()
 Read a 3-float vector and advances the file pointer.
 
void ReadVectorInto (decVector &vector)
 Read a 3-float vector and advances the file pointer.
 
decVector2 ReadVector2 ()
 Read a 2-float vector and advances the file pointer.
 
void ReadVector2Into (decVector2 &vector)
 Read a 2-float vector and advances the file pointer.
 
decQuaternion ReadQuaternion ()
 Read a 4-float quaternion and advances the file pointer.
 
void ReadQuaternionInto (decQuaternion &quaternion)
 Read a 4-float quaternion and advances the file pointer.
 
decPoint ReadPoint ()
 Read a 2-int point and advances the file pointer.
 
void ReadPointInto (decPoint &point)
 Read a 2-int point and advances the file pointer.
 
decPoint3 ReadPoint3 ()
 Read a 3-int point and advances the file pointer.
 
void ReadPoint3Into (decPoint3 &point)
 Read a 3-int point and advances the file pointer.
 
decDVector ReadDVector ()
 Read a 3-double vector and advances the file pointer.
 
void ReadDVectorInto (decDVector &vector)
 Read a 3-double vector and advances the file pointer.
 
decColor ReadColor ()
 Read a 4-component color and advances the file pointer.
 
void ReadColorInto (decColor &color)
 Read a 4-component color and advances the file pointer.
 
decColor ReadColor3 ()
 Read a 3-component color and advances the file pointer.
 
void ReadColor3Into (decColor &color)
 Read a 3-component color and advances the file pointer.
 
void SkipChar ()
 Skip one byte and advances the file pointer.
 
void SkipByte ()
 Skip one unsigned byte and advances the file pointer.
 
void SkipShort ()
 Skip one short integer (2 bytes) and advances the file pointer.
 
void SkipUShort ()
 Skip one unsigned short integer (2 bytes) and advances the file pointer.
 
void SkipInt ()
 Skip one integer (4 bytes) and advances the file pointer.
 
void SkipUInt ()
 Skip one unsigned integer (4 bytes) and advances the file pointer.
 
void SkipLong ()
 Skip one integer (8 bytes) and advances the file pointer.
 
void SkipULong ()
 Skip one unsigned integer (8 bytes) and advances the file pointer.
 
void SkipVarUInt ()
 Skip variable length unsigned integer (1-4 bytes) and advances file pointer.
 
void SkipFloat ()
 Skip one float (4 bytes) and advances the file pointer.
 
void SkipDouble ()
 Skip one double (8 bytes) and advances the file pointer.
 
void SkipString8 ()
 Skip a string prefixed by a 1-byte length field and advances the file pointer.
 
void SkipString16 ()
 Skip a string prefixed by a 2-byte length field and advances the file pointer.
 
void SkipString32 ()
 Skip a string prefixed by a 4-byte length field and advances the file pointer.
 
void SkipVarString ()
 Skip a string prefixed by a 1-4 byte length field and advances the file pointer.
 
void SkipVector ()
 Skip a 3-float vector and advances the file pointer.
 
void SkipVector2 ()
 Skip a 2-float vector and advances the file pointer.
 
void SkipQuaternion ()
 Skip a 4-float quaternion and advances the file pointer.
 
void SkipPoint ()
 Skip a 2-int point and advances the file pointer.
 
void SkipPoint3 ()
 Skip a 3-int point and advances the file pointer.
 
void SkipDVector ()
 Skip a 3-double vector and advances the file pointer.
 
void SkipColor ()
 Skip a 4-component color and advances the file pointer.
 
void SkipColor3 ()
 Skip a 3-component color and advances the file pointer.
 
- Public Member Functions inherited from deObject
int GetRefCount () const
 Reference count.
 
void AddReference ()
 Add reference increasing reference count by 1.
 
void FreeReference ()
 Decrease reference count by one and delete object if count reaches 0.
 
cWeakRefDataAddWeakReference ()
 Add weak reference.
 
 deObject ()
 Create object with reference count of 1.
 

Constructors and Destructors

 decBaseFileReader ()
 Create file reader.
 
 ~decBaseFileReader () override
 Clean up file reader.
 

Additional Inherited Members

- Protected Member Functions inherited from deObject
virtual ~deObject ()
 Clean up object.
 

Detailed Description

File reader interface.

Member Typedef Documentation

◆ Ref

Type holding strong reference.

Constructor & Destructor Documentation

◆ decBaseFileReader()

decBaseFileReader::decBaseFileReader ( )

Create file reader.

◆ ~decBaseFileReader()

decBaseFileReader::~decBaseFileReader ( )
overrideprotected

Clean up file reader.

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 Ref decBaseFileReader::Duplicate ( )
pure virtual

◆ GetFilename()

virtual const char * decBaseFileReader::GetFilename ( )
pure virtual

◆ GetLength()

virtual int decBaseFileReader::GetLength ( )
pure virtual

◆ GetModificationTime()

virtual TIME_SYSTEM decBaseFileReader::GetModificationTime ( )
pure virtual

◆ GetPosition()

virtual int decBaseFileReader::GetPosition ( )
pure virtual

Current reading position in the file.

Implemented in decDiskFileReader, decMemoryFileReader, decWeakFileReader, decZFileReader, and deNetworkMessageReader.

◆ IsEOF()

bool decBaseFileReader::IsEOF ( )

File pointer is at the end of the file.

◆ MovePosition()

virtual void decBaseFileReader::MovePosition ( int  offset)
pure virtual

Move file position by the given offset.

Implemented in decDiskFileReader, decMemoryFileReader, decWeakFileReader, decZFileReader, and deNetworkMessageReader.

◆ Read()

virtual void decBaseFileReader::Read ( void *  buffer,
int  size 
)
pure virtual

Read size bytes into buffer and advances the file pointer.

Exceptions
deeInvalidParambuffer is NULL.
deeInvalidParamsize is less than 1.

Implemented in decDiskFileReader, decMemoryFileReader, decWeakFileReader, decZFileReader, and deNetworkMessageReader.

◆ ReadByte()

uint8_t decBaseFileReader::ReadByte ( )

Read one unsigned byte and advances the file pointer.

◆ ReadChar()

int8_t decBaseFileReader::ReadChar ( )

Read one byte and advances the file pointer.

◆ ReadColor()

decColor decBaseFileReader::ReadColor ( )

Read a 4-component color and advances the file pointer.

The color components are read in the order r, g, b and a.

◆ ReadColor3()

decColor decBaseFileReader::ReadColor3 ( )

Read a 3-component color and advances the file pointer.

The color components are read in the order r, g and b.

◆ ReadColor3Into()

void decBaseFileReader::ReadColor3Into ( decColor color)

Read a 3-component color and advances the file pointer.

The color components are read in the order r, g and b.

◆ ReadColorInto()

void decBaseFileReader::ReadColorInto ( decColor color)

Read a 4-component color and advances the file pointer.

The color components are read in the order r, g, b and a.

◆ ReadDouble()

double decBaseFileReader::ReadDouble ( )

Read one double (8 bytes) and advances the file pointer.

◆ ReadDVector()

decDVector decBaseFileReader::ReadDVector ( )

Read a 3-double vector and advances the file pointer.

The vector components are read in the order x, y and z.

◆ ReadDVectorInto()

void decBaseFileReader::ReadDVectorInto ( decDVector vector)

Read a 3-double vector and advances the file pointer.

The vector components are read in the order x, y and z.

◆ ReadFloat()

float decBaseFileReader::ReadFloat ( )

Read one float (4 bytes) and advances the file pointer.

◆ ReadInt()

int32_t decBaseFileReader::ReadInt ( )

Read one integer (4 bytes) and advances the file pointer.

◆ ReadLong()

int64_t decBaseFileReader::ReadLong ( )

Read one integer (8 bytes) and advances the file pointer.

◆ ReadPoint()

decPoint decBaseFileReader::ReadPoint ( )

Read a 2-int point and advances the file pointer.

The point components are read in the order x and y.

◆ ReadPoint3()

decPoint3 decBaseFileReader::ReadPoint3 ( )

Read a 3-int point and advances the file pointer.

The point components are read in the order x, y and z.

◆ ReadPoint3Into()

void decBaseFileReader::ReadPoint3Into ( decPoint3 point)

Read a 3-int point and advances the file pointer.

The point components are read in the order x, y and z.

◆ ReadPointInto()

void decBaseFileReader::ReadPointInto ( decPoint point)

Read a 2-int point and advances the file pointer.

The point components are read in the order x and y.

◆ ReadQuaternion()

decQuaternion decBaseFileReader::ReadQuaternion ( )

Read a 4-float quaternion and advances the file pointer.

The quaternion components are read in the order x, y, z and w.

◆ ReadQuaternionInto()

void decBaseFileReader::ReadQuaternionInto ( decQuaternion quaternion)

Read a 4-float quaternion and advances the file pointer.

The quaternion components are read in the order x, y, z and w.

◆ ReadShort()

int16_t decBaseFileReader::ReadShort ( )

Read one short integer (2 bytes) and advances the file pointer.

◆ ReadString16()

decString decBaseFileReader::ReadString16 ( )

Read a string prefixed by a 2-bytes length field and advances the file pointer.

The returned string pointer has to be freed by the caller itself.

◆ ReadString16Into()

void decBaseFileReader::ReadString16Into ( decString string)

Read string prefixed by a 2-bytes length field and advances the file pointer.

◆ ReadString32()

decString decBaseFileReader::ReadString32 ( )

Read a string prefixed by a 4-bytes length field and advances the file pointer.

The returned string pointer has to be freed by the caller itself.

◆ ReadString32Into()

void decBaseFileReader::ReadString32Into ( decString string)

Read string prefixed by a 4-bytes length field and advances the file pointer.

◆ ReadString8()

decString decBaseFileReader::ReadString8 ( )

Read a string prefixed by a 1-byte length field and advances the file pointer.

The returned string pointer has to be freed by the caller itself.

◆ ReadString8Into()

void decBaseFileReader::ReadString8Into ( decString string)

Read string prefixed by a 1-byte length field and advances the file pointer.

◆ ReadUInt()

uint32_t decBaseFileReader::ReadUInt ( )

Read one unsigned integer (4 bytes) and advances the file pointer.

◆ ReadULong()

uint64_t decBaseFileReader::ReadULong ( )

Read one unsigned integer (8 bytes) and advances the file pointer.

◆ ReadUShort()

uint16_t decBaseFileReader::ReadUShort ( )

Read one unsigned short integer (2 bytes) and advances the file pointer.

◆ ReadVarString()

decString decBaseFileReader::ReadVarString ( )

Read a variable string prefixed by a 1-4 bytes length field and advances the file pointer.

The length is stored as variable unsigned integer (ReadVarUInt). The returned string pointer has to be freed by the caller itself.

◆ ReadVarStringInto()

void decBaseFileReader::ReadVarStringInto ( decString string)

Read variable string prefixed by a 1-4 bytes length field and advances the file pointer.

The length is stored as variable unsigned integer (ReadVarUInt).

◆ ReadVarUInt()

uint32_t decBaseFileReader::ReadVarUInt ( )

Read variable length unsigned integer (1-4 bytes) and advances file pointer.

Variable length integers are written using 1 to 4 bytes. The highest 2 bits of the first byte stores the total length (0=1 byte, 1=2 bytes, 2=3 bytes, 3=4 bytes). The lower 6 bits are used as value. With each added byte the previous bits are shifted up. The maximum storable value is thus 1073741823.

Variable length unsigned integers are typically used for values like versions or revisions which start low and potentially grow large over time.

◆ ReadVector()

decVector decBaseFileReader::ReadVector ( )

Read a 3-float vector and advances the file pointer.

The vector components are read in the order x, y and z.

◆ ReadVector2()

decVector2 decBaseFileReader::ReadVector2 ( )

Read a 2-float vector and advances the file pointer.

The vector components are read in the order x and y.

◆ ReadVector2Into()

void decBaseFileReader::ReadVector2Into ( decVector2 vector)

Read a 2-float vector and advances the file pointer.

The vector components are read in the order x and y.

◆ ReadVectorInto()

void decBaseFileReader::ReadVectorInto ( decVector vector)

Read a 3-float vector and advances the file pointer.

The vector components are read in the order x, y and z.

◆ SetPosition()

virtual void decBaseFileReader::SetPosition ( int  position)
pure virtual

Set file position for the next read action.

Implemented in decDiskFileReader, decMemoryFileReader, decWeakFileReader, decZFileReader, and deNetworkMessageReader.

◆ SetPositionEnd()

virtual void decBaseFileReader::SetPositionEnd ( int  position)
pure virtual

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

Implemented in decDiskFileReader, decMemoryFileReader, decWeakFileReader, decZFileReader, and deNetworkMessageReader.

◆ SkipByte()

void decBaseFileReader::SkipByte ( )

Skip one unsigned byte and advances the file pointer.

◆ SkipChar()

void decBaseFileReader::SkipChar ( )

Skip one byte and advances the file pointer.

◆ SkipColor()

void decBaseFileReader::SkipColor ( )

Skip a 4-component color and advances the file pointer.

◆ SkipColor3()

void decBaseFileReader::SkipColor3 ( )

Skip a 3-component color and advances the file pointer.

◆ SkipDouble()

void decBaseFileReader::SkipDouble ( )

Skip one double (8 bytes) and advances the file pointer.

◆ SkipDVector()

void decBaseFileReader::SkipDVector ( )

Skip a 3-double vector and advances the file pointer.

◆ SkipFloat()

void decBaseFileReader::SkipFloat ( )

Skip one float (4 bytes) and advances the file pointer.

◆ SkipInt()

void decBaseFileReader::SkipInt ( )

Skip one integer (4 bytes) and advances the file pointer.

◆ SkipLong()

void decBaseFileReader::SkipLong ( )

Skip one integer (8 bytes) and advances the file pointer.

◆ SkipPoint()

void decBaseFileReader::SkipPoint ( )

Skip a 2-int point and advances the file pointer.

◆ SkipPoint3()

void decBaseFileReader::SkipPoint3 ( )

Skip a 3-int point and advances the file pointer.

◆ SkipQuaternion()

void decBaseFileReader::SkipQuaternion ( )

Skip a 4-float quaternion and advances the file pointer.

◆ SkipShort()

void decBaseFileReader::SkipShort ( )

Skip one short integer (2 bytes) and advances the file pointer.

◆ SkipString16()

void decBaseFileReader::SkipString16 ( )

Skip a string prefixed by a 2-byte length field and advances the file pointer.

◆ SkipString32()

void decBaseFileReader::SkipString32 ( )

Skip a string prefixed by a 4-byte length field and advances the file pointer.

◆ SkipString8()

void decBaseFileReader::SkipString8 ( )

Skip a string prefixed by a 1-byte length field and advances the file pointer.

◆ SkipUInt()

void decBaseFileReader::SkipUInt ( )

Skip one unsigned integer (4 bytes) and advances the file pointer.

◆ SkipULong()

void decBaseFileReader::SkipULong ( )

Skip one unsigned integer (8 bytes) and advances the file pointer.

◆ SkipUShort()

void decBaseFileReader::SkipUShort ( )

Skip one unsigned short integer (2 bytes) and advances the file pointer.

◆ SkipVarString()

void decBaseFileReader::SkipVarString ( )

Skip a string prefixed by a 1-4 byte length field and advances the file pointer.

◆ SkipVarUInt()

void decBaseFileReader::SkipVarUInt ( )

Skip variable length unsigned integer (1-4 bytes) and advances file pointer.

◆ SkipVector()

void decBaseFileReader::SkipVector ( )

Skip a 3-float vector and advances the file pointer.

◆ SkipVector2()

void decBaseFileReader::SkipVector2 ( )

Skip a 2-float vector and advances the file pointer.


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