ScummVM
Common::WriteStream Class Referenceabstract

Generic interface for a writable data stream. More...

#include <stream.h>

Inheritance diagram for Common::WriteStream:
Collaboration diagram for Common::WriteStream:

Public Member Functions

virtual uint32 write (const void *dataPtr, uint32 dataSize)=0
 Write data into the stream. More...
 
virtual bool flush ()
 Commit any buffered data to the underlying channel or storage medium; unbuffered streams can use the default implementation. More...
 
virtual void finalize ()
 Finalize and close this stream. More...
 
virtual int32 pos () const =0
 Obtains the current value of the stream position indicator of the stream. More...
 
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)
 Write the given 32-bit floating point value stored in little endian(LSB first) order into the stream. More...
 
FORCEINLINE void writeFloatBE (float value)
 Write the given 32-bit floating point value stored in big endian order into the stream. More...
 
FORCEINLINE void writeDoubleLE (double value)
 Write the given 64-bit floating point value stored in little endian(LSB first) order into the stream. More...
 
FORCEINLINE void writeDoubleBE (double value)
 Write the given 64-bit floating point value stored in big endian order into the stream. More...
 
void writeString (const String &str)
 Write the given string to the stream. More...
 
- Public Member Functions inherited from Common::Stream
virtual ~Stream ()
 
virtual bool err () const
 Returns true if an I/O failure occurred. More...
 
virtual void clearErr ()
 Reset the I/O error status as returned by err(). More...
 

Detailed Description

Generic interface for a writable data stream.

Definition at line 64 of file stream.h.

Member Function Documentation

◆ finalize()

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

Finalize and close this stream.

To be called right before this stream instance is deleted. The goal here is to enable calling code to detect and handle I/O errors which might occur when closing (and this flushing, if buffered) the stream.

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

By default, this just flushes the stream.

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

Definition at line 102 of file stream.h.

◆ flush()

virtual bool Common::WriteStream::flush ( void  )
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 are supposed to match those of ISO C fflush().
Returns
true on success, false in case of a failure

Reimplemented in Xeen::SubWriteStream, DS::DSFileStream, Common::DumpFile, PS2FileStream, BladeRunner::SaveFileWriteStream, PspIoStream, TizenFileStream, Common::OutSaveFile, RomfsStream, StdioStream, and SymbianStdioStream.

Definition at line 89 of file stream.h.

◆ pos()

◆ 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 are supposed to match those of ISO C fwrite().
Parameters
dataPtrpointer to the data to be written
dataSizenumber of bytes to be written
Returns
the number of bytes which were actually written.

Implemented in Common::GZipWriteStream, Xeen::OutFile, Common::MemoryReadWriteStream, OutVMSave, Xeen::SubWriteStream, Common::MemoryWriteStreamDynamic, DS::DSFileStream, Common::DumpFile, Sci::SaveFileRewriteStream, LastExpress::SavegameStream, PS2FileStream, Common::MemoryWriteStream, BladeRunner::SaveFileWriteStream, Fullpipe::MfcArchive, Glk::Quest::Logger::Nullstreambuf, PspIoStream, OutFRAMSave, OutPAKSave, TizenFileStream, Common::OutSaveFile, RomfsStream, StdioStream, SymbianStdioStream, and Glk::Quest::ConsoleStream.

◆ writeByte()

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

Definition at line 118 of file stream.h.

◆ writeDoubleBE()

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

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

Definition at line 223 of file stream.h.

◆ writeDoubleLE()

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

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

Definition at line 210 of file stream.h.

◆ writeFloatBE()

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

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

Definition at line 198 of file stream.h.

◆ writeFloatLE()

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

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

Definition at line 185 of file stream.h.

◆ writeSByte()

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

Definition at line 122 of file stream.h.

◆ writeSint16BE()

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

Definition at line 168 of file stream.h.

◆ writeSint16LE()

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

Definition at line 156 of file stream.h.

◆ writeSint32BE()

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

Definition at line 172 of file stream.h.

◆ writeSint32LE()

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

Definition at line 160 of file stream.h.

◆ writeSint64BE()

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

Definition at line 176 of file stream.h.

◆ writeSint64LE()

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

Definition at line 164 of file stream.h.

◆ 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.

Definition at line 31 of file stream.cpp.

◆ writeUint16BE()

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

Definition at line 141 of file stream.h.

◆ writeUint16LE()

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

Definition at line 126 of file stream.h.

◆ writeUint32BE()

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

Definition at line 146 of file stream.h.

◆ writeUint32LE()

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

Definition at line 131 of file stream.h.

◆ writeUint64BE()

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

Definition at line 151 of file stream.h.

◆ writeUint64LE()

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

Definition at line 136 of file stream.h.


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