#include <OgreDataChunk.h>
Inheritance diagram for Ogre::DataChunk:
Public Methods | |
DataChunk () | |
Default constructor. | |
DataChunk (void *pData, size_t size) | |
Wraps an existing, already-allocated, memory block. | |
virtual | ~DataChunk () |
Default destructor. | |
uchar * | allocate (size_t size, const uchar *ptr=NULL) |
Allocates the passed number of bytes. | |
DataChunk & | clear () |
Frees all internally allocated memory. | |
size_t | getSize () const |
Returns the size of the allocated chunk in bytes. | |
uchar * | getPtr () |
Returns a const pointer to the start of the memory. | |
const uchar * | getPtr () const |
Returns a const pointer to the start of the memory. | |
size_t | read (void *buffer, size_t size) |
Reads memory from the main buffer into another, incrementing an internal 'current' pointer to allow progressive reads. | |
DataChunk & | seek (size_t pos) |
Repositions the internal read pointer to a specified byte. | |
DataChunk & | skip (long offset) |
Moves the internal read pointer backwards or forwards by the number of bytes specified. | |
size_t | 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. | |
size_t | skipUpTo (const char *delim) |
Skips data into the provided buffer until hitting the specified character or reaching the end of the data. | |
bool | isEOF () const |
Returns true if the buffer pointer has reached the end of the buffer. | |
String | getLine (bool trimAfter=true) |
Returns a String containing the next line of data, optionally trimmed for whitespace. | |
String | getAsString (void) const |
Get the entire contents of the chunk as a string. | |
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.
Definition at line 53 of file OgreDataChunk.h.
|
Default constructor.
Definition at line 32 of file OgreDataChunk.cpp. |
|
Wraps an existing, already-allocated, memory block.
Definition at line 37 of file OgreDataChunk.cpp. |
|
Default destructor.
Definition at line 74 of file OgreDataChunk.h. |
|
Allocates the passed number of bytes.
Definition at line 46 of file OgreDataChunk.cpp. References mData, mEnd, mPos, mSize, and Ogre::uchar. Referenced by Ogre::TGACodec::decode(), Ogre::ILImageCodec::decode(), Ogre::DDSCodec::decode(), Ogre::BMPCodec::decode(), and Ogre::Zip::fileRead(). |
|
Frees all internally allocated memory.
Definition at line 65 of file OgreDataChunk.cpp. Referenced by Ogre::Skeleton::load(), Ogre::Mesh::load(), and Ogre::BspLevel::load(). |
|
Get the entire contents of the chunk as a string.
Definition at line 181 of file OgreDataChunk.cpp. Referenced by Ogre::GpuProgram::load(), Ogre::D3D9GpuProgram::load(), and Ogre::HighLevelGpuProgram::loadHighLevelImpl(). |
|
|
Returns a const pointer to the start of the memory.
|
|
Returns a const pointer to the start of the memory.
Definition at line 83 of file OgreDataChunk.cpp. References mData, and Ogre::uchar. Referenced by Ogre::D3D9Texture::_loadCubeTex(), Ogre::D3D9Texture::_loadNormTex(), Ogre::D3D9Texture::_loadVolumeTex(), Ogre::Font::createTextureFromFont(), Ogre::TGACodec::decode(), Ogre::ILImageCodec::decode(), Ogre::DDSCodec::decode(), Ogre::BMPCodec::decode(), Ogre::Zip::fileRead(), Ogre::Quake3Level::initialise(), Ogre::Image::load(), and Ogre::Image::loadRawData(). |
|
Returns the size of the allocated chunk in bytes.
Definition at line 77 of file OgreDataChunk.cpp. References mSize. Referenced by Ogre::D3D9Texture::_loadCubeTex(), Ogre::D3D9Texture::_loadNormTex(), Ogre::D3D9Texture::_loadVolumeTex(), Ogre::Font::createTextureFromFont(), Ogre::TGACodec::decode(), Ogre::ILImageCodec::decode(), Ogre::DDSCodec::decode(), Ogre::BMPCodec::decode(), Ogre::Win32Window::writeContentsToFile(), and Ogre::SDLWindow::writeContentsToFile(). |
|
Returns true if the buffer pointer has reached the end of the buffer.
Definition at line 159 of file OgreDataChunk.cpp. Referenced by Ogre::MeshSerializerImpl::importMesh(), Ogre::SkeletonSerializer::importSkeleton(), Ogre::ParticleSystemManager::parseNewAffector(), Ogre::OverlayManager::parseNewElement(), Ogre::ParticleSystemManager::parseNewEmitter(), Ogre::OverlayManager::parseNewMesh(), Ogre::Quake3ShaderManager::parseNewShaderPass(), Ogre::OverlayManager::parseOverlayFile(), Ogre::ParticleSystemManager::parseScript(), Ogre::MaterialSerializer::parseScript(), Ogre::FontManager::parseScript(), Ogre::Quake3ShaderManager::parseShaderFile(), Ogre::SkeletonSerializer::readAnimation(), Ogre::SkeletonSerializer::readAnimationTrack(), Ogre::MeshSerializerImpl_v1::readGeometry(), Ogre::MeshSerializerImpl::readGeometry(), Ogre::MeshSerializerImpl_v1::readMaterial(), Ogre::MeshSerializerImpl_v1::readMesh(), Ogre::MeshSerializerImpl::readMesh(), Ogre::MeshSerializerImpl_v1::readSubMesh(), Ogre::MeshSerializerImpl::readSubMesh(), Ogre::ParticleSystemManager::skipToNextCloseBrace(), Ogre::OverlayManager::skipToNextCloseBrace(), Ogre::ParticleSystemManager::skipToNextOpenBrace(), and Ogre::OverlayManager::skipToNextOpenBrace(). |
|
Reads memory from the main buffer into another, incrementing an internal 'current' pointer to allow progressive reads.
Definition at line 95 of file OgreDataChunk.cpp. Referenced by Ogre::Serializer::readBools(), Ogre::Serializer::readInts(), Ogre::Serializer::readLongs(), Ogre::Serializer::readReals(), and Ogre::Serializer::readShorts(). |
|
Reads data into the provided buffer until hitting the specified character or reaching the upper limit provided.
Definition at line 128 of file OgreDataChunk.cpp. Referenced by getLine(), Ogre::Quake3ShaderManager::parseShaderFile(), and Ogre::Serializer::readString(). |
|
Repositions the internal read pointer to a specified byte.
Definition at line 110 of file OgreDataChunk.cpp. References mData, mPos, and mSize. Referenced by Ogre::MeshSerializer::importMesh(). |
|
Moves the internal read pointer backwards or forwards by the number of bytes specified.
Definition at line 118 of file OgreDataChunk.cpp. References mData, mEnd, and mPos. Referenced by Ogre::SkeletonSerializer::readAnimation(), Ogre::SkeletonSerializer::readAnimationTrack(), Ogre::MeshSerializerImpl_v1::readGeometry(), Ogre::MeshSerializerImpl::readGeometry(), Ogre::MeshSerializerImpl_v1::readMaterial(), Ogre::MeshSerializerImpl_v1::readMesh(), Ogre::MeshSerializerImpl::readMesh(), Ogre::MeshSerializerImpl_v1::readSubMesh(), and Ogre::MeshSerializerImpl::readSubMesh(). |
|
Skips data into the provided buffer until hitting the specified character or reaching the end of the data.
Definition at line 146 of file OgreDataChunk.cpp. Referenced by Ogre::FontManager::parseScript(). |
|
Definition at line 56 of file OgreDataChunk.h. Referenced by allocate(), clear(), DataChunk(), getAsString(), getPtr(), seek(), skip(), and Ogre::SDDataChunk::~SDDataChunk(). |
|
Definition at line 58 of file OgreDataChunk.h. Referenced by allocate(), DataChunk(), isEOF(), read(), readUpTo(), skip(), and skipUpTo(). |
|
Definition at line 57 of file OgreDataChunk.h. Referenced by allocate(), DataChunk(), isEOF(), read(), readUpTo(), seek(), skip(), and skipUpTo(). |
|
Definition at line 59 of file OgreDataChunk.h. Referenced by allocate(), clear(), DataChunk(), getAsString(), getSize(), and seek(). |
Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:17:09 2004