helper class for reading binary files
More...
#include <FileIo.h>
|
| CFileUnpacker () |
|
| ~CFileUnpacker () |
|
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 open failed / version incorrect, etc. More...
|
|
u32 | GetVersion () const |
|
void | UnpackRaw (void *rawData, size_t rawDataSize) |
| unpack given number of bytes from the input into the given array. More...
|
|
size_t | UnpackSize () |
| use UnpackRaw to retrieve 32-bits; returns their value as size_t after converting from little endian to native byte order. More...
|
|
void | UnpackString (CStr8 &result) |
| unpack a string from the raw data stream. More...
|
|
helper class for reading binary files
CFileUnpacker::CFileUnpacker |
( |
| ) |
|
CFileUnpacker::~CFileUnpacker |
( |
| ) |
|
u32 CFileUnpacker::GetVersion |
( |
| ) |
const |
|
inline |
- Returns
- version number that was stored in the file's header.
void CFileUnpacker::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 open failed / version incorrect, etc.
void CFileUnpacker::UnpackRaw |
( |
void * |
rawData, |
|
|
size_t |
rawDataSize |
|
) |
| |
unpack given number of bytes from the input into the given array.
throws PSERROR_File_UnexpectedEOF if the end of the data stream is reached before the given number of bytes have been read.
size_t CFileUnpacker::UnpackSize |
( |
| ) |
|
use UnpackRaw to retrieve 32-bits; returns their value as size_t after converting from little endian to native byte order.
void CFileUnpacker::UnpackString |
( |
CStr8 & |
result | ) |
|
unpack a string from the raw data stream.
- Parameters
-
result | is assigned a newly constructed CStr8 holding the string read from the input stream. |
shared_ptr<u8> CFileUnpacker::m_buf |
|
private |
size_t CFileUnpacker::m_bufSize |
|
private |
size_t CFileUnpacker::m_unpackPos |
|
private |
u32 CFileUnpacker::m_version |
|
private |
current unpack position in stream
The documentation for this class was generated from the following files: