|
Drag[en]gine Game Engine 1.32.3
|
File reader interface. More...
#include <decBaseFileReader.h>
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. | |
| cWeakRefData * | AddWeakReference () |
| 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. | |
File reader interface.
Type holding strong reference.
| decBaseFileReader::decBaseFileReader | ( | ) |
Create file reader.
|
overrideprotected |
Clean up file reader.
|
pure virtual |
Duplicate file reader.
Implemented in decDiskFileReader, decMemoryFileReader, decWeakFileReader, decZFileReader, and deNetworkMessageReader.
|
pure virtual |
Name of the file.
Implemented in decDiskFileReader, decMemoryFileReader, decWeakFileReader, decZFileReader, and deNetworkMessageReader.
|
pure virtual |
Length of the file.
Implemented in decDiskFileReader, decMemoryFileReader, decWeakFileReader, decZFileReader, and deNetworkMessageReader.
|
pure virtual |
Modification time.
Implemented in decDiskFileReader, decMemoryFileReader, decWeakFileReader, decZFileReader, and deNetworkMessageReader.
|
pure virtual |
Current reading position in the file.
Implemented in decDiskFileReader, decMemoryFileReader, decWeakFileReader, decZFileReader, and deNetworkMessageReader.
| bool decBaseFileReader::IsEOF | ( | ) |
File pointer is at the end of the file.
|
pure virtual |
Move file position by the given offset.
Implemented in decDiskFileReader, decMemoryFileReader, decWeakFileReader, decZFileReader, and deNetworkMessageReader.
|
pure virtual |
Read size bytes into buffer and advances the file pointer.
| deeInvalidParam | buffer is NULL. |
| deeInvalidParam | size is less than 1. |
Implemented in decDiskFileReader, decMemoryFileReader, decWeakFileReader, decZFileReader, and deNetworkMessageReader.
| uint8_t decBaseFileReader::ReadByte | ( | ) |
Read one unsigned byte and advances the file pointer.
| int8_t decBaseFileReader::ReadChar | ( | ) |
Read one byte and advances the file pointer.
| 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.
| 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.
| 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.
| 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.
| double decBaseFileReader::ReadDouble | ( | ) |
Read one double (8 bytes) and advances the file pointer.
| 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.
| 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.
| float decBaseFileReader::ReadFloat | ( | ) |
Read one float (4 bytes) and advances the file pointer.
| int32_t decBaseFileReader::ReadInt | ( | ) |
Read one integer (4 bytes) and advances the file pointer.
| int64_t decBaseFileReader::ReadLong | ( | ) |
Read one integer (8 bytes) and advances the file pointer.
| decPoint decBaseFileReader::ReadPoint | ( | ) |
Read a 2-int point and advances the file pointer.
The point components are read in the order x and y.
| 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.
| 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.
| 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.
| 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.
| 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.
| int16_t decBaseFileReader::ReadShort | ( | ) |
Read one short integer (2 bytes) and advances the file pointer.
| 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.
| void decBaseFileReader::ReadString16Into | ( | decString & | string | ) |
Read string prefixed by a 2-bytes length field and advances the file pointer.
| 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.
| void decBaseFileReader::ReadString32Into | ( | decString & | string | ) |
Read string prefixed by a 4-bytes length field and advances the file pointer.
| 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.
| void decBaseFileReader::ReadString8Into | ( | decString & | string | ) |
Read string prefixed by a 1-byte length field and advances the file pointer.
| uint32_t decBaseFileReader::ReadUInt | ( | ) |
Read one unsigned integer (4 bytes) and advances the file pointer.
| uint64_t decBaseFileReader::ReadULong | ( | ) |
Read one unsigned integer (8 bytes) and advances the file pointer.
| uint16_t decBaseFileReader::ReadUShort | ( | ) |
Read one unsigned short integer (2 bytes) and advances the file pointer.
| 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.
| 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).
| 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.
| 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.
| decVector2 decBaseFileReader::ReadVector2 | ( | ) |
Read a 2-float vector and advances the file pointer.
The vector components are read in the order x and y.
| 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.
| 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.
|
pure virtual |
Set file position for the next read action.
Implemented in decDiskFileReader, decMemoryFileReader, decWeakFileReader, decZFileReader, and deNetworkMessageReader.
|
pure virtual |
Set file position to the given position measured from the end of the file.
Implemented in decDiskFileReader, decMemoryFileReader, decWeakFileReader, decZFileReader, and deNetworkMessageReader.
| void decBaseFileReader::SkipByte | ( | ) |
Skip one unsigned byte and advances the file pointer.
| void decBaseFileReader::SkipChar | ( | ) |
Skip one byte and advances the file pointer.
| void decBaseFileReader::SkipColor | ( | ) |
Skip a 4-component color and advances the file pointer.
| void decBaseFileReader::SkipColor3 | ( | ) |
Skip a 3-component color and advances the file pointer.
| void decBaseFileReader::SkipDouble | ( | ) |
Skip one double (8 bytes) and advances the file pointer.
| void decBaseFileReader::SkipDVector | ( | ) |
Skip a 3-double vector and advances the file pointer.
| void decBaseFileReader::SkipFloat | ( | ) |
Skip one float (4 bytes) and advances the file pointer.
| void decBaseFileReader::SkipInt | ( | ) |
Skip one integer (4 bytes) and advances the file pointer.
| void decBaseFileReader::SkipLong | ( | ) |
Skip one integer (8 bytes) and advances the file pointer.
| void decBaseFileReader::SkipPoint | ( | ) |
Skip a 2-int point and advances the file pointer.
| void decBaseFileReader::SkipPoint3 | ( | ) |
Skip a 3-int point and advances the file pointer.
| void decBaseFileReader::SkipQuaternion | ( | ) |
Skip a 4-float quaternion and advances the file pointer.
| void decBaseFileReader::SkipShort | ( | ) |
Skip one short integer (2 bytes) and advances the file pointer.
| void decBaseFileReader::SkipString16 | ( | ) |
Skip a string prefixed by a 2-byte length field and advances the file pointer.
| void decBaseFileReader::SkipString32 | ( | ) |
Skip a string prefixed by a 4-byte length field and advances the file pointer.
| void decBaseFileReader::SkipString8 | ( | ) |
Skip a string prefixed by a 1-byte length field and advances the file pointer.
| void decBaseFileReader::SkipUInt | ( | ) |
Skip one unsigned integer (4 bytes) and advances the file pointer.
| void decBaseFileReader::SkipULong | ( | ) |
Skip one unsigned integer (8 bytes) and advances the file pointer.
| void decBaseFileReader::SkipUShort | ( | ) |
Skip one unsigned short integer (2 bytes) and advances the file pointer.
| void decBaseFileReader::SkipVarString | ( | ) |
Skip a string prefixed by a 1-4 byte length field and advances the file pointer.
| void decBaseFileReader::SkipVarUInt | ( | ) |
Skip variable length unsigned integer (1-4 bytes) and advances file pointer.
| void decBaseFileReader::SkipVector | ( | ) |
Skip a 3-float vector and advances the file pointer.
| void decBaseFileReader::SkipVector2 | ( | ) |
Skip a 2-float vector and advances the file pointer.