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

Common::MemoryReadWriteStream Class Reference

MemoryStream based on RingBuffer. More...

#include <memstream.h>

Inheritance diagram for Common::MemoryReadWriteStream:
Collaboration diagram for Common::MemoryReadWriteStream:

List of all members.

Public Member Functions

 MemoryReadWriteStream (DisposeAfterUse::Flag disposeMemory)
 ~MemoryReadWriteStream ()
uint32 write (const void *dataPtr, uint32 dataSize)
 Write data into the stream.
virtual uint32 read (void *dataPtr, uint32 dataSize) override
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 seek (int32, int) override
 Sets the stream position indicator for the stream.
virtual bool eos () const override
virtual void clearErr () override
 Reset the I/O error status as returned by err().
bytegetData ()

Private Member Functions

void ensureCapacity (uint32 new_len)

Private Attributes

uint32 _capacity
uint32 _size
byte_data
uint32 _writePos
uint32 _readPos
uint32 _pos
uint32 _length
DisposeAfterUse::Flag _disposeMemory
bool _eos

Detailed Description

MemoryStream based on RingBuffer.

Grows if has insufficient buffer size.

Definition at line 240 of file memstream.h.


Constructor & Destructor Documentation

Common::MemoryReadWriteStream::MemoryReadWriteStream ( DisposeAfterUse::Flag  disposeMemory  )  [inline, explicit]

Definition at line 275 of file memstream.h.

Common::MemoryReadWriteStream::~MemoryReadWriteStream (  )  [inline]

Definition at line 277 of file memstream.h.


Member Function Documentation

virtual void Common::MemoryReadWriteStream::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 321 of file memstream.h.

void Common::MemoryReadWriteStream::ensureCapacity ( uint32  new_len  )  [inline, private]

Definition at line 249 of file memstream.h.

virtual bool Common::MemoryReadWriteStream::eos (  )  const [inline, override, virtual]

Definition at line 320 of file memstream.h.

byte* Common::MemoryReadWriteStream::getData (  )  [inline]

Definition at line 323 of file memstream.h.

virtual int32 Common::MemoryReadWriteStream::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 317 of file memstream.h.

virtual uint32 Common::MemoryReadWriteStream::read ( void *  dataPtr,
uint32  dataSize 
) [inline, override, virtual]

Definition at line 299 of file memstream.h.

virtual bool Common::MemoryReadWriteStream::seek ( int32  offset,
int  whence 
) [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.

Definition at line 319 of file memstream.h.

virtual int32 Common::MemoryReadWriteStream::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 318 of file memstream.h.

uint32 Common::MemoryReadWriteStream::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 282 of file memstream.h.


Member Data Documentation

Definition at line 242 of file memstream.h.

Definition at line 244 of file memstream.h.

Definition at line 247 of file memstream.h.

Definition at line 245 of file memstream.h.

Definition at line 245 of file memstream.h.

Definition at line 245 of file memstream.h.

Definition at line 243 of file memstream.h.

Definition at line 245 of file memstream.h.


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


Generated on Sat Nov 16 2019 05:02:49 for ResidualVM by doxygen 1.7.1
curved edge   curved edge