diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-23 20:32:10 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-23 20:32:10 +0000 |
commit | c1075c9ea02e77bcb55fa627623b1ac598abda44 (patch) | |
tree | e140de04b3f1d4cbd517f270d8720baef8cf9353 /plugins/Db3x_mmap/src/dbintf.h | |
parent | 35d4044e1958d2cd68553837a0da0829bd3b98f4 (diff) |
slightly changed class hierarchy
git-svn-id: http://svn.miranda-ng.org/main/trunk@1141 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db3x_mmap/src/dbintf.h')
-rw-r--r-- | plugins/Db3x_mmap/src/dbintf.h | 50 |
1 files changed, 36 insertions, 14 deletions
diff --git a/plugins/Db3x_mmap/src/dbintf.h b/plugins/Db3x_mmap/src/dbintf.h index 4dff427516..c3a14c0c01 100644 --- a/plugins/Db3x_mmap/src/dbintf.h +++ b/plugins/Db3x_mmap/src/dbintf.h @@ -156,16 +156,19 @@ struct DBCachedContactValueList #define MAXCACHEDREADSIZE 65536
-struct CDdxMmap : public MIDatabase, public MZeroedObject
+struct CDb3Base : public MIDatabase, public MZeroedObject
{
- CDdxMmap(const TCHAR* tszFileName);
- ~CDdxMmap();
+ CDb3Base(const TCHAR* tszFileName);
+ ~CDb3Base();
int Load(bool bSkipInit);
int Create(void);
int CreateDbHeaders();
int CheckDbHeaders();
void DatabaseCorruption(TCHAR *text);
+
+ __forceinline HANDLE getFile() const { return m_hDbFile; }
+
protected:
STDMETHODIMP_(void) SetCacheSafetyMode(BOOL);
@@ -202,6 +205,14 @@ protected: STDMETHODIMP_(BOOL) EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam);
protected:
+ virtual void DBMoveChunk(DWORD ofsDest, DWORD ofsSource, int bytes) = 0;
+ virtual PBYTE DBRead(DWORD ofs, int bytesRequired, int *bytesAvail) = 0;
+ virtual void DBWrite(DWORD ofs, PVOID pData, int bytes) = 0;
+ virtual void DBFill(DWORD ofs, int bytes) = 0;
+ virtual void DBFlush(int setting) = 0;
+ virtual int InitCache(void) = 0;
+
+protected:
virtual void EncodeCopyMemory(void *dst, void *src, size_t size);
virtual void DecodeCopyMemory(void *dst, void *src, size_t size);
virtual void EncodeDBWrite(DWORD ofs, void *src, int size);
@@ -220,9 +231,8 @@ public: UINT_PTR m_flushBuffersTimerId;
DWORD m_flushFailTick;
PBYTE m_pDbCache;
+
protected:
- PBYTE m_pNull;
- HANDLE m_hMap;
DWORD m_dwFileSize;
CRITICAL_SECTION m_csDbAccess;
@@ -232,15 +242,6 @@ protected: void DeleteSpace(DWORD ofs, int bytes);
DWORD ReallocSpace(DWORD ofs, int oldSize, int newSize);
- void Map();
- void ReMap(DWORD needed);
- void DBMoveChunk(DWORD ofsDest, DWORD ofsSource, int bytes);
- PBYTE DBRead(DWORD ofs, int bytesRequired, int *bytesAvail);
- void DBWrite(DWORD ofs, PVOID pData, int bytes);
- void DBFill(DWORD ofs, int bytes);
- void DBFlush(int setting);
- int InitCache(void);
-
__forceinline PBYTE DBRead(HANDLE hContact, int bytesRequired, int *bytesAvail)
{ return DBRead((DWORD)hContact, bytesRequired, bytesAvail);
}
@@ -287,3 +288,24 @@ protected: DWORD GetModuleNameOfs(const char *szName);
char *GetModuleNameByOfs(DWORD ofs);
};
+
+struct CDb3Mmap : public CDb3Base
+{
+ CDb3Mmap(const TCHAR* ptszFileName);
+ ~CDb3Mmap();
+
+protected:
+ virtual void DBMoveChunk(DWORD ofsDest, DWORD ofsSource, int bytes);
+ virtual PBYTE DBRead(DWORD ofs, int bytesRequired, int *bytesAvail);
+ virtual void DBWrite(DWORD ofs, PVOID pData, int bytes);
+ virtual void DBFill(DWORD ofs, int bytes);
+ virtual void DBFlush(int setting);
+ virtual int InitCache(void);
+
+protected:
+ PBYTE m_pNull;
+ HANDLE m_hMap;
+
+ void Map();
+ void ReMap(DWORD needed);
+};
|