#include <OgreDataChunk.h>
Inheritance diagram for Ogre::DataChunk:
Public Methods | |
DataChunk () | |
Default constructor. More... | |
DataChunk (void *pData, size_t size) | |
Wraps an existing, already-allocated, memory block. More... | |
virtual | ~DataChunk () |
Default destructor. More... | |
uchar * | allocate (size_t size, const uchar *ptr=NULL) |
Allocates the passed number of bytes. More... | |
DataChunk & | clear () |
Frees all internally allocated memory. More... | |
size_t | getSize () const |
Returns the size of the allocated chunk in bytes. More... | |
uchar * | getPtr () |
Returns a const pointer to the start of the memory. More... | |
const uchar * | getPtr () const |
Returns a const pointer to the start of the memory. More... | |
ulong | read (void *buffer, unsigned long size) |
Reads memory from the main buffer into another, incrementing an internal 'current' pointer to allow progressive reads. More... | |
DataChunk & | seek (size_t pos) |
Repositions the internal read pointer to a specified byte. More... | |
DataChunk & | skip (long offset) |
Moves the internal read pointer backwards or forwards by the number of bytes specified. More... | |
unsigned long | readUpTo (void *buffer, size_t size, const char *delim="\n") |
Reads data into the provided buffer until hitting the specified character or reaching the upper limit provided. More... | |
unsigned long | skipUpTo (const char *delim) |
Skips data into the provided buffer until hitting the specified character or reaching the end of the data. More... | |
bool | isEOF () |
Returns true if the buffer pointer has reached the end of the buffer. More... | |
String | getLine (bool trimAfter=true) |
Returns a String containing the next line of data, optionally trimmed for whitespace. More... | |
Protected Attributes | |
uchar * | mData |
uchar * | mPos |
uchar * | mEnd |
size_t | mSize |
This is for efficiency since you may just want to reuse the memory as-is rather than copying it elsewhere, and it also allows the DataChunk to be copied safely, i.e. when returned from methods. At some point you should call DataChunk::free to release the memory if you wish.
If you need a DataChunk that frees the allocated memory on destruction, use SDDataChunk instead.
|
Default constructor.
|
|
Wraps an existing, already-allocated, memory block.
|
|
Default destructor.
|
|
Allocates the passed number of bytes.
|
|
Frees all internally allocated memory.
|
|
Returns a String containing the next line of data, optionally trimmed for whitespace.
|
|
Returns a const pointer to the start of the memory.
|
|
Returns a const pointer to the start of the memory.
|
|
Returns the size of the allocated chunk in bytes.
|
|
Returns true if the buffer pointer has reached the end of the buffer.
|
|
Reads memory from the main buffer into another, incrementing an internal 'current' pointer to allow progressive reads.
|
|
Reads data into the provided buffer until hitting the specified character or reaching the upper limit provided.
|
|
Repositions the internal read pointer to a specified byte.
|
|
Moves the internal read pointer backwards or forwards by the number of bytes specified.
|
|
Skips data into the provided buffer until hitting the specified character or reaching the end of the data.
|
|
|
|
|
|
|
|
|
Copyright © 2002 by The OGRE Team