An I/O stream to a buffer of memory. More...
#include <memorystream.h>
Public Member Functions | |
MemoryStream () | |
Blank constructor. | |
MemoryStream (const Whole BufferSize, const Whole Mode=Resource::SF_Read|Resource::SF_Write) | |
Buffer initialization constructor. More... | |
MemoryStream (const void *Buffer, const Whole BufferSize, const Whole Mode=Resource::SF_Read|Resource::SF_Write) | |
Buffer copy constructor. More... | |
MemoryStream (void *Buffer, const Whole BufferSize, const Boole FreeAfter, const Whole Mode=Resource::SF_Read|Resource::SF_Write) | |
Buffer wrapper constructor. More... | |
virtual | ~MemoryStream () |
Class destructor. | |
void | CopyBuffer (const void *Buffer, const Whole BufferSize, const Whole Mode=Resource::SF_Read|Resource::SF_Write) |
Copies a pre-existing buffer to this buffer for streaming. More... | |
void | CreateBuffer (const Whole Size, const Whole Mode=Resource::SF_Read|Resource::SF_Write) |
Creates a new memory buffer to stream to/from. More... | |
Char8 * | GetBufferEnd () const |
Gets the end of this buffer. More... | |
Char8 * | GetBufferStart () const |
Gets the start of this buffer. More... | |
Boole | GetFreeBuffer () const |
Gets if this should delete it's internal buffer when it is destroyed. More... | |
virtual StreamSize | GetSize () const |
void | SetBuffer (void *Buffer, const Whole BufferSize, const Boole FreeBuf, const Whole Mode=Resource::SF_Read|Resource::SF_Write) |
Wraps an external buffer for streaming. More... | |
void | SetFreeBuffer (const Boole FreeBuf) |
Sets if this should delete it's internal buffer when it is destroyed. More... | |
Public Member Functions inherited from Mezzanine::Resource::IOStream | |
IOStream (std::streambuf *Buf) | |
Class constructor. More... | |
virtual | ~IOStream () |
Class destructor. | |
virtual void | Advance (const StreamOff Count) |
Advances the position in the stream. More... | |
virtual Boole | Bad () const |
Gets whether or not a critical error was detected in a previous operation in the stream. More... | |
virtual void | ClearErrors () |
Clears any stored error state on the stream. More... | |
virtual Boole | EoF () const |
Gets whether or not the current position is at the end of the stream. More... | |
virtual Boole | Fail () const |
Gets whether or not an otherwise silent and recoverable error was detected in a previous operation in the stream. More... | |
virtual String | GetAsString () |
Gets the contents of the stream as a string. More... | |
virtual String | GetLine (Boole Trim=true) |
Gets the contents of the current line in the stream. More... | |
virtual StreamPos | GetReadPosition () |
Gets the current read position in this stream. More... | |
virtual StreamPos | GetStreamPosition (const Boole Read=true) |
Gets the current position in this stream. More... | |
virtual StreamPos | GetWritePosition () |
Gets the current write position in this stream. More... | |
virtual Boole | IsValid () const |
Gets whether or not this stream is intact and ready for operations. More... | |
virtual size_t | Read (void *Buffer, StreamSize Size) |
Reads from the stream and copies that data to a buffer. More... | |
virtual size_t | ReadLine (Char8 *Buffer, size_t MaxCount, const String &Delim="\n") |
Reads a single line from a string. More... | |
virtual void | SetReadPosition (StreamPos Position) |
Sets the position of the read cursor explicitly. More... | |
virtual void | SetReadPosition (StreamOff Offset, SeekOrigin Origin) |
Sets the position of the read cursor. More... | |
virtual void | SetStreamPosition (StreamPos Position) |
Sets the position of the read and write cursors explicitly. More... | |
virtual void | SetStreamPosition (StreamOff Offset, SeekOrigin Origin) |
Sets the position of the read and write cursors. More... | |
virtual void | SetWritePosition (StreamPos Position) |
Sets the position of the write cursor explicitly. More... | |
virtual void | SetWritePosition (StreamOff Offset, SeekOrigin Origin) |
Sets the position of the write cursor. More... | |
virtual size_t | SkipLine (const String &Delim="\n") |
Moves the current position to the start of the next line. More... | |
virtual size_t | Write (const void *Buffer, StreamSize Size) |
Writes data to the stream. More... | |
Public Member Functions inherited from Mezzanine::Resource::iInStream | |
iInStream () | |
Class constructor. | |
virtual | ~iInStream () |
Class destructor. | |
Public Member Functions inherited from Mezzanine::Resource::iStreamBase | |
iStreamBase () | |
Class constructor. | |
virtual | ~iStreamBase () |
Class destructor. | |
Public Member Functions inherited from Mezzanine::Resource::iOutStream | |
iOutStream () | |
Class constructor. | |
virtual | ~iOutStream () |
Class destructor. | |
Protected Attributes | |
MemoryStreamBuffer | Buffer |
The buffer object being streamed to/from. More... | |
An I/O stream to a buffer of memory.
Definition at line 222 of file memorystream.h.
Mezzanine::Resource::MemoryStream::MemoryStream | ( | const Whole | BufferSize, |
const Whole | Mode = Resource::SF_Read | Resource::SF_Write |
||
) |
Buffer initialization constructor.
BufferSize | The size of the buffer being wrapped. |
Mode | The configuration to open the memory buffer with. |
Definition at line 318 of file memorystream.cpp.
Mezzanine::Resource::MemoryStream::MemoryStream | ( | const void * | Buffer, |
const Whole | BufferSize, | ||
const Whole | Mode = Resource::SF_Read | Resource::SF_Write |
||
) |
Buffer copy constructor.
BufferSize | The size of the buffer being wrapped. |
Mode | The configuration to open the memory buffer with. |
Definition at line 322 of file memorystream.cpp.
Mezzanine::Resource::MemoryStream::MemoryStream | ( | void * | Buffer, |
const Whole | BufferSize, | ||
const Boole | FreeAfter, | ||
const Whole | Mode = Resource::SF_Read | Resource::SF_Write |
||
) |
Buffer wrapper constructor.
Buffer | The buffer to be wrapped. |
BufferSize | The size of the buffer being wrapped. |
FreeAfter | Whether or not the buffer passed in should be deleted when this stream is destroyed. |
Mode | The configuration to open the memory buffer with. |
Definition at line 326 of file memorystream.cpp.
void Mezzanine::Resource::MemoryStream::CopyBuffer | ( | const void * | Buffer, |
const Whole | BufferSize, | ||
const Whole | Mode = Resource::SF_Read | Resource::SF_Write |
||
) |
Copies a pre-existing buffer to this buffer for streaming.
Buffer | The buffer to be copied. |
BufferSize | The size of the buffer to be copied. |
Mode | An open mode describing if this buffer will be configured for reading, writing, or both. |
Definition at line 342 of file memorystream.cpp.
void Mezzanine::Resource::MemoryStream::CreateBuffer | ( | const Whole | Size, |
const Whole | Mode = Resource::SF_Read | Resource::SF_Write |
||
) |
Creates a new memory buffer to stream to/from.
Size | The size of the buffer to be allocated. |
Mode | An open mode describing if this buffer will be configured for reading, writing, or both. |
Definition at line 336 of file memorystream.cpp.
Char8 * Mezzanine::Resource::MemoryStream::GetBufferEnd | ( | ) | const |
Gets the end of this buffer.
Definition at line 348 of file memorystream.cpp.
Char8 * Mezzanine::Resource::MemoryStream::GetBufferStart | ( | ) | const |
Gets the start of this buffer.
Definition at line 345 of file memorystream.cpp.
Boole Mezzanine::Resource::MemoryStream::GetFreeBuffer | ( | ) | const |
Gets if this should delete it's internal buffer when it is destroyed.
Definition at line 354 of file memorystream.cpp.
|
virtual |
Implements Mezzanine::Resource::iStreamBase.
Definition at line 360 of file memorystream.cpp.
void Mezzanine::Resource::MemoryStream::SetBuffer | ( | void * | Buffer, |
const Whole | BufferSize, | ||
const Boole | FreeBuf, | ||
const Whole | Mode = Resource::SF_Read | Resource::SF_Write |
||
) |
Wraps an external buffer for streaming.
Buffer | The buffer to be wrapped. |
BufferSize | The size of the buffer being wrapped. |
FreeBuf | Whether or not the buffer passed in should be deleted when this stream is destroyed. |
Mode | An open mode describing if this buffer will be configured for reading, writing, or both. |
Definition at line 339 of file memorystream.cpp.
void Mezzanine::Resource::MemoryStream::SetFreeBuffer | ( | const Boole | FreeBuf | ) |
Sets if this should delete it's internal buffer when it is destroyed.
FreeBuf | Whether or not the buffer passed in should be deleted when this stream is destroyed. |
Definition at line 351 of file memorystream.cpp.
|
protected |
The buffer object being streamed to/from.
Definition at line 227 of file memorystream.h.