ScummVM API documentation
Bagel::CBofDataFile Class Reference
Inheritance diagram for Bagel::CBofDataFile:
Bagel::CBofFile Bagel::CBofObject Bagel::CBofError Bagel::CBagSaveGameFile

Public Member Functions

 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)
 
- Public Member Functions inherited from Bagel::CBofFile
 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
 
- Public Member Functions inherited from Bagel::CBofError
void reportError (ErrorCode errCode, const char *format,...)
 
bool errorOccurred () const
 
ErrorCode getErrorCode () const
 
void clearError ()
 

Protected Member Functions

ErrorCode readHeader ()
 
ErrorCode writeHeader ()
 
- Protected Member Functions inherited from Bagel::CBofError
virtual void bofMessageBox (const Common::String &content, const Common::String &title)
 

Additional Inherited Members

- Static Public Member Functions inherited from Bagel::CBofObject
static bool isValidObject (const CBofObject *pObject)
 
- Static Public Member Functions inherited from Bagel::CBofError
static void fatalError (ErrorCode errCode, const char *format,...)
 
static void initialize ()
 
static int getErrorCount ()
 
- Protected Attributes inherited from Bagel::CBofFile
char _szFileName [MAX_FNAME]
 
Common::Stream_stream = nullptr
 
uint32 _lFlags = ( 0x00000002 | 0x00000004 )
 
- Protected Attributes inherited from Bagel::CBofError
ErrorCode _errCode
 
- Static Protected Attributes inherited from Bagel::CBofError
static int _count
 

Constructor & Destructor Documentation

◆ CBofDataFile()

Bagel::CBofDataFile::CBofDataFile ( )

Constructor

◆ ~CBofDataFile()

virtual Bagel::CBofDataFile::~CBofDataFile ( )
virtual

Destructor

Member Function Documentation

◆ 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
pszFileNameName of .DAT file
lFlagsFlags 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
lRecNumIndex 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
lRecNumRecord number to read
pBufBuffer 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
lRecNumRecord number to read
pBufBuffer to write data from
lSizeSize of buffer
bUpdateHeaderTrue if header is to be committed to disk
lKeyHash key
Returns
Error return code

◆ verifyRecord()

ErrorCode Bagel::CBofDataFile::verifyRecord ( int32  lRecNum)

Verifies specified record in data-file.

Parameters
lRecNumRecord 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
pBufBuffer to write data from
lLengthSize of buffer
bUpdateHeadertrue if header is to be committed to disk
lKeyhash Key
Returns
Error return code

◆ findRecord()

int32 Bagel::CBofDataFile::findRecord ( uint32  lKey)

Finds record by it's key.

Parameters
lKeyKey to search records with
Returns
Index of record matching key, or -1

◆ setPassword()

void Bagel::CBofDataFile::setPassword ( const char *  pszPassword)

Sets encryption password

Parameters
pszPasswordNew password

◆ read()

ErrorCode Bagel::CBofDataFile::read ( void *  pDestBuf,
int32  lBytes 
)
overridevirtual

Read from a currently open file

Parameters
pDestBufDestination buffer
lBytesNumber 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
pSrcBufSource buffer
lBytesNumber of bytes
Returns
Error code

Reimplemented from Bagel::CBofFile.


The documentation for this class was generated from the following file: