Pyrogenesis
13997
|
helper class for writing binary files. More...
#include <FileIo.h>
Public Member Functions | |
CFilePacker (u32 version, const char magic[4]) | |
adds version and signature (i.e. More... | |
~CFilePacker () | |
void | Write (const VfsPath &filename) |
write out to file all packed data added so far. More... | |
void | PackRaw (const void *rawData, size_t rawDataSize) |
pack given number of bytes onto the end of the data stream More... | |
void | PackSize (size_t value) |
convenience: convert a number (almost always a size type) to little-endian u32 and pack that. More... | |
void | PackString (const CStr &str) |
pack a string onto the end of the data stream (encoded as a 32-bit length followed by the characters) More... | |
Private Attributes | |
WriteBuffer | m_writeBuffer |
the output data stream built during pack operations. More... | |
helper class for writing binary files.
this is basically a resizable buffer that allows adding raw data and strings; upon calling Write(), everything is written out to disk.
CFilePacker::CFilePacker | ( | u32 | version, |
const char | magic[4] | ||
) |
adds version and signature (i.e.
the header) to the buffer. this means Write() can write the entire buffer to file in one go, which is simpler and more efficient than writing in pieces.
Definition at line 45 of file FileIo.cpp.
CFilePacker::~CFilePacker | ( | ) |
Definition at line 57 of file FileIo.cpp.
void CFilePacker::PackRaw | ( | const void * | rawData, |
size_t | rawDataSize | ||
) |
pack given number of bytes onto the end of the data stream
Definition at line 78 of file FileIo.cpp.
void CFilePacker::PackSize | ( | size_t | value | ) |
convenience: convert a number (almost always a size type) to little-endian u32 and pack that.
Definition at line 83 of file FileIo.cpp.
void CFilePacker::PackString | ( | const CStr & | str | ) |
pack a string onto the end of the data stream (encoded as a 32-bit length followed by the characters)
Definition at line 89 of file FileIo.cpp.
void CFilePacker::Write | ( | const VfsPath & | filename | ) |
write out to file all packed data added so far.
it's safe to call this multiple times, but typically would only be done once.
Definition at line 62 of file FileIo.cpp.
|
private |