|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: IM Service Connection data cache implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <badesca.h> |
|
20 #include <e32cmn.h> |
|
21 |
|
22 #include "imdatacacheimp.h" |
|
23 //#include "ximpidentityimp.h" |
|
24 //#include "ximpobjecthelpers.h" |
|
25 #include "ximphost.h" |
|
26 //#include "ximppsccontext.h" |
|
27 //#include "ximpoperationdefs.h" |
|
28 #include "ximpapieventbase.h" |
|
29 //#include "ximptrace.h" |
|
30 #include "conversationsubscriptionitem.h" |
|
31 #include "imconversationeventimp.h" |
|
32 |
|
33 // --------------------------------------------------------------------------- |
|
34 // CImDataCache::CImDataCache() |
|
35 // --------------------------------------------------------------------------- |
|
36 // |
|
37 CImDataCache::CImDataCache( MXIMPHost& aHost ) |
|
38 :iHost( aHost ) |
|
39 { |
|
40 } |
|
41 // --------------------------------------------------------------------------- |
|
42 // CImDataCache::ConstructL() |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 void CImDataCache::ConstructL() |
|
46 { |
|
47 |
|
48 } |
|
49 // --------------------------------------------------------------------------- |
|
50 // CImDataCache::NewL() |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 EXPORT_C CImDataCache* CImDataCache::NewL( MXIMPHost& aHost ) |
|
54 { |
|
55 CImDataCache* self = new( ELeave ) CImDataCache( aHost ); |
|
56 CleanupStack::PushL( self ); |
|
57 self->ConstructL(); |
|
58 CleanupStack::Pop( self ); |
|
59 return self; |
|
60 } |
|
61 // --------------------------------------------------------------------------- |
|
62 // CImDataCache::~CImDataCache() |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 CImDataCache::~CImDataCache() |
|
66 { |
|
67 |
|
68 } |
|
69 // --------------------------------------------------------------------------- |
|
70 // CImDataCache::RemoveMe |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 template< class Type > |
|
74 EXPORT_C void CImDataCache::RemoveMe( Type*& aItem, Type* aChild ) |
|
75 { |
|
76 if( aChild == aItem ) |
|
77 { |
|
78 aItem = NULL; |
|
79 } |
|
80 } |
|
81 // --------------------------------------------------------------------------- |
|
82 // CImDataCache::AddEventL |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 void CImDataCache::AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext ) |
|
86 { |
|
87 iHost.AddEventL( aEvent, aContext ); |
|
88 } |
|
89 |
|
90 // --------------------------------------------------------------------------- |
|
91 // CImDataCache::RegisterExpiringItemL |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 void CImDataCache::RegisterExpiringItemL( CXIMPSubscriptionItemBase* /*aExpireItem*/ ) |
|
95 { |
|
96 |
|
97 } |
|
98 // --------------------------------------------------------------------------- |
|
99 // CImDataCache::UnregisterExpiringItemL |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 void CImDataCache::UnregisterExpiringItem( CXIMPSubscriptionItemBase* /*aExpireItem*/ ) |
|
103 { |
|
104 |
|
105 } |
|
106 // --------------------------------------------------------------------------- |
|
107 // CImDataCache::ItemLC |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
|
110 template< class Type > |
|
111 Type& CImDataCache::ItemLC( Type*& aItem ) |
|
112 { |
|
113 if( !aItem ) |
|
114 { |
|
115 aItem = Type::NewLC( *this ); |
|
116 } |
|
117 else |
|
118 { |
|
119 User::LeaveIfError( aItem->Open() ); |
|
120 CleanupClosePushL( *aItem ); |
|
121 } |
|
122 return *aItem; |
|
123 } |
|
124 // --------------------------------------------------------------------------- |
|
125 // CImDataCache::CleanResources |
|
126 // --------------------------------------------------------------------------- |
|
127 // |
|
128 EXPORT_C void CImDataCache::CleanResources( MXIMPPscContext& /*aContext*/ ) |
|
129 { |
|
130 |
|
131 } |
|
132 // --------------------------------------------------------------------------- |
|
133 // CImDataCache::CleanExpired |
|
134 // --------------------------------------------------------------------------- |
|
135 // |
|
136 EXPORT_C void CImDataCache::CleanExpired() |
|
137 { |
|
138 |
|
139 } |
|
140 // --------------------------------------------------------------------------- |
|
141 // CImDataCache::RemoveMe |
|
142 // --------------------------------------------------------------------------- |
|
143 // |
|
144 void CImDataCache::RemoveMe( CConversationSubscriptionItem* aChild ) |
|
145 { |
|
146 RemoveMe< CConversationSubscriptionItem >( |
|
147 iConversationSubscriptionItem, aChild ); |
|
148 } |
|
149 // --------------------------------------------------------------------------- |
|
150 // CImDataCache::ConversationSubscriptionItemLC |
|
151 // --------------------------------------------------------------------------- |
|
152 // |
|
153 EXPORT_C CConversationSubscriptionItem& CImDataCache::ConversationSubscriptionItemLC() |
|
154 { |
|
155 return ItemLC< CConversationSubscriptionItem >( iConversationSubscriptionItem ); |
|
156 } |
|
157 |
|
158 TAny* CImDataCache::GetInterface(TInt aInterfaceId) |
|
159 { |
|
160 if(aInterfaceId == IM_ITEM_PARENT) |
|
161 { |
|
162 return static_cast<MXIMPIMItemParent*>(this) ; |
|
163 } |
|
164 else |
|
165 { |
|
166 User::Panic( _L("CXIMPIMCache"), KErrExtensionNotSupported ); |
|
167 } |
|
168 return NULL ; |
|
169 } |
|
170 |
|
171 // End of file |