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...
 
uint32 writeStream (ReadStream *stream, uint32 dataSize)
 Write data from another stream to this one. More...
 
uint32 writeStream (SeekableReadStream *stream)
 
void writeString (const String &str)
 Write the given string to the stream. More...
 
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...
 
void writeByte (uint8 value)
 
void writeSByte (sint8 value)
 
void writeUint16LE (uint16 value)
 
void writeUint32LE (uint32 value)
 
void writeUint16BE (uint16 value)
 
void writeUint32BE (uint32 value)
 
FORCEINLINE void writeSint16LE (sint16 value)
 
FORCEINLINE void writeSint32LE (sint32 value)
 
FORCEINLINE void writeSint16BE (sint16 value)
 
FORCEINLINE void writeSint32BE (sint32 value)
 
void writeString (const Std::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...
 
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 65 of file stream.h.

Member Function Documentation

◆ finalize() [1/2]

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 Xeen::OutFile, Xeen::SubWriteStream, Common::GZipWriteStream, OutVMSave, OutPAKSave, OutFRAMSave, and Common::OutSaveFile.

Definition at line 99 of file stream.h.

◆ finalize() [2/2]

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 Xeen::OutFile, Xeen::SubWriteStream, Common::GZipWriteStream, OutVMSave, OutPAKSave, OutFRAMSave, and Common::OutSaveFile.

Definition at line 103 of file stream.h.

◆ flush() [1/2]

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.

Returns
true on success, false in case of a failure

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

Definition at line 84 of file stream.h.

◆ flush() [2/2]

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, Common::DumpFile, BladeRunner::SaveFileWriteStream, StdioStream, DS::DSFileStream, PS2FileStream, PspIoStream, TizenFileStream, Common::OutSaveFile, StdioStream, RomfsStream, and SymbianStdioStream.

Definition at line 90 of file stream.h.

◆ pos()

◆ write() [1/2]

◆ write() [2/2]

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

◆ writeByte() [1/2]

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

Definition at line 119 of file stream.h.

◆ writeByte() [2/2]

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

Definition at line 107 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 224 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 211 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 199 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 186 of file stream.h.

◆ writeSByte() [1/2]

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

Definition at line 123 of file stream.h.

◆ writeSByte() [2/2]

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

Definition at line 111 of file stream.h.

◆ writeSint16BE() [1/2]

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

Definition at line 169 of file stream.h.

◆ writeSint16BE() [2/2]

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

Definition at line 143 of file stream.h.

◆ writeSint16LE() [1/2]

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

Definition at line 157 of file stream.h.

◆ writeSint16LE() [2/2]

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

Definition at line 135 of file stream.h.

◆ writeSint32BE() [1/2]

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

Definition at line 173 of file stream.h.

◆ writeSint32BE() [2/2]

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

Definition at line 147 of file stream.h.

◆ writeSint32LE() [1/2]

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

Definition at line 161 of file stream.h.

◆ writeSint32LE() [2/2]

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

Definition at line 139 of file stream.h.

◆ writeSint64BE()

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

Definition at line 177 of file stream.h.

◆ writeSint64LE()

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

Definition at line 165 of file stream.h.

◆ writeStream() [1/2]

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

Write data from another stream to this one.

Definition at line 31 of file stream.cpp.

◆ writeStream() [2/2]

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

Definition at line 40 of file stream.cpp.

◆ writeString() [1/2]

void Common::WriteStream::writeString ( const Std::string &  str)

Write the given string to the stream.

This writes str.size() characters, but no terminating zero byte.

◆ writeString() [2/2]

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 44 of file stream.cpp.

◆ writeUint16BE() [1/2]

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

Definition at line 125 of file stream.h.

◆ writeUint16BE() [2/2]

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

Definition at line 142 of file stream.h.

◆ writeUint16LE() [1/2]

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

Definition at line 115 of file stream.h.

◆ writeUint16LE() [2/2]

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

Definition at line 127 of file stream.h.

◆ writeUint32BE() [1/2]

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

Definition at line 130 of file stream.h.

◆ writeUint32BE() [2/2]

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

Definition at line 147 of file stream.h.

◆ writeUint32LE() [1/2]

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

Definition at line 120 of file stream.h.

◆ writeUint32LE() [2/2]

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

Definition at line 132 of file stream.h.

◆ writeUint64BE()

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

Definition at line 152 of file stream.h.

◆ writeUint64LE()

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

Definition at line 137 of file stream.h.


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