1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
#include "hdr/modern_commonheaders.h"
#ifdef _DEBUG // REMOVE ME, as soon as ghazan will implement msvcprt.lib msvcrt.lib analogs to vc6tovc7.lib
#include "hdr/modern_skinned_profile.h"
//need to be linked in: atls.lib msvcprt.lib msvcrt.lib
CSkinnedProfile CSkinnedProfile::_me;
CSkinnedProfile::CSkinnedProfile()
{
Init();
}
CSkinnedProfile::~CSkinnedProfile()
{
}
HRESULT CSkinnedProfile::Init()
{
CAutoCriticalSection Lock( SkinProfile()->_Lock, true );
SkinnedProfile.clear();
return S_OK;
}
HRESULT CSkinnedProfile::Clear()
{
CAutoCriticalSection Lock( SkinProfile()->_Lock, true );
SkinnedProfile.clear();
return S_OK;
}
ValueVariant* CSkinnedProfile::_GetValue( const char * szSection, const char * szKey )
{
KeyList_t::iterator k_it = SkinnedProfile.find( szSection );
if ( k_it == SkinnedProfile.end() )
return NULL; // Not skinned
ValueList_t::iterator v_it = k_it->second.find( szKey );
if ( v_it == k_it->second.end() )
return NULL; // Not skinned
return &( v_it->second );
};
BYTE CSkinnedProfile::SpiGetSkinByte( HANDLE hContact, const char * szSection, const char * szKey, const BYTE defValue )
{
if ( hContact )
return ModernGetSettingByte( hContact, szSection, szKey, defValue ); //per-contact settings are not skinnablr at all
CAutoCriticalSection Lock( SkinProfile()->_Lock, true );
ValueVariant* value = SkinProfile()->_GetValue( szSection, szKey );
if ( value == NULL ) // not skinned => return DB
return ModernGetSettingWord( hContact, szSection, szKey, defValue );
else if ( !value->IsEmpty() )
return value->GetByte();
return defValue; // skinned but empty => return default value
}
WORD CSkinnedProfile::SpiGetSkinWord( HANDLE hContact, const char * szSection, const char * szKey, const WORD defValue )
{
if ( hContact )
return ModernGetSettingWord( hContact, szSection, szKey, defValue ); //per-contact settings are not skinnablr at all
CAutoCriticalSection Lock( SkinProfile()->_Lock, true );
ValueVariant* value = SkinProfile()->_GetValue( szSection, szKey );
if ( value == NULL ) // not skinned => return DB
return ModernGetSettingWord( hContact, szSection, szKey, defValue );
else if ( !value->IsEmpty() )
return value->GetWord();
return defValue; // skinned but empty => return default value
}
DWORD CSkinnedProfile::SpiGetSkinDword( HANDLE hContact, const char * szSection, const char * szKey, const DWORD defValue )
{
if ( hContact )
return ModernGetSettingDword( hContact, szSection, szKey, defValue ); //per-contact settings are not skinnablr at all
CAutoCriticalSection Lock( SkinProfile()->_Lock, true );
ValueVariant* value = SkinProfile()->_GetValue( szSection, szKey );
if ( value == NULL ) // not skinned => return DB
return ModernGetSettingDword( hContact, szSection, szKey, defValue );
else if ( !value->IsEmpty() )
return value->GetDword();
return defValue; // skinned but empty => return default value
}
BOOL CSkinnedProfile::SpiCheckSkinned( HANDLE hContact, const char * szSection, const char * szKey )
{
if ( hContact )
return FALSE;
CAutoCriticalSection Lock( SkinProfile()->_Lock, true );
return ( SkinProfile()->_GetValue( szSection, szKey ) == NULL );
}
#endif // _DEBUG // REMOVE ME, as soon as ghazan will implement msvcprt.lib msvcrt.lib analogs to vc6tovc7.lib
|