30#ifndef INCLUDED_FILEPACKER
31#define INCLUDED_FILEPACKER
74 void PackRaw(
const void* rawData,
size_t rawDataSize);
110 void Read(
const VfsPath& filename,
const char magic[4]);
125 void UnpackRaw(
void* rawData,
size_t rawDataSize);
ERROR_TYPE(File, OpenFailed)
helper class for writing binary files.
Definition: FileIo.h:53
void Write(const VfsPath &filename)
write out to file all packed data added so far.
Definition: FileIo.cpp:63
CFilePacker(u32 version, const char magic[4])
adds version and signature (i.e.
Definition: FileIo.cpp:46
void PackSize(size_t value)
convenience: convert a number (almost always a size type) to little-endian u32 and pack that.
Definition: FileIo.cpp:84
WriteBuffer m_writeBuffer
the output data stream built during pack operations.
Definition: FileIo.h:93
~CFilePacker()
Definition: FileIo.cpp:58
void PackString(const CStr8 &str)
pack a string onto the end of the data stream (encoded as a 32-bit length followed by the characters)
Definition: FileIo.cpp:90
void PackRaw(const void *rawData, size_t rawDataSize)
pack given number of bytes onto the end of the data stream
Definition: FileIo.cpp:79
helper class for reading binary files
Definition: FileIo.h:101
~CFileUnpacker()
Definition: FileIo.cpp:107
void UnpackRaw(void *rawData, size_t rawDataSize)
unpack given number of bytes from the input into the given array.
Definition: FileIo.cpp:151
u32 GetVersion() const
Definition: FileIo.h:115
size_t m_unpackPos
Definition: FileIo.h:145
size_t UnpackSize()
use UnpackRaw to retrieve 32-bits; returns their value as size_t after converting from little endian ...
Definition: FileIo.cpp:163
size_t m_bufSize
Definition: FileIo.h:143
CFileUnpacker()
Definition: FileIo.cpp:101
void Read(const VfsPath &filename, const char magic[4])
open and read in given file, check magic bits against those given; throw variety of exceptions if ope...
Definition: FileIo.cpp:112
std::shared_ptr< u8 > m_buf
Definition: FileIo.h:142
void UnpackString(CStr8 &result)
unpack a string from the raw data stream.
Definition: FileIo.cpp:171
u32 m_version
current unpack position in stream
Definition: FileIo.h:146
Definition: write_buffer.h:29
uint32_t u32
Definition: types.h:39