DBFEngine.h
资源名称:112.rar [点击查看]
上传用户:hjb520
上传日期:2022-08-08
资源大小:1251k
文件大小:3k
源码类别:
Windows CE
开发平台:
Visual C++
- #ifndef _DBF_H
- #define _DBF_H
- #define ASCEND 0
- #define DESCEND 1
- struct strField
- {
- TCHAR m_pfieldName[11];
- TCHAR m_fieldType;
- UINT m_fieldLen;
- UINT m_decCount;//XIAO SHU's counts
- };
- class CDbFile: public CObject
- {
- public:
- public:
- CDbFile();
- ~CDbFile();
- bool OpenDbf(LPTSTR pfileName);
- bool CloseDbf();
- BOOL InitHeadStructure();
- void GetFieldInfo();
- CString CharToWideChar(PBYTE,DWORD);
- int WideCharToChar(CString,char*);
- DWORD ReadFieldStr(UINT nRecNumber,UINT nFieldNum,PBYTE fieldBuffers);
- DWORD SetFieldStr(UINT nRecNumber,UINT nFieldNum,PBYTE fieldBuffers);
- DWORD AppendRecord();
- DWORD WriteAllDataToFile();
- DWORD SetFieldStr(UINT nRecNumber,UINT nFieldNum,PBYTE fieldBuffers,DWORD dwLen);
- DWORD AppendBlankRecordInMem();
- DWORD DeleteRecordInMem(int num);
- DWORD SetRecordCountInMem(int num);
- WORD GetFieldCount();//return field count.
- DWORD GetRecordCount();
- WORD GetHeadLen();
- WORD GetRecordLen();
- PBYTE GetAllDataPointer();
- strField* GetFieldInfoArray();
- BOOL DeleteAllDataPointer();
- BOOL DeleteFieldInfoArrayPointer();
- BYTE GetB(HANDLE hFile,DWORD offset);//return a byte from file's offset
- WORD GetW(HANDLE hFile,DWORD offset,bool DIRECT);//return a word from file's offset
- DWORD GetDW(HANDLE hFile,DWORD offset,bool DIRECT);//return a double word from file's offset
- bool OpenFpt(LPTSTR pfileName);
- bool CloseFpt();
- //DWORD GetMemoFieldFromDbfFile(UINT nRecNumber,UINT nFieldNum,PBYTE fieldBuffers);
- DWORD GetFptDataUnitLen();
- DWORD GetMemoFieldCommentLen(DWORD dwOffsetBlockNum);
- DWORD GetMemoFieldOffsetNumFromDbfFile(UINT nRecNumber,UINT nFieldNum,PBYTE fieldBuffers);
- DWORD InitGetMemField(UINT nRecNumber,UINT nFieldNum,PBYTE fieldBuffers);//return len for GetMemFieldStr()
- DWORD GetMemoFieldFromDbf(UINT nRecNumber,PBYTE fieldBuffers);
- DWORD SetFieldOffset(UINT nFieldNum);
- DWORD SetFieldLen(UINT nFieldNum);
- DWORD GetFieldStr(UINT nRecNumber,PBYTE fieldBuffers);
- DWORD InitGetMemField(UINT nRecNumber,PBYTE fieldBuffers);
- DWORD GetMemFieldStr(PBYTE memoFieldBuffers,DWORD len);
- DWORD GetFptFileSize();
- DWORD GetMemFieldStr(UINT nRecNumber,PBYTE fieldBuffers);
- DWORD GetMemFieldSize(PBYTE allFptDataBuf,UINT nRecNumber);
- DWORD GetMemFieldStrFromMemory(PBYTE allFptDataBuf,UINT nRecNumber,PBYTE fieldBuffers,DWORD n);
- BOOL ReadFptToMemory(PBYTE);
- HANDLE GetFptHandle();
- //////////////////////////////////////////
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- HANDLE OpenFile(LPTSTR pfileName);
- BOOL CloseFile(HANDLE hFile);
- BOOL GetRecordCount(LPBYTE pAllData,DWORD& recordCount);
- BOOL GetRecordLen(LPBYTE pAllData,DWORD& recordLen);
- BOOL GetHeadLen(LPBYTE pAllData,DWORD& headLen);
- BOOL GetFieldCount(DWORD headLen,DWORD& fieldCount);
- BOOL GetFileSize(HANDLE hFile,DWORD& len);
- BOOL ReadAllData(HANDLE hFile,LPBYTE pAllData,DWORD len,DWORD dwFileLen);
- void GetFieldInfo(LPBYTE pAllData,DWORD fieldCount,strField* pFieldInfoArray);
- DWORD ReadFieldStr(LPBYTE pAllData,strField* pFieldInfoArray,
- DWORD headLen,DWORD recordLen,
- UINT nRecNumber,UINT nFieldNum,PBYTE fieldBuffers);
- //CString GetInstallDir();
- CString GetExeDir();
- };
- #endif
- /////////////////////////////////////////////////////////////////////////////