diff options
author | George Hazan <ghazan@miranda.im> | 2018-08-07 22:15:18 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-08-07 22:15:18 +0300 |
commit | 624642196708533e1939263498725a3e8a18e2a4 (patch) | |
tree | 1389360a1ba9ed571af9a33ee05a06790dfff9d3 /include | |
parent | 96ac250c28999ca22ee4b75631911f96012e6136 (diff) |
MDatabaseReadonly - base class for all read-only database drivers
Diffstat (limited to 'include')
-rw-r--r-- | include/m_db_int.h | 58 |
1 files changed, 50 insertions, 8 deletions
diff --git a/include/m_db_int.h b/include/m_db_int.h index aa75e8eb2a..50b8279e23 100644 --- a/include/m_db_int.h +++ b/include/m_db_int.h @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_core.h>
#endif
-///////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////
// basic database interface
struct DBCachedGlobalValue
@@ -132,7 +132,10 @@ interface MIR_APP_EXPORT MIDatabase /////////////////////////////////////////////////////////////////////////////////////////
-class MIR_APP_EXPORT MDatabaseCommon : public MIDatabase
+#pragma warning(push)
+#pragma warning(disable:4275)
+
+class MIR_APP_EXPORT MDatabaseCommon : public MIDatabase, public MNonCopyable
{
HANDLE m_hLock = nullptr;
@@ -177,12 +180,51 @@ public: STDMETHODIMP_(BOOL) Backup(LPCWSTR);
};
-///////////////////////////////////////////////////////////////////////////////
+#pragma warning(pop)
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Read-only database, that cannot add/modify information in a profile
+
+class MIR_APP_EXPORT MDatabaseReadonly : public MDatabaseCommon
+{
+public:
+ MDatabaseReadonly();
+
+ STDMETHODIMP_(BOOL) IsRelational(void) override;
+
+ STDMETHODIMP_(void) SetCacheSafetyMode(BOOL) override;
+
+ STDMETHODIMP_(BOOL) EnumModuleNames(DBMODULEENUMPROC, void*) override;
+
+ ////////////////////////////////////////////////////////////////////////////////////////
+ STDMETHODIMP_(MCONTACT) AddContact(void) override;
+ STDMETHODIMP_(LONG) DeleteContact(MCONTACT) override;
+ STDMETHODIMP_(BOOL) IsDbContact(MCONTACT contactID) override;
+ STDMETHODIMP_(LONG) GetContactSize(void) override;
+
+ ////////////////////////////////////////////////////////////////////////////////////////
+ STDMETHODIMP_(MEVENT) AddEvent(MCONTACT, DBEVENTINFO*) override;
+ STDMETHODIMP_(BOOL) DeleteEvent(MCONTACT, MEVENT) override;
+ STDMETHODIMP_(LONG) GetBlobSize(MEVENT) override;
+ STDMETHODIMP_(BOOL) MarkEventRead(MCONTACT, MEVENT) override;
+ STDMETHODIMP_(MCONTACT) GetEventContact(MEVENT) override;
+ STDMETHODIMP_(MEVENT) FindFirstUnreadEvent(MCONTACT) override;
+
+ ////////////////////////////////////////////////////////////////////////////////////////
+ STDMETHODIMP_(BOOL) GetContactSettingWorker(MCONTACT, LPCSTR, LPCSTR, DBVARIANT*, int) override;
+ STDMETHODIMP_(BOOL) WriteContactSetting(MCONTACT, DBCONTACTWRITESETTING*) override;
+ STDMETHODIMP_(BOOL) DeleteContactSetting(MCONTACT, LPCSTR, LPCSTR) override;
+ STDMETHODIMP_(BOOL) EnumContactSettings(MCONTACT, DBSETTINGENUMPROC, const char*, void*) override;
+
+ ////////////////////////////////////////////////////////////////////////////////////////
+ STDMETHODIMP_(BOOL) MetaMergeHistory(DBCachedContact*, DBCachedContact*) override;
+ STDMETHODIMP_(BOOL) MetaSplitHistory(DBCachedContact*, DBCachedContact*) override;
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
// Each database plugin should register itself using this structure
-/*
- Codes for DATABASELINK functions
-*/
+// Codes for DATABASELINK functions
// grokHeader() error codes
#define EGROKPRF_NOERROR 0
@@ -232,12 +274,12 @@ struct DATABASELINK MDatabaseCommon* (*Load)(const wchar_t *profile, BOOL bReadOnly);
};
-///////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////
// cache access function
EXTERN_C MIR_CORE_DLL(DBCachedContact*) db_get_contact(MCONTACT);
-///////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////
// Database list's functions
EXTERN_C MIR_CORE_DLL(MDatabaseCommon*) db_get_current(void);
|