ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

Common::MemoryWriteStream Class Reference

Simple memory based 'stream', which implements the WriteStream interface for a plain memory block. More...

#include <memstream.h>

Inheritance diagram for Common::MemoryWriteStream:
Collaboration diagram for Common::MemoryWriteStream:

List of all members.

Public Member Functions

 MemoryWriteStream (byte *buf, uint32 len)
uint32 write (const void *dataPtr, uint32 dataSize)
 Write data into the stream.
virtual int32 pos () const override
 Obtains the current value of the stream position indicator of the stream.
virtual int32 size () const override
 Obtains the current size of the stream, measured in bytes.
virtual bool err () const override
 Returns true if an I/O failure occurred.
virtual void clearErr () override
 Reset the I/O error status as returned by err().
virtual bool seek (int32 offset, int whence=SEEK_SET) override
 Sets the stream position indicator for the stream.

Protected Attributes

byte_ptr
uint32 _pos
bool _err

Private Attributes

const uint32 _bufSize

Detailed Description

Simple memory based 'stream', which implements the WriteStream interface for a plain memory block.

Definition at line 91 of file memstream.h.


Constructor & Destructor Documentation

Common::MemoryWriteStream::MemoryWriteStream ( byte buf,
uint32  len 
) [inline]

Definition at line 99 of file memstream.h.


Member Function Documentation

virtual void Common::MemoryWriteStream::clearErr (  )  [inline, override, virtual]

Reset the I/O error status as returned by err().

For a ReadStream, also reset the end-of-stream status returned by eos().

Note:
The semantics of any implementation of this method are supposed to match those of ISO C clearerr().

Reimplemented from Common::Stream.

Definition at line 118 of file memstream.h.

virtual bool Common::MemoryWriteStream::err (  )  const [inline, override, virtual]

Returns true if an I/O failure occurred.

This flag is never cleared automatically. In order to clear it, client code has to call clearErr() explicitly.

Note:
The semantics of any implementation of this method are supposed to match those of ISO C ferror().

Reimplemented from Common::Stream.

Definition at line 117 of file memstream.h.

virtual int32 Common::MemoryWriteStream::pos (  )  const [inline, override, virtual]

Obtains the current value of the stream position indicator of the stream.

Returns:
the current position indicator, or -1 if an error occurred.

Implements Common::WriteStream.

Definition at line 114 of file memstream.h.

virtual bool Common::MemoryWriteStream::seek ( int32  offset,
int  whence = SEEK_SET 
) [inline, override, virtual]

Sets the stream position indicator for the stream.

The new position, measured in bytes, is obtained by adding offset bytes to the position specified by whence. If whence is set to SEEK_SET, SEEK_CUR, or SEEK_END, the offset is relative to the start of the file, the current position indicator, or end-of-file, respectively. A successful call to the seek() method clears the end-of-file indicator for the stream.

Note:
The semantics of any implementation of this method are supposed to match those of ISO C fseek().
Parameters:
offset the relative offset in bytes
whence the seek reference: SEEK_SET, SEEK_CUR, or SEEK_END
Returns:
true on success, false in case of a failure

Implements Common::SeekableWriteStream.

Reimplemented in Common::SeekableMemoryWriteStream.

Definition at line 120 of file memstream.h.

virtual int32 Common::MemoryWriteStream::size (  )  const [inline, override, virtual]

Obtains the current size of the stream, measured in bytes.

If this value is unknown or can not be computed, -1 is returned.

Returns:
the size of the stream, or -1 if an error occurred

Implements Common::SeekableWriteStream.

Definition at line 115 of file memstream.h.

uint32 Common::MemoryWriteStream::write ( const void *  dataPtr,
uint32  dataSize 
) [inline, 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:
dataPtr pointer to the data to be written
dataSize number of bytes to be written
Returns:
the number of bytes which were actually written.

Implements Common::WriteStream.

Definition at line 101 of file memstream.h.


Member Data Documentation

Definition at line 93 of file memstream.h.

Definition at line 97 of file memstream.h.

Definition at line 96 of file memstream.h.

Definition at line 95 of file memstream.h.


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


Generated on Sat Nov 9 2019 05:01:55 for ResidualVM by doxygen 1.7.1
curved edge   curved edge