Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members |
Subclass of DataStream for handling data from chunks of memory. More...
#include <DataStream.h>
Public Member Functions | |
void | close () |
bool | eof () |
Returns true if the buffer pointer has reached the end of the buffer. | |
u8 * | getCurrentPtr () |
Get a pointer to the current position in the memory block this stream holds. | |
u8 * | getPtr () |
Get a pointer to the start of the memory block this stream holds. | |
MemoryDataStream (void *mem, u32 size, bool freeOnClose=false) | |
MemoryDataStream (DataStream &sourceStream, bool freeOnClose=true) | |
MemoryDataStream (u32 size, bool freeOnClose=true) | |
u32 | read (void *buffer, u32 size, u32 count) |
u32 | read (void *buffer, u32 size) |
u32 | readLine (c8 *buffer, u32 size, const std::string &delim="\n") |
void | seek (u32 pos) |
Repositions the internal read pointer to a specified byte. | |
void | skip (s32 offset) |
u32 | skipLine (const std::string &delim="\n") |
Skip a single line from the stream. | |
u32 | tell () const |
Returns the current byte offset from beginning. | |
~MemoryDataStream () | |
Protected Attributes | |
u8 * | mData |
u8 * | mEnd |
bool | mFreeOnClose |
u8 * | mPos |
Subclass of DataStream for handling data from chunks of memory.
resource::MemoryDataStream::MemoryDataStream | ( | void * | mem, |
u32 | size, | ||
bool | freeOnClose = false |
||
) |
Wrap an existing memory chunk in a stream.
mem,: | Pointer to the exising memory |
size,: | The size of the memory chunk in bytes |
freeOnClose,: | If true, the memory associated will be destroyed on close. |
References mData, mEnd, mFreeOnClose, mPos, resource::DataStream::mSize, and resource::DataStream::size().
resource::MemoryDataStream::MemoryDataStream | ( | DataStream & | sourceStream, |
bool | freeOnClose = true |
||
) |
Create a stream which pre-buffers the contents of another stream. This constructor can be used to intentionally read in the entire contents of another stream, copying them to the internal buffer and thus making them available in memory as a single unit.
sourceStream,: | DataStream which will provide the source of data |
freeOnClose,: | If true, the memory associated will be destroyed on close. |
References mData, mEnd, mFreeOnClose, mPos, resource::DataStream::mSize, resource::DataStream::read(), and resource::DataStream::size().
resource::MemoryDataStream::MemoryDataStream | ( | u32 | size, |
bool | freeOnClose = true |
||
) |
Create a stream with a brand new empty memory chunk.
size,: | The size of the memory chunk to create in bytes |
freeOnClose,: | If true, the memory associated will be destroyed on close. |
References mData, mEnd, mFreeOnClose, mPos, resource::DataStream::mSize, and resource::DataStream::size().
resource::MemoryDataStream::~MemoryDataStream | ( | ) |
References mData.
void resource::MemoryDataStream::close | ( | void | ) |
References mData, and mFreeOnClose.
bool resource::MemoryDataStream::eof | ( | ) | [virtual] |
Returns true if the buffer pointer has reached the end of the buffer.
Implements resource::DataStream.
u8 * resource::MemoryDataStream::getCurrentPtr | ( | ) |
Get a pointer to the current position in the memory block this stream holds.
References mPos.
u8 * resource::MemoryDataStream::getPtr | ( | ) |
Get a pointer to the start of the memory block this stream holds.
References mData.
Implements resource::DataStream.
Reads the data stream into a buffer.
buffer,: | Pointer to buffer to read into |
size,: | Number of bytes to read |
Implements resource::DataStream.
References mEnd, mPos, and resource::DataStream::size().
u32 resource::MemoryDataStream::readLine | ( | c8 * | buffer, |
u32 | size, | ||
const std::string & | delim = "\n" |
||
) | [virtual] |
Reads a line from the data stream into a buffer.
buffer,: | Pointer to buffer to read into |
size,: | Max number of bytes to read |
delim,: | The delimiter to stop at |
Reimplemented from resource::DataStream.
void resource::MemoryDataStream::seek | ( | u32 | pos | ) | [virtual] |
Repositions the internal read pointer to a specified byte.
Implements resource::DataStream.
void resource::MemoryDataStream::skip | ( | s32 | offset | ) | [virtual] |
Moves the internal read pointer backwards or forwards by the number of bytes specified. The sign of the parameter determines the direction of the skip.
Implements resource::DataStream.
u32 resource::MemoryDataStream::skipLine | ( | const std::string & | delim = "\n" | ) | [virtual] |
Skip a single line from the stream.
Reimplemented from resource::DataStream.
u32 resource::MemoryDataStream::tell | ( | ) | const [virtual] |
Returns the current byte offset from beginning.
Implements resource::DataStream.
u8* resource::MemoryDataStream::mData [protected] |
Referenced by close(), getPtr(), MemoryDataStream(), seek(), skip(), tell(), and ~MemoryDataStream().
u8* resource::MemoryDataStream::mEnd [protected] |
Referenced by eof(), MemoryDataStream(), read(), readLine(), seek(), skip(), and skipLine().
bool resource::MemoryDataStream::mFreeOnClose [protected] |
Referenced by close(), and MemoryDataStream().
u8* resource::MemoryDataStream::mPos [protected] |
Referenced by eof(), getCurrentPtr(), MemoryDataStream(), read(), readLine(), seek(), skip(), skipLine(), and tell().
The KG Game Engine
Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:09 by
Doxygen
(1.7.4)
|