|
| CBofDataFile () |
|
virtual | ~CBofDataFile () |
|
ErrorCode | setFile (const char *pszFileName, uint32 lFlags) |
|
ErrorCode | releaseFile () |
|
int32 | getRecSize (int32 lRecNum) |
|
int32 | getNumberOfRecs () const |
|
int32 | getMaxRecSize () const |
|
ErrorCode | open () |
|
ErrorCode | close () override |
|
ErrorCode | create () |
|
ErrorCode | readRecord (int32 lRecNum, void *pBuf) |
|
ErrorCode | readFromFile (int32 lRecNum, void *pBuf, int32 lBytes) |
|
ErrorCode | writeRecord (int32 lRecNum, void *pBuf, int32 lSize=-1, bool bUpdateHeader=false, uint32 lKey=0xFFFFFFFF) |
|
ErrorCode | verifyRecord (int32 lRecNum) |
|
ErrorCode | verifyAllRecords () |
|
ErrorCode | addRecord (void *pBuf, int32 lLength, bool bUpdateHeader=false, uint32 lKey=0xFFFFFFFF) |
|
int32 | findRecord (uint32 lKey) |
|
void | setPassword (const char *pszPassword) |
|
const char * | getPassword () const |
|
ErrorCode | read (void *pDestBuf, int32 lBytes) override |
|
ErrorCode | read (HeaderRec &rec) |
|
ErrorCode | read (HeadInfo &rec) |
|
ErrorCode | write (const void *pSrcBuf, int32 lBytes) override |
|
ErrorCode | write (HeaderRec &rec) |
|
ErrorCode | write (HeadInfo &rec) |
|
| CBofFile () |
|
| CBofFile (const char *pszFileName, uint32 lFlags=(0x00000002|0x00000004)) |
|
virtual | ~CBofFile () |
|
ErrorCode | open (const char *pszFileName, uint32 lFlags=(0x00000002|0x00000004)) |
|
ErrorCode | create (const char *pszFileName, uint32 lFlags=(0x00000002|0x00000004)|0x00000020) |
|
void | commit () |
|
ErrorCode | seek (uint32 lPos) |
|
ErrorCode | seekToBeginning () |
|
ErrorCode | seekToEnd () |
|
ErrorCode | setPosition (uint32 lPos) |
|
uint32 | getPosition () |
|
uint32 | getLength () |
|
| operator Common::SeekableReadStream * () const |
|
void | reportError (ErrorCode errCode, const char *format,...) |
|
bool | errorOccurred () const |
|
ErrorCode | getErrorCode () const |
|
void | clearError () |
|
|
static bool | isValidObject (const CBofObject *pObject) |
|
static void | fatalError (ErrorCode errCode, const char *format,...) |
|
static void | initialize () |
|
static int | getErrorCount () |
|
char | _szFileName [MAX_FNAME] |
|
Common::Stream * | _stream = nullptr |
|
uint32 | _lFlags = ( 0x00000002 | 0x00000004 ) |
|
ErrorCode | _errCode |
|
static int | _count |
|
◆ CBofDataFile()
Bagel::CBofDataFile::CBofDataFile |
( |
| ) |
|
◆ ~CBofDataFile()
virtual Bagel::CBofDataFile::~CBofDataFile |
( |
| ) |
|
|
virtual |
◆ readHeader()
ErrorCode Bagel::CBofDataFile::readHeader |
( |
| ) |
|
|
protected |
Read the header (actually a footer) from the data-file.
- Returns
- Error return code
◆ writeHeader()
ErrorCode Bagel::CBofDataFile::writeHeader |
( |
| ) |
|
|
protected |
Writes the header (actually a footer) to the data-file.
- Returns
- Error return code
◆ setFile()
ErrorCode Bagel::CBofDataFile::setFile |
( |
const char * |
pszFileName, |
|
|
uint32 |
lFlags |
|
) |
| |
Initializes a CBofDataFile with specified info
- Parameters
-
pszFileName | Name of .DAT file |
lFlags | Flags for open, and encryption, etc. |
- Returns
- Error return code
◆ releaseFile()
ErrorCode Bagel::CBofDataFile::releaseFile |
( |
| ) |
|
Free memory used by this object
- Returns
- Error return code
◆ getRecSize()
int32 Bagel::CBofDataFile::getRecSize |
( |
int32 |
lRecNum | ) |
|
Retrieves size of specified record.
- Parameters
-
lRecNum | Index of record to get size of |
- Returns
- Size of specified record
◆ getMaxRecSize()
int32 Bagel::CBofDataFile::getMaxRecSize |
( |
| ) |
const |
Retrieves size of the largest record.
- Returns
- Size of largest record in the data-file
◆ open()
ErrorCode Bagel::CBofDataFile::open |
( |
| ) |
|
Opens an existing data-file, or creates a new one.
- Returns
- Error return code
◆ close()
ErrorCode Bagel::CBofDataFile::close |
( |
| ) |
|
|
overridevirtual |
Closes current data-file, if it's not already closed
- Returns
- Error return code
Reimplemented from Bagel::CBofFile.
◆ create()
ErrorCode Bagel::CBofDataFile::create |
( |
| ) |
|
Destroys current data-file, if any, and starts a new empty one
- Returns
- Error return code
◆ readRecord()
ErrorCode Bagel::CBofDataFile::readRecord |
( |
int32 |
lRecNum, |
|
|
void * |
pBuf |
|
) |
| |
Reads specified record from data-file.
- Parameters
-
lRecNum | Record number to read |
pBuf | Buffer to store record |
- Returns
- Error return code
◆ readFromFile()
ErrorCode Bagel::CBofDataFile::readFromFile |
( |
int32 |
lRecNum, |
|
|
void * |
pBuf, |
|
|
int32 |
lBytes |
|
) |
| |
Read a set number of bytes from the beginning of a file, don't bother with a CRC, but decrypt if necessary. This is dependent upon the decryption being based on a single byte ordering scheme.
◆ writeRecord()
ErrorCode Bagel::CBofDataFile::writeRecord |
( |
int32 |
lRecNum, |
|
|
void * |
pBuf, |
|
|
int32 |
lSize = -1 , |
|
|
bool |
bUpdateHeader = false , |
|
|
uint32 |
lKey = 0xFFFFFFFF |
|
) |
| |
Writes specified to data-file.
- Parameters
-
lRecNum | Record number to read |
pBuf | Buffer to write data from |
lSize | Size of buffer |
bUpdateHeader | True if header is to be committed to disk |
lKey | Hash key |
- Returns
- Error return code
◆ verifyRecord()
ErrorCode Bagel::CBofDataFile::verifyRecord |
( |
int32 |
lRecNum | ) |
|
Verifies specified record in data-file.
- Parameters
-
lRecNum | Record number to verify |
- Returns
- Error return code
◆ verifyAllRecords()
ErrorCode Bagel::CBofDataFile::verifyAllRecords |
( |
| ) |
|
Verifies all records in this file
- Returns
- Error return code
◆ addRecord()
ErrorCode Bagel::CBofDataFile::addRecord |
( |
void * |
pBuf, |
|
|
int32 |
lLength, |
|
|
bool |
bUpdateHeader = false , |
|
|
uint32 |
lKey = 0xFFFFFFFF |
|
) |
| |
Adds a new record to the data-file.
- Parameters
-
pBuf | Buffer to write data from |
lLength | Size of buffer |
bUpdateHeader | true if header is to be committed to disk |
lKey | hash Key |
- Returns
- Error return code
◆ findRecord()
int32 Bagel::CBofDataFile::findRecord |
( |
uint32 |
lKey | ) |
|
Finds record by it's key.
- Parameters
-
lKey | Key to search records with |
- Returns
- Index of record matching key, or -1
◆ setPassword()
void Bagel::CBofDataFile::setPassword |
( |
const char * |
pszPassword | ) |
|
Sets encryption password
- Parameters
-
◆ read()
ErrorCode Bagel::CBofDataFile::read |
( |
void * |
pDestBuf, |
|
|
int32 |
lBytes |
|
) |
| |
|
overridevirtual |
Read from a currently open file
- Parameters
-
pDestBuf | Destination buffer |
lBytes | Number of bytes |
- Returns
- Error code
Reimplemented from Bagel::CBofFile.
◆ write()
ErrorCode Bagel::CBofDataFile::write |
( |
const void * |
pSrcBuf, |
|
|
int32 |
lBytes |
|
) |
| |
|
overridevirtual |
Write to a currently open file
- Parameters
-
pSrcBuf | Source buffer |
lBytes | Number of bytes |
- Returns
- Error code
Reimplemented from Bagel::CBofFile.
The documentation for this class was generated from the following file: