Drag[en]gine Game Engine  1.21
decBaseFileWriter Class Referenceabstract

File writer interface. More...

#include <decBaseFileWriter.h>

Inheritance diagram for decBaseFileWriter:
deObject deNetworkMessageWriter decDiskFileWriter decMemoryFileWriter decNullFileWriter decWeakFileWriter decZFileWriter

Public Types

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

Public Member Functions

Management
virtual const char * GetFilename ()=0
 Name of the file. More...
 
virtual int GetPosition ()=0
 Current writing position in the file. More...
 
virtual void SetPosition (int position)=0
 Set file position for the next write action. More...
 
virtual void MovePosition (int offset)=0
 Move file position by the given offset. More...
 
virtual void SetPositionEnd (int position)=0
 Set file position to the given position measured from the end of the file. More...
 
virtual void Write (const void *buffer, int size)=0
 Write size bytes from buffer and advances the file pointer. More...
 
virtual Ref Duplicate ()=0
 Duplicate file writer. More...
 
Helper Functions
void WriteChar (int8_t value)
 Write one byte to file and advances write pointer. More...
 
void WriteByte (uint8_t value)
 Write one unsigned byte to file and advances write pointer. More...
 
void WriteShort (int16_t value)
 Write one short integer (2 bytes) to file and advances write pointer. More...
 
void WriteUShort (uint16_t value)
 Write one unsigned short integer (2 bytes) to file and advances write pointer. More...
 
void WriteInt (int32_t value)
 Write one integer (4 bytes) to file and advances write pointer. More...
 
void WriteUInt (uint32_t value)
 Write one unsigned integer (4 bytes) to file and advances write pointer. More...
 
void WriteLong (int64_t value)
 Write one integer (8 bytes) to file and advances write pointer. More...
 
void WriteULong (uint64_t value)
 Write one unsigned integer (8 bytes) to file and advances write pointer. More...
 
void WriteFloat (float value)
 Write one float (4 bytes) to file and advances write pointer. More...
 
void WriteDouble (double value)
 Write one double (8 bytes) to file and advances write pointer. More...
 
void WriteString (const char *string)
 Write string-length bytes of string to file without length field and advances write pointer. More...
 
void WriteString8 (const char *string)
 Write string-length bytes of string to file with a 1-byte length field in front and advances write pointer. More...
 
void WriteString16 (const char *string)
 Write string-length bytes of string to file with a 2-byte length field in front and advances write pointer. More...
 
void WriteVector (const decVector &vector)
 Write a 3-float vector to the file ( order x, y, z ) and advances write pointer. More...
 
void WriteVector2 (const decVector2 &vector)
 Write a 2-float vector to the file ( order x, y, z ) and advances write pointer. More...
 
void WriteQuaternion (const decQuaternion &quaternion)
 Write a 4-float quaternion to the file ( order x, y, z, w ) and advances write pointer. More...
 
void WritePoint (const decPoint &point)
 Write a 2-int point to the file ( order x, y ) and advances write pointer. More...
 
void WritePoint3 (const decPoint3 &point)
 Write a 3-int point to the file ( order x, y, z ) and advances write pointer. More...
 
void WriteDVector (const decDVector &vector)
 Write a 3-double vector to the file ( order x, y, z ) and advances write pointer. More...
 
void WriteColor (const decColor &color)
 Write a 4-component color to the file ( order r, g, b, a ) and advances write pointer. More...
 
void WriteColor3 (const decColor &color)
 Write a 3-component color to the file ( order r, g, b, a ) and advances write pointer. 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...
 

Constructors and Destructors

 decBaseFileWriter ()
 Create file writer. More...
 
virtual ~decBaseFileWriter ()
 Clean up file writer. More...
 

Additional Inherited Members

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

Detailed Description

File writer interface.

File writers can support seeking but are not required to. If seeking is not supported an exception is thrown.

Member Typedef Documentation

◆ Ref

Type holding strong reference.

Constructor & Destructor Documentation

◆ decBaseFileWriter()

decBaseFileWriter::decBaseFileWriter ( )

Create file writer.

◆ ~decBaseFileWriter()

virtual decBaseFileWriter::~decBaseFileWriter ( )
protectedvirtual

Clean up file writer.

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

◆ GetFilename()

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

◆ GetPosition()

virtual int decBaseFileWriter::GetPosition ( )
pure virtual

◆ MovePosition()

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

Move file position by the given offset.

Implemented in deNetworkMessageWriter, decZFileWriter, decWeakFileWriter, decNullFileWriter, decMemoryFileWriter, and decDiskFileWriter.

◆ SetPosition()

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

Set file position for the next write action.

Implemented in deNetworkMessageWriter, decZFileWriter, decWeakFileWriter, decNullFileWriter, decMemoryFileWriter, and decDiskFileWriter.

◆ SetPositionEnd()

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

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

Implemented in deNetworkMessageWriter, decZFileWriter, decWeakFileWriter, decNullFileWriter, decMemoryFileWriter, and decDiskFileWriter.

◆ Write()

virtual void decBaseFileWriter::Write ( const void *  buffer,
int  size 
)
pure virtual

Write size bytes from buffer and advances the file pointer.

Exceptions
deeInvalidParambuffer is NULL.
deeInvalidParamsize is less than 0.

Implemented in deNetworkMessageWriter, decZFileWriter, decWeakFileWriter, decNullFileWriter, decMemoryFileWriter, and decDiskFileWriter.

◆ WriteByte()

void decBaseFileWriter::WriteByte ( uint8_t  value)

Write one unsigned byte to file and advances write pointer.

◆ WriteChar()

void decBaseFileWriter::WriteChar ( int8_t  value)

Write one byte to file and advances write pointer.

◆ WriteColor()

void decBaseFileWriter::WriteColor ( const decColor color)

Write a 4-component color to the file ( order r, g, b, a ) and advances write pointer.

◆ WriteColor3()

void decBaseFileWriter::WriteColor3 ( const decColor color)

Write a 3-component color to the file ( order r, g, b, a ) and advances write pointer.

◆ WriteDouble()

void decBaseFileWriter::WriteDouble ( double  value)

Write one double (8 bytes) to file and advances write pointer.

◆ WriteDVector()

void decBaseFileWriter::WriteDVector ( const decDVector vector)

Write a 3-double vector to the file ( order x, y, z ) and advances write pointer.

◆ WriteFloat()

void decBaseFileWriter::WriteFloat ( float  value)

Write one float (4 bytes) to file and advances write pointer.

◆ WriteInt()

void decBaseFileWriter::WriteInt ( int32_t  value)

Write one integer (4 bytes) to file and advances write pointer.

◆ WriteLong()

void decBaseFileWriter::WriteLong ( int64_t  value)

Write one integer (8 bytes) to file and advances write pointer.

◆ WritePoint()

void decBaseFileWriter::WritePoint ( const decPoint point)

Write a 2-int point to the file ( order x, y ) and advances write pointer.

◆ WritePoint3()

void decBaseFileWriter::WritePoint3 ( const decPoint3 point)

Write a 3-int point to the file ( order x, y, z ) and advances write pointer.

◆ WriteQuaternion()

void decBaseFileWriter::WriteQuaternion ( const decQuaternion quaternion)

Write a 4-float quaternion to the file ( order x, y, z, w ) and advances write pointer.

◆ WriteShort()

void decBaseFileWriter::WriteShort ( int16_t  value)

Write one short integer (2 bytes) to file and advances write pointer.

◆ WriteString()

void decBaseFileWriter::WriteString ( const char *  string)

Write string-length bytes of string to file without length field and advances write pointer.

◆ WriteString16()

void decBaseFileWriter::WriteString16 ( const char *  string)

Write string-length bytes of string to file with a 2-byte length field in front and advances write pointer.

◆ WriteString8()

void decBaseFileWriter::WriteString8 ( const char *  string)

Write string-length bytes of string to file with a 1-byte length field in front and advances write pointer.

◆ WriteUInt()

void decBaseFileWriter::WriteUInt ( uint32_t  value)

Write one unsigned integer (4 bytes) to file and advances write pointer.

◆ WriteULong()

void decBaseFileWriter::WriteULong ( uint64_t  value)

Write one unsigned integer (8 bytes) to file and advances write pointer.

◆ WriteUShort()

void decBaseFileWriter::WriteUShort ( uint16_t  value)

Write one unsigned short integer (2 bytes) to file and advances write pointer.

◆ WriteVector()

void decBaseFileWriter::WriteVector ( const decVector vector)

Write a 3-float vector to the file ( order x, y, z ) and advances write pointer.

◆ WriteVector2()

void decBaseFileWriter::WriteVector2 ( const decVector2 vector)

Write a 2-float vector to the file ( order x, y, z ) and advances write pointer.


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