xoreos
0.0.5
|
Simple memory based 'stream', which implements the SeekableWriteStream interface for a plain memory block. More...
#include <memwritestream.h>
Public Member Functions | |
MemoryWriteStream (byte *buf, size_t len) | |
~MemoryWriteStream () | |
template<size_t N> | |
MemoryWriteStream (byte(&array)[N]) | |
Template constructor to create a MemoryWriteStream around an array buffer. More... | |
size_t | write (const void *dataPtr, size_t dataSize) |
Write data into the stream. More... | |
size_t | pos () const |
Return the current writing position within the memory block. More... | |
size_t | size () const |
Return the total size of the memory block. More... | |
size_t | seek (ptrdiff_t offset, Origin whence=kOriginBegin) |
Seek offset bytes from the origin whence. More... | |
Public Member Functions inherited from Common::SeekableWriteStream | |
SeekableWriteStream () | |
~SeekableWriteStream () | |
virtual size_t | skip (ptrdiff_t offset) |
Skip the specified number of bytes, adding that offset to the current position in the stream. More... | |
Public Member Functions inherited from Common::WriteStream | |
WriteStream () | |
virtual | ~WriteStream () |
virtual void | flush () |
Commit any buffered data to the underlying channel or storage medium; unbuffered streams can use the default implementation. 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) |
void | writeBytes (byte value, size_t n) |
Write n bytes of value to the stream. More... | |
FORCEINLINE void | writeZeros (size_t n) |
Write n zeros to the stream. More... | |
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 | writeIEEEFloatLE (float value) |
FORCEINLINE void | writeIEEEFloatBE (float value) |
FORCEINLINE void | writeIEEEDoubleLE (double value) |
FORCEINLINE void | writeIEEEDoubleBE (double value) |
size_t | writeStream (ReadStream &stream, size_t n) |
Copy n bytes of the given stream into the stream. More... | |
size_t | writeStream (ReadStream &stream) |
Copy the complete contents of the given stream. More... | |
void | writeString (const UString &str) |
Write the given string to the stream, encoded as UTF-8. More... | |
Private Attributes | |
byte * | _ptr |
const size_t | _bufSize |
size_t | _pos |
Additional Inherited Members | |
Public Types inherited from Common::SeekableWriteStream | |
enum | Origin { kOriginBegin = 0, kOriginCurrent = 1, kOriginEnd = 2, kOriginMAX } |
The position a seeking offset takes as a base. More... | |
Static Public Member Functions inherited from Common::SeekableWriteStream | |
static size_t | evalSeek (ptrdiff_t offset, Origin whence, size_t pos, size_t begin, size_t size) |
Evaluate the seek offset relative to whence into a position from the beginning. More... | |
Simple memory based 'stream', which implements the SeekableWriteStream interface for a plain memory block.
Writing past the size of the memory block will fail with an exception.
Definition at line 66 of file memwritestream.h.
|
inline |
Definition at line 68 of file memwritestream.h.
|
inline |
Definition at line 69 of file memwritestream.h.
|
inline |
Template constructor to create a MemoryWriteStream around an array buffer.
Definition at line 73 of file memwritestream.h.
|
virtual |
Return the current writing position within the memory block.
Implements Common::SeekableWriteStream.
Definition at line 73 of file memwritestream.cpp.
References _pos.
|
virtual |
Seek offset bytes from the origin whence.
Implements Common::SeekableWriteStream.
Definition at line 81 of file memwritestream.cpp.
References _bufSize, _pos, _ptr, Common::SeekableWriteStream::evalSeek(), Common::kSeekError, and size().
|
virtual |
Return the total size of the memory block.
Implements Common::SeekableWriteStream.
Definition at line 77 of file memwritestream.cpp.
References _bufSize.
Referenced by seek().
|
virtual |
Write data into the stream.
Subclasses must implement this method; all other write methods are implemented using it.
dataPtr | pointer to the data to be written. |
dataSize | number of bytes to be written. |
Implements Common::WriteStream.
Definition at line 58 of file memwritestream.cpp.
|
private |
Definition at line 88 of file memwritestream.h.
|
private |
Definition at line 89 of file memwritestream.h.
|
private |
Definition at line 86 of file memwritestream.h.