A stream buffer object to a chunk of memory.
More...
#include <memorystream.h>
|
std::streamoff | CheckStreamOffset (const std::streamoff CursorOffset, const std::streamoff Adjust) |
| Verifies an offset in this stream is valid for a read or write cursor. More...
|
|
std::streampos | CheckStreamPosition (const std::streampos Position) |
| Verifies a position in this stream is valid. More...
|
|
std::streampos | GetReadPosition () const |
| Gets the current position of the read cursor. More...
|
|
std::streampos | GetWritePosition () const |
| Gets the current position of the write cursor. More...
|
|
virtual void | imbue (const std::locale &loc) |
| Notifies this class that a new locale is being imbued to this streambuf. More...
|
|
virtual int | overflow (int c=traits_type::eof()) |
| Writes a character at the current write position without advancing the write position. More...
|
|
virtual int | pbackfail (int c=traits_type::eof()) |
| Reverse the last character extraction operation by decrementing the read position and placing the specified character in it's place. More...
|
|
virtual std::streampos | seekoff (std::streamoff off, std::ios_base::seekdir way, std::ios_base::openmode which=std::ios_base::in|std::ios_base::out) |
| Moves the read and/or write pointers in the stream. More...
|
|
virtual std::streampos | seekpos (std::streampos sp, std::ios_base::openmode which=std::ios_base::in|std::ios_base::out) |
| Moves the read and/or write pointers to the specified position in the stream. More...
|
|
virtual std::streambuf * | setbuf (char *s, std::streamsize n) |
| Sets the buffer to be streamed from. More...
|
|
virtual std::streamsize | showmanyc () |
| Gets the number of characters remaining that can be safely extracted from this buffer. More...
|
|
virtual int | sync () |
| Syncs this stream buffer with it's source. More...
|
|
virtual int | uflow () |
| Gets the value at the current read position and then increments the read position. More...
|
|
virtual int | underflow () |
| Gets the value at the current read position without incrementing the read position. More...
|
|
virtual std::streamsize | xsgetn (char *s, std::streamsize n) |
| Gets a number of characters starting at the read position and populates an array with them. More...
|
|
virtual std::streamsize | xsputn (const char *s, std::streamsize n) |
| Writes a number of characters from a provided buffer to the stream. More...
|
|
A stream buffer object to a chunk of memory.
Definition at line 56 of file memorystream.h.
std::streamoff Mezzanine::Resource::MemoryStreamBuffer::CheckStreamOffset |
( |
const std::streamoff |
CursorOffset, |
|
|
const std::streamoff |
Adjust |
|
) |
| |
|
protected |
Verifies an offset in this stream is valid for a read or write cursor.
- Parameters
-
CursorOffset | The current read/write position in this stream. |
Adjust | The amount of offset to be checked/applied to the provided read/write position. |
- Returns
- Returns an std::streamoff containing the clamped offset for the given cursor in this stream.
Definition at line 81 of file memorystream.cpp.
std::streampos Mezzanine::Resource::MemoryStreamBuffer::CheckStreamPosition |
( |
const std::streampos |
Position | ) |
|
|
protected |
Verifies a position in this stream is valid.
- Parameters
-
Position | The position in this stream to check. |
- Returns
- Returns an std::streampos containing the clamped position for this stream.
Definition at line 69 of file memorystream.cpp.
void Mezzanine::Resource::MemoryStreamBuffer::ConfigureBuffer |
( |
const std::streampos |
Pos, |
|
|
std::ios_base::openmode |
Mode = std::ios_base::in | std::ios_base::out |
|
) |
| |
Sets the get and put pointers for the streambuffer and assigns the current position to the specified offset.
- Parameters
-
Pos | The offset to set the current read/write position to. |
Mode | An open mode describing if this buffer will be configured for reading, writing, or both. |
Definition at line 278 of file memorystream.cpp.
void Mezzanine::Resource::MemoryStreamBuffer::CopyBuffer |
( |
const char * |
Buffer, |
|
|
const Whole |
BufferSize |
|
) |
| |
Copies a pre-existing buffer to this buffer for streaming.
- Parameters
-
Buffer | The buffer to be copied. |
BufferSize | The size of the buffer to be copied. |
Definition at line 254 of file memorystream.cpp.
void Mezzanine::Resource::MemoryStreamBuffer::CreateBuffer |
( |
const Whole |
Size | ) |
|
Convenience method for creating a new buffer to be used by this stream.
- Parameters
-
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 238 of file memorystream.cpp.
Char8 * Mezzanine::Resource::MemoryStreamBuffer::GetBufferEnd |
( |
| ) |
const |
Gets the end of this buffer.
- Returns
- Returns a pointer to one passed the last valid element in this buffer.
Definition at line 267 of file memorystream.cpp.
std::streamsize Mezzanine::Resource::MemoryStreamBuffer::GetBufferSize |
( |
| ) |
const |
Gets the size of the current buffer being streamed to/from.
- Returns
- Returns a std::streamsize representing the size of the current buffer, or 0 if one hasn't been initialized.
Definition at line 273 of file memorystream.cpp.
Char8 * Mezzanine::Resource::MemoryStreamBuffer::GetBufferStart |
( |
| ) |
const |
Gets the start of this buffer.
- Returns
- Returns a pointer to the first valid element in this buffer.
Definition at line 261 of file memorystream.cpp.
Boole Mezzanine::Resource::MemoryStreamBuffer::GetFreeBuffer |
( |
| ) |
const |
Gets if this should delete it's internal buffer when it is destroyed.
- Returns
- Returns true if the internal buffer will be deleted when this is destroyed.
Definition at line 308 of file memorystream.cpp.
std::streampos Mezzanine::Resource::MemoryStreamBuffer::GetReadPosition |
( |
| ) |
const |
|
protected |
Gets the current position of the read cursor.
- Returns
- Returns a std::streampos representing the offset of the read position from the start of the stream.
Definition at line 93 of file memorystream.cpp.
std::streampos Mezzanine::Resource::MemoryStreamBuffer::GetWritePosition |
( |
| ) |
const |
|
protected |
Gets the current position of the write cursor.
- Returns
- Returns a std::streampos representing the offset of the write position from the start of the stream.
Definition at line 96 of file memorystream.cpp.
void Mezzanine::Resource::MemoryStreamBuffer::imbue |
( |
const std::locale & |
loc | ) |
|
|
protectedvirtual |
Notifies this class that a new locale is being imbued to this streambuf.
- Parameters
-
loc | The new locale being imbued. |
Definition at line 102 of file memorystream.cpp.
int Mezzanine::Resource::MemoryStreamBuffer::overflow |
( |
int |
c = traits_type::eof() | ) |
|
|
protectedvirtual |
Writes a character at the current write position without advancing the write position.
- Parameters
-
c | The character to be written to the stream. |
- Returns
- Returns the written character, or EOF if there was a failure.
Definition at line 229 of file memorystream.cpp.
int Mezzanine::Resource::MemoryStreamBuffer::pbackfail |
( |
int |
c = traits_type::eof() | ) |
|
|
protectedvirtual |
Reverse the last character extraction operation by decrementing the read position and placing the specified character in it's place.
- Parameters
-
c | The character to place into the stream after decrementing the read position. |
- Returns
- Returns the current character at the read position after the operation completes, or EOF in the event of a failure.
Definition at line 206 of file memorystream.cpp.
std::streampos Mezzanine::Resource::MemoryStreamBuffer::seekoff |
( |
std::streamoff |
off, |
|
|
std::ios_base::seekdir |
way, |
|
|
std::ios_base::openmode |
which = std::ios_base::in | std::ios_base::out |
|
) |
| |
|
protectedvirtual |
Moves the read and/or write pointers in the stream.
- Parameters
-
off | The amount of advance the current position for the operation specified. Negative values will reverse the position. |
way | The base point in the stream to apply the offset to. |
which | Whether this should move the read pointer, write pointer, or both. |
- Returns
- Returns the updated read or write position, based on which was provided. Returns the Read position if both were specified.
Definition at line 124 of file memorystream.cpp.
std::streampos Mezzanine::Resource::MemoryStreamBuffer::seekpos |
( |
std::streampos |
sp, |
|
|
std::ios_base::openmode |
which = std::ios_base::in | std::ios_base::out |
|
) |
| |
|
protectedvirtual |
Moves the read and/or write pointers to the specified position in the stream.
- Parameters
-
sp | The index the current position will be moved to. |
which | Whether this should move the read pointer, write pointer, or both. |
- Returns
- Returns the updated read or write position, based on which was provided. Returns the Read position if both were specified.
Definition at line 152 of file memorystream.cpp.
std::streambuf * Mezzanine::Resource::MemoryStreamBuffer::setbuf |
( |
char * |
s, |
|
|
std::streamsize |
n |
|
) |
| |
|
protectedvirtual |
Sets the buffer to be streamed from.
- Parameters
-
s | The buffer to be wrapped. |
n | The size of the buffer being wrapped. |
- Returns
- Returns this on success, or NULL if there is a failure.
Definition at line 108 of file memorystream.cpp.
void Mezzanine::Resource::MemoryStreamBuffer::SetBuffer |
( |
char * |
Buffer, |
|
|
const Whole |
BufferSize, |
|
|
const Boole |
FreeBuf |
|
) |
| |
Wraps an external buffer for streaming.
- Parameters
-
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. |
Definition at line 246 of file memorystream.cpp.
void Mezzanine::Resource::MemoryStreamBuffer::SetFreeBuffer |
( |
const Boole |
FreeBuf | ) |
|
Sets if this should delete it's internal buffer when it is destroyed.
- Parameters
-
FreeBuf | Whether or not the buffer passed in should be deleted when this stream is destroyed. |
Definition at line 305 of file memorystream.cpp.
std::streamsize Mezzanine::Resource::MemoryStreamBuffer::showmanyc |
( |
| ) |
|
|
protectedvirtual |
Gets the number of characters remaining that can be safely extracted from this buffer.
- Returns
- Returns either the number of characters between the current read position and the end of the buffer, or -1 if no buffer is allocated.
Definition at line 173 of file memorystream.cpp.
int Mezzanine::Resource::MemoryStreamBuffer::sync |
( |
| ) |
|
|
protectedvirtual |
int Mezzanine::Resource::MemoryStreamBuffer::uflow |
( |
| ) |
|
|
protectedvirtual |
Gets the value at the current read position and then increments the read position.
- Returns
- Returns EOF, always.
Definition at line 201 of file memorystream.cpp.
int Mezzanine::Resource::MemoryStreamBuffer::underflow |
( |
| ) |
|
|
protectedvirtual |
Gets the value at the current read position without incrementing the read position.
- Returns
- Returns the current character at the read position or EOF.
Definition at line 191 of file memorystream.cpp.
std::streamsize Mezzanine::Resource::MemoryStreamBuffer::xsgetn |
( |
char * |
s, |
|
|
std::streamsize |
n |
|
) |
| |
|
protectedvirtual |
Gets a number of characters starting at the read position and populates an array with them.
- Parameters
-
s | A pointer to the array where the read characters will be placed. |
n | The number of characters to read. |
- Returns
- This returns the amount of characters retrieved
Definition at line 183 of file memorystream.cpp.
std::streamsize Mezzanine::Resource::MemoryStreamBuffer::xsputn |
( |
const char * |
s, |
|
|
std::streamsize |
n |
|
) |
| |
|
protectedvirtual |
Writes a number of characters from a provided buffer to the stream.
- Parameters
-
s | The buffer of characters that will be written to the stream. |
n | The number of characters from the provided buffer that will be written to the stream. |
- Returns
- Returns the number of characters successfully written.
Definition at line 221 of file memorystream.cpp.
Char8* Mezzanine::Resource::MemoryStreamBuffer::BufferEnd |
|
protected |
A pointer to one passed the last element in the range of this buffer.
Definition at line 70 of file memorystream.h.
Char8* Mezzanine::Resource::MemoryStreamBuffer::BufferStart |
|
protected |
A pointer to the start of this memory buffer.
Definition at line 61 of file memorystream.h.
Boole Mezzanine::Resource::MemoryStreamBuffer::FreeBuffer |
|
protected |
Stores whether or not the memory allocated will be free'd when this buffer is deleted.
Definition at line 76 of file memorystream.h.
Whole Mezzanine::Resource::MemoryStreamBuffer::OpenMode |
|
protected |
A bitfield describing the settings this buffer was opened with.
Definition at line 73 of file memorystream.h.
The documentation for this class was generated from the following files: