ScummVM API documentation
Common::WriteStream Class Referenceabstract

#include <stream.h>

Inheritance diagram for Common::WriteStream:
Common::Stream BladeRunner::SaveFileWriteStream Common::SeekableWriteStream MM::Xeen::OutFile MM::Xeen::SubWriteStream NGI::MfcArchive OutFRAMSave OutPAKSave Common::DumpFile Common::MemoryReadWriteStream Common::MemorySeekableReadWriteStream Common::MemoryWriteStream Common::MemoryWriteStreamDynamic Common::OutSaveFile PspIoStream RomfsStream StdioStream Twp::OutMemStream

Public Member Functions

virtual uint32 write (const void *dataPtr, uint32 dataSize)=0
 
virtual bool flush ()
 
virtual void finalize ()
 
virtual int64 pos () const =0
 
Functions for writing data

The following methods all have default implementations. Subclasses need not (and should not) overload them.

void writeByte (byte value)
 
void writeSByte (int8 value)
 
void writeUint16LE (uint16 value)
 
void writeUint32LE (uint32 value)
 
void writeUint64LE (uint64 value)
 
void writeUint16BE (uint16 value)
 
void writeUint32BE (uint32 value)
 
void writeUint64BE (uint64 value)
 
FORCEINLINE void writeSint16LE (int16 value)
 
FORCEINLINE void writeSint32LE (int32 value)
 
FORCEINLINE void writeSint64LE (int64 value)
 
FORCEINLINE void writeSint16BE (int16 value)
 
FORCEINLINE void writeSint32BE (int32 value)
 
FORCEINLINE void writeSint64BE (int64 value)
 
FORCEINLINE void writeFloatLE (float value)
 
FORCEINLINE void writeFloatBE (float value)
 
FORCEINLINE void writeDoubleLE (double value)
 
FORCEINLINE void writeDoubleBE (double value)
 
template<class TDataFormat , class... T>
bool writeMultiple (const TDataFormat &dataFormat, const T &...values)
 
template<class... T>
bool writeMultipleEndian (bool isLittle, const T &...values)
 
template<class... T>
bool writeMultipleLE (const T &...values)
 
template<class... T>
bool writeMultipleBE (const T &...values)
 
uint32 writeStream (ReadStream *stream, uint32 dataSize)
 
uint32 writeStream (ReadStream *stream)
 
void writeString (const String &str)
 
- Public Member Functions inherited from Common::Stream
virtual bool err () const
 
virtual void clearErr ()
 

Detailed Description

Generic interface for a writable data stream.

Member Function Documentation

◆ write()

virtual uint32 Common::WriteStream::write ( const void *  dataPtr,
uint32  dataSize 
)
pure virtual

Write data into the stream. Subclasses must implement this method. All other write methods are implemented using it.

Note
The semantics of any implementation of this method is supposed to match that of ISO C fwrite().
Parameters
dataPtrPointer to the data to be written.
dataSizeNumber of bytes to be written.
Returns
The number of bytes that were actually written.

Implemented in Common::MemorySeekableReadWriteStream, Common::MemoryReadWriteStream, Common::MemoryWriteStreamDynamic, MM::Xeen::OutFile, Common::DumpFile, Common::MemoryWriteStream, MM::Xeen::SubWriteStream, LastExpress::SavegameStream, Common::OutSaveFile, BladeRunner::SaveFileWriteStream, NGI::MfcArchive, PspIoStream, OutFRAMSave, OutPAKSave, Twp::OutMemStream, StdioStream, and RomfsStream.

◆ flush()

virtual bool Common::WriteStream::flush ( )
inlinevirtual

Commit any buffered data to the underlying channel or storage medium. Unbuffered streams can use the default implementation.

Note
The semantics of any implementation of this method is supposed to match that of ISO C fflush().
Returns
True on success, false in case of a failure.

Reimplemented in Common::DumpFile, MM::Xeen::SubWriteStream, BladeRunner::SaveFileWriteStream, Common::OutSaveFile, PspIoStream, StdioStream, and RomfsStream.

◆ finalize()

virtual void Common::WriteStream::finalize ( )
inlinevirtual

Finalize and close this stream.

Call this method right before this stream instance is deleted. The goal is to enable the client code to detect and handle I/O errors that might occur when closing (and flushing, if buffered) the stream.

After this method has been called, no further writes can be performed on the stream. Calling err() is allowed.

By default, this just flushes the stream.

Reimplemented in MM::Xeen::OutFile, MM::Xeen::SubWriteStream, OutPAKSave, OutFRAMSave, and Common::OutSaveFile.

◆ pos()

◆ writeByte()

void Common::WriteStream::writeByte ( byte  value)
inline

Write the given byte to the current position in the stream.

◆ writeSByte()

void Common::WriteStream::writeSByte ( int8  value)
inline

Write the given signed byte to the current position in the stream.

◆ writeUint16LE()

void Common::WriteStream::writeUint16LE ( uint16  value)
inline

Write an unsigned 16-bit word stored in little endian order into the stream.

◆ writeUint32LE()

void Common::WriteStream::writeUint32LE ( uint32  value)
inline

Write an unsigned 32-bit word stored in little endian order into the stream.

◆ writeUint64LE()

void Common::WriteStream::writeUint64LE ( uint64  value)
inline

Write an unsigned 64-bit word stored in little endian order into the stream.

◆ writeUint16BE()

void Common::WriteStream::writeUint16BE ( uint16  value)
inline

Write an unsigned 16-bit word stored in big endian order into the stream.

◆ writeUint32BE()

void Common::WriteStream::writeUint32BE ( uint32  value)
inline

Write an unsigned 32-bit word stored in big endian order into the stream.

◆ writeUint64BE()

void Common::WriteStream::writeUint64BE ( uint64  value)
inline

Write an unsigned 64-bit word stored in big endian order into the stream.

◆ writeSint16LE()

FORCEINLINE void Common::WriteStream::writeSint16LE ( int16  value)
inline

Write a signed 16-bit word stored in little endian order into the stream.

◆ writeSint32LE()

FORCEINLINE void Common::WriteStream::writeSint32LE ( int32  value)
inline

Write a signed 32-bit word stored in little endian order into the stream.

◆ writeSint64LE()

FORCEINLINE void Common::WriteStream::writeSint64LE ( int64  value)
inline

Write a signed 64-bit word stored in little endian order into the stream.

◆ writeSint16BE()

FORCEINLINE void Common::WriteStream::writeSint16BE ( int16  value)
inline

Write a signed 16-bit word stored in big endian order into the stream.

◆ writeSint32BE()

FORCEINLINE void Common::WriteStream::writeSint32BE ( int32  value)
inline

Write a signed 32-bit word stored in big endian order into the stream.

◆ writeSint64BE()

FORCEINLINE void Common::WriteStream::writeSint64BE ( int64  value)
inline

Write a signed 64-bit word stored in big endian order into the stream.

◆ writeFloatLE()

FORCEINLINE void Common::WriteStream::writeFloatLE ( float  value)
inline

Write a 32-bit floating point value stored in little endian (LSB first) order into the stream.

◆ writeFloatBE()

FORCEINLINE void Common::WriteStream::writeFloatBE ( float  value)
inline

Write a 32-bit floating point value stored in big endian order into the stream.

◆ writeDoubleLE()

FORCEINLINE void Common::WriteStream::writeDoubleLE ( double  value)
inline

Write a 64-bit floating point value (with decimals) stored in little endian (LSB first) order into the stream.

◆ writeDoubleBE()

FORCEINLINE void Common::WriteStream::writeDoubleBE ( double  value)
inline

Write the given 64-bit floating point value (with decimals) stored in big endian order into the stream.

◆ writeMultiple()

template<class TDataFormat , class... T>
bool Common::WriteStream::writeMultiple ( const TDataFormat &  dataFormat,
const T &...  values 
)
inline

Write multiple values to the stream using a specified data format, return true on success and false on failure.

◆ writeMultipleEndian()

template<class... T>
bool Common::WriteStream::writeMultipleEndian ( bool  isLittle,
const T &...  values 
)
inline

Write multiple values to the stream using a specified endianness, return true on success and false on failure.

◆ writeMultipleLE()

template<class... T>
bool Common::WriteStream::writeMultipleLE ( const T &...  values)
inline

Write multiple values to the stream in little endian format, return true on success and false on failure.

◆ writeMultipleBE()

template<class... T>
bool Common::WriteStream::writeMultipleBE ( const T &...  values)
inline

Write multiple values to the stream in big endian format, return true on success and false on failure.

◆ writeStream() [1/2]

uint32 Common::WriteStream::writeStream ( ReadStream stream,
uint32  dataSize 
)

Write at most dataSize of data from another stream into this one, starting from the current stream position.

Returns
The number of bytes written into the stream.

◆ writeStream() [2/2]

uint32 Common::WriteStream::writeStream ( ReadStream stream)

Write data from another stream into this one, starting from its current position to the end of the stream.

Returns
The number of bytes written into the stream.

◆ writeString()

void Common::WriteStream::writeString ( const String str)

Write the given string to the stream. This writes str.size() characters, but no terminating zero byte.


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