|
Pyrogenesis
13997
|
helper class for reading binary files More...
#include <FileIo.h>
Public Member Functions | |
| 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... | |
Private Attributes | |
| shared_ptr< u8 > | m_buf |
| size_t | m_bufSize |
| size_t | m_unpackPos |
| u32 | m_version |
| current unpack position in stream More... | |
| CFileUnpacker::CFileUnpacker | ( | ) |
Definition at line 100 of file FileIo.cpp.
| CFileUnpacker::~CFileUnpacker | ( | ) |
Definition at line 106 of file FileIo.cpp.
|
inline |
| 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.
Definition at line 111 of file FileIo.cpp.
| 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.
Definition at line 150 of file FileIo.cpp.
| 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.
Definition at line 162 of file FileIo.cpp.
| void CFileUnpacker::UnpackString | ( | CStr8 & | result | ) |
unpack a string from the raw data stream.
| result | is assigned a newly constructed CStr8 holding the string read from the input stream. |
Definition at line 170 of file FileIo.cpp.
|
private |
1.8.5