IChunkFile

C++
struct IChunkFile : public _reference_target_t {
  struct ChunkDesc {
    ChunkTypes chunkType;
    int chunkVersion;
    int chunkId;
    uint32 fileOffset;
    void* data;
    uint32 size;
    bool bSwapEndian;
  };
};
File

IChunkFile.h

Description

Chunked File (.cgf, .chr etc.) interface

IChunkFile::ChunkDesc Structure
C++
struct ChunkDesc {
  ChunkTypes chunkType;
  int chunkVersion;
  int chunkId;
  uint32 fileOffset;
  void* data;
  uint32 size;
  bool bSwapEndian;
};
File

IChunkFile.h

Description

Chunk Description.

IChunkFile::ChunkDesc::bSwapEndian Data Member
C++
bool bSwapEndian;
IChunkFile::ChunkDesc::chunkId Data Member
C++
int chunkId;
IChunkFile::ChunkDesc::chunkType Data Member
C++
ChunkTypes chunkType;
IChunkFile::ChunkDesc::chunkVersion Data Member
C++
int chunkVersion;
IChunkFile::ChunkDesc::data Data Member
C++
void* data;
IChunkFile::ChunkDesc::fileOffset Data Member
C++
uint32 fileOffset;
IChunkFile::ChunkDesc::size Data Member
C++
uint32 size;
IChunkFile::ChunkDesc::ChunkDesc Constructor
C++
ChunkDesc();
IChunkFile::ChunkDesc::GetMemoryUsage Method
C++
void GetMemoryUsage(ICrySizer * pSizer) const;
IChunkFile::ChunkDesc::LessId Method
C++
static inline bool LessId(const ChunkDesc& d1, const ChunkDesc& d2);
IChunkFile::ChunkDesc::LessOffset Method
C++
static inline bool LessOffset(const ChunkDesc& d1, const ChunkDesc& d2);
IChunkFile::ChunkDesc::LessOffsetByPtr Method
C++
static inline bool LessOffsetByPtr(const ChunkDesc* d1, const ChunkDesc* d2);
IChunkFile::AddChunk Method
C++
virtual int AddChunk(ChunkTypes chunkType, int chunkVersion, EEndianness eEndianness, const void* chunkData, int chunkSize) = 0;
Description

Adds chunk to file, returns ChunkID of the added chunk.

IChunkFile::DeleteChunkById Method
C++
virtual void DeleteChunkById(int nChunkId) = 0;
IChunkFile::DeleteChunksByType Method
C++
virtual void DeleteChunksByType(ChunkTypes nChunkType) = 0;
IChunkFile::FindChunkById Method
C++
virtual ChunkDesc* FindChunkById(int nChunkId) = 0;
IChunkFile::FindChunkByType Method
C++
virtual ChunkDesc* FindChunkByType(ChunkTypes nChunkType) = 0;
IChunkFile::GetChunk Method (int)
C++
virtual ChunkDesc* GetChunk(int nIndex) = 0;
Description

Gets chunk description at i-th index.

IChunkFile::GetChunk Method (int)
C++
virtual const ChunkDesc* GetChunk(int nIndex) const = 0;
IChunkFile::GetLastError Method
C++
virtual const char* GetLastError() const = 0;
IChunkFile::GetMemoryUsage Method
C++
virtual void GetMemoryUsage(ICrySizer * pSizer) const = 0;
IChunkFile::IsLoaded Method
C++
virtual bool IsLoaded() const = 0;
IChunkFile::IsReadOnly Method
C++
virtual bool IsReadOnly() const = 0;
IChunkFile::NumChunks Method
C++
virtual int NumChunks() const = 0;
Description

Gets the number of chunks.

IChunkFile::Read Method
C++
virtual bool Read(const char * filename) = 0;
IChunkFile::ReadFromMemory Method
C++
virtual bool ReadFromMemory(const void * pData, int nDataSize) = 0;
IChunkFile::Release Method
C++
virtual void Release() = 0;
Description

Releases chunk file interface.

IChunkFile::ReleaseMemoryBuffer Method
C++
virtual void ReleaseMemoryBuffer() = 0;
Description

Releases memory that was allocated in WriteToMemoryBuffer()

IChunkFile::Write Method
C++
virtual bool Write(const char * filename) = 0;
Description

Writes chunks to file.

IChunkFile::WriteToMemoryBuffer Method
C++
virtual bool WriteToMemoryBuffer(void ** pData, int * nSize) = 0;
Description

Writes chunks to a memory buffer (allocated inside) and returns pointer to the allocated memory (pData) and its size (nSize). The memory will be released on destruction of the ChunkFile object, or on the next WriteToMemoryBuffer() call, or on ReleaseMemoryBuffer() call.