23 #ifndef BAGEL_BOFLIB_DAT_FILE_H 24 #define BAGEL_BOFLIB_DAT_FILE_H 26 #include "common/serializer.h" 27 #include "bagel/spacebar/boflib/file.h" 32 #define CDF_NOFLAGS 0x00000000 33 #define CDF_READONLY CBF_READONLY // Open for Read-only access 34 #define CDF_OVERWRITE CBF_OVERWRITE // *Overwrite any existing data-file 35 #define CDF_SHARED CBF_SHARED // *Open for Shared access 36 #define CDF_CREATE CBF_CREATE // *Create new file if not exist 37 #define CDF_SAVEFILE CBF_SAVEFILE 39 #define CDF_MEMORY 0x00010000 // *header/footer should stay in memory 40 #define CDF_ENCRYPT 0x00020000 // Specifies if data should use encryption 41 #define CDF_KEEPOPEN 0x00040000 // File should be kept open after construction 42 #define CDF_COMPRESSED 0x00080000 // *Specifies if data should be compressed 45 #define CDF_DEFAULT (CDF_MEMORY | CDF_ENCRYPT | CDF_SHARED | CDF_KEEPOPEN | CDF_READONLY) 47 #define MAX_PW_LEN 32 // Max Password length 76 char _szPassWord[MAX_PW_LEN];
77 int32 _lHeaderLength = 0;
78 int32 _lHeaderStart = 0;
89 ErrorCode readHeader();
95 ErrorCode writeHeader();
114 ErrorCode setFile(
const char *pszFileName, uint32 lFlags);
120 ErrorCode releaseFile();
127 int32 getRecSize(int32 lRecNum);
128 int32 getNumberOfRecs()
const {
136 int32 getMaxRecSize()
const;
148 ErrorCode close()
override;
162 ErrorCode readRecord(int32 lRecNum,
void *pBuf);
169 ErrorCode readFromFile(int32 lRecNum,
void *pBuf, int32 lBytes);
180 ErrorCode writeRecord(int32 lRecNum,
void *pBuf, int32 lSize = -1,
bool bUpdateHeader =
false, uint32 lKey = 0xFFFFFFFF);
187 ErrorCode verifyRecord(int32 lRecNum);
193 ErrorCode verifyAllRecords();
203 ErrorCode addRecord(
void *pBuf, int32 lLength,
bool bUpdateHeader =
false, uint32 lKey = 0xFFFFFFFF);
210 int32 findRecord(uint32 lKey);
216 void setPassword(
const char *pszPassword);
217 const char *getPassword()
const {
227 ErrorCode read(
void *pDestBuf, int32 lBytes)
override;
237 ErrorCode write(
const void *pSrcBuf, int32 lBytes)
override;
Definition: dat_file.h:74
Definition: serializer.h:79
Definition: dat_file.h:62