diff options
Diffstat (limited to 'include/m_protoint.h')
-rw-r--r-- | include/m_protoint.h | 102 |
1 files changed, 66 insertions, 36 deletions
diff --git a/include/m_protoint.h b/include/m_protoint.h index 1905f85a18..69aa6339b4 100644 --- a/include/m_protoint.h +++ b/include/m_protoint.h @@ -57,48 +57,78 @@ struct PROTO_INTERFACE : public MZeroedObject //////////////////////////////////////////////////////////////////////////////////////
// Helpers
- __forceinline INT_PTR ProtoBroadcastAck(HANDLE hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam)
- { return ::ProtoBroadcastAck(m_szModuleName, hContact, type, hResult, hProcess, lParam); }
+ __forceinline INT_PTR ProtoBroadcastAck(HANDLE hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam) {
+ return ::ProtoBroadcastAck(m_szModuleName, hContact, type, hResult, hProcess, lParam); }
__forceinline INT_PTR delSetting(const char *name) { return db_unset(NULL, m_szModuleName, name); }
__forceinline INT_PTR delSetting(HANDLE hContact, const char *name) { return db_unset(hContact, m_szModuleName, name); }
- __forceinline bool getBool(const char *name, bool defaultValue) { return ProtoGetBool0(this, name, defaultValue); }
- __forceinline bool getBool(HANDLE hContact, const char *name, bool defaultValue) { return ProtoGetBool(this, hContact, name, defaultValue); }
- __forceinline bool isChatRoom(HANDLE hContact) { return getBool(hContact, "ChatRoom", false); }
-
- __forceinline int getByte(const char *name, BYTE defaultValue) { return ProtoGetByte0(this, name, defaultValue); }
- __forceinline int getByte(HANDLE hContact, const char *name, BYTE defaultValue) { return ProtoGetByte(this, hContact, name, defaultValue); }
-
- __forceinline int getWord(const char *name, WORD defaultValue) { return ProtoGetWord0(this, name, defaultValue); }
- __forceinline int getWord(HANDLE hContact, const char *name, WORD defaultValue) { return ProtoGetWord(this, hContact, name, defaultValue); }
-
- __forceinline DWORD getDword(const char *name, DWORD defaultValue) { return ProtoGetDword0(this, name, defaultValue); }
- __forceinline DWORD getDword(HANDLE hContact, const char *name, DWORD defaultValue) { return ProtoGetDword(this, hContact, name, defaultValue); }
-
- __forceinline int getString(const char *name, DBVARIANT *result) { return ProtoGetString0(this, name, result); }
- __forceinline int getString(HANDLE hContact, const char *name, DBVARIANT *result) { return ProtoGetString(this, hContact, name, result); }
-
- __forceinline int getTString(const char *name, DBVARIANT *result) { return ProtoGetTString0(this, name, result); }
- __forceinline int getTString(HANDLE hContact, const char *name, DBVARIANT *result) { return ProtoGetTString(this, hContact, name, result); }
+ __forceinline bool getBool(const char *name, bool defaultValue) {
+ return db_get_b(NULL, m_szModuleName, name, defaultValue) != 0; }
+ __forceinline bool getBool(HANDLE hContact, const char *name, bool defaultValue) {
+ return db_get_b(hContact, m_szModuleName, name, defaultValue) != 0; }
- __forceinline char* getStringA(const char *name) { return ProtoGetStringA0(this, name); }
- __forceinline char* getStringA(HANDLE hContact, const char *name) { return ProtoGetStringA(this, hContact, name); }
-
- __forceinline void setByte(const char *name, BYTE value) { ProtoSetByte0(this, name, value); }
- __forceinline void setByte(HANDLE hContact, const char *name, BYTE value) { ProtoSetByte(this, hContact, name, value); }
-
- __forceinline void setWord(const char *name, WORD value) { ProtoSetWord0(this, name, value); }
- __forceinline void setWord(HANDLE hContact, const char *name, WORD value) { ProtoSetWord(this, hContact, name, value); }
-
- __forceinline void setDword(const char *name, DWORD value) { ProtoSetDword0(this, name, value); }
- __forceinline void setDword(HANDLE hContact, const char *name, DWORD value) { ProtoSetDword(this, hContact, name, value); }
-
- __forceinline void setString(const char *name, const char* value) { ProtoSetString0(this, name, value); }
- __forceinline void setString(HANDLE hContact, const char *name, const char* value) { ProtoSetString(this, hContact, name, value); }
+ __forceinline bool isChatRoom(HANDLE hContact) { return getBool(hContact, "ChatRoom", false); }
- __forceinline void setTString(const char *name, const TCHAR* value) { ProtoSetTString0(this, name, value); }
- __forceinline void setTString(HANDLE hContact, const char *name, const TCHAR* value) { ProtoSetTString(this, hContact, name, value); }
+ __forceinline int getByte(const char *name, BYTE defaultValue) {
+ return db_get_b(NULL, m_szModuleName, name, defaultValue); }
+ __forceinline int getByte(HANDLE hContact, const char *name, BYTE defaultValue) {
+ return db_get_b(hContact, m_szModuleName, name, defaultValue); }
+
+ __forceinline int getWord(const char *name, WORD defaultValue) {
+ return db_get_w(NULL, m_szModuleName, name, defaultValue); }
+ __forceinline int getWord(HANDLE hContact, const char *name, WORD defaultValue) {
+ return db_get_w(hContact, m_szModuleName, name, defaultValue); }
+
+ __forceinline DWORD getDword(const char *name, DWORD defaultValue) {
+ return db_get_dw(NULL, m_szModuleName, name, defaultValue); }
+ __forceinline DWORD getDword(HANDLE hContact, const char *name, DWORD defaultValue) {
+ return db_get_dw(hContact, m_szModuleName, name, defaultValue); }
+
+ __forceinline INT_PTR getString(const char *name, DBVARIANT *result) {
+ return db_get_s(NULL, m_szModuleName, name, result); }
+ __forceinline INT_PTR getString(HANDLE hContact, const char *name, DBVARIANT *result) {
+ return db_get_s(hContact, m_szModuleName, name, result); }
+
+ __forceinline INT_PTR getWString(const char *name, DBVARIANT *result) {
+ return db_get_ws(NULL, m_szModuleName, name, result); }
+ __forceinline INT_PTR getWString(HANDLE hContact, const char *name, DBVARIANT *result) {
+ return db_get_ws(hContact, m_szModuleName, name, result); }
+
+ __forceinline char* getStringA(const char *name) {
+ return db_get_sa(NULL, m_szModuleName, name); }
+ __forceinline char* getStringA(HANDLE hContact, const char *name) {
+ return db_get_sa(hContact, m_szModuleName, name); }
+
+ __forceinline WCHAR* getWStringA(const char *name) {
+ return db_get_wsa(NULL, m_szModuleName, name); }
+ __forceinline WCHAR* getWStringA(HANDLE hContact, const char *name) {
+ return db_get_wsa(hContact, m_szModuleName, name); }
+
+ __forceinline void setByte(const char *name, BYTE value) { db_set_b(NULL, m_szModuleName, name, value); }
+ __forceinline void setByte(HANDLE hContact, const char *name, BYTE value) { db_set_b(hContact, m_szModuleName, name, value); }
+
+ __forceinline void setWord(const char *name, WORD value) { db_set_w(NULL, m_szModuleName, name, value); }
+ __forceinline void setWord(HANDLE hContact, const char *name, WORD value) { db_set_w(hContact, m_szModuleName, name, value); }
+
+ __forceinline void setDword(const char *name, DWORD value) { db_set_dw(NULL, m_szModuleName, name, value); }
+ __forceinline void setDword(HANDLE hContact, const char *name, DWORD value) { db_set_dw(hContact, m_szModuleName, name, value); }
+
+ __forceinline void setString(const char *name, const char* value) { db_set_s(NULL, m_szModuleName, name, value); }
+ __forceinline void setString(HANDLE hContact, const char *name, const char* value) { db_set_s(hContact, m_szModuleName, name, value); }
+
+ __forceinline void setWString(const char *name, const WCHAR* value) { db_set_ws(NULL, m_szModuleName, name, value); }
+ __forceinline void setWString(HANDLE hContact, const char *name, const WCHAR* value) { db_set_ws(hContact, m_szModuleName, name, value); }
+
+ #if defined(_UNICODE)
+ #define getTString getWString
+ #define getTStringA getWStringA
+ #define setTString setWString
+ #else
+ #define getTString getString
+ #define getTStringA getStringA
+ #define setTString setString
+ #endif
//////////////////////////////////////////////////////////////////////////////////////
// Virtual functions
|