51
|
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: search data cache implementation.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include <badesca.h>
|
|
20 |
#include <e32cmn.h>
|
|
21 |
#include <ximphost.h>
|
|
22 |
#include <ximpapieventbase.h>
|
|
23 |
|
|
24 |
#include "searchkeyssubscriptionitem.h"
|
|
25 |
#include "searchdatacacheimp.h"
|
|
26 |
#include "searchsubscriptionitem.h"
|
|
27 |
#include "searcheventimp.h"
|
|
28 |
|
|
29 |
// ---------------------------------------------------------------------------
|
|
30 |
// CSearchDataCache ::CSearchDataCache ()
|
|
31 |
// ---------------------------------------------------------------------------
|
|
32 |
//
|
|
33 |
CSearchDataCache ::CSearchDataCache ( MXIMPHost& aHost )
|
|
34 |
:iHost( aHost )
|
|
35 |
{
|
|
36 |
}
|
|
37 |
// ---------------------------------------------------------------------------
|
|
38 |
// CSearchDataCache ::ConstructL()
|
|
39 |
// ---------------------------------------------------------------------------
|
|
40 |
//
|
|
41 |
void CSearchDataCache ::ConstructL()
|
|
42 |
{
|
|
43 |
|
|
44 |
}
|
|
45 |
// ---------------------------------------------------------------------------
|
|
46 |
// CSearchDataCache ::NewL()
|
|
47 |
// ---------------------------------------------------------------------------
|
|
48 |
//
|
|
49 |
EXPORT_C CSearchDataCache * CSearchDataCache ::NewL( MXIMPHost& aHost )
|
|
50 |
{
|
|
51 |
CSearchDataCache * self = new( ELeave ) CSearchDataCache ( aHost );
|
|
52 |
CleanupStack::PushL( self );
|
|
53 |
self->ConstructL();
|
|
54 |
CleanupStack::Pop( self );
|
|
55 |
return self;
|
|
56 |
}
|
|
57 |
// ---------------------------------------------------------------------------
|
|
58 |
// CSearchDataCache ::~CSearchDataCache ()
|
|
59 |
// ---------------------------------------------------------------------------
|
|
60 |
//
|
|
61 |
CSearchDataCache ::~CSearchDataCache ()
|
|
62 |
{
|
|
63 |
|
|
64 |
}
|
|
65 |
// ---------------------------------------------------------------------------
|
|
66 |
// CSearchDataCache ::RemoveMe
|
|
67 |
// ---------------------------------------------------------------------------
|
|
68 |
//
|
|
69 |
template< class Type >
|
|
70 |
EXPORT_C void CSearchDataCache ::RemoveMe( Type*& aItem, Type* aChild )
|
|
71 |
{
|
|
72 |
if( aChild == aItem )
|
|
73 |
{
|
|
74 |
aItem = NULL;
|
|
75 |
}
|
|
76 |
}
|
|
77 |
// ---------------------------------------------------------------------------
|
|
78 |
// CSearchDataCache ::AddEventL
|
|
79 |
// ---------------------------------------------------------------------------
|
|
80 |
//
|
|
81 |
void CSearchDataCache ::AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext )
|
|
82 |
{
|
|
83 |
iHost.AddEventL( aEvent, aContext );
|
|
84 |
}
|
|
85 |
|
|
86 |
// ---------------------------------------------------------------------------
|
|
87 |
// CSearchDataCache ::RegisterExpiringItemL
|
|
88 |
// ---------------------------------------------------------------------------
|
|
89 |
//
|
|
90 |
void CSearchDataCache ::RegisterExpiringItemL( CXIMPSubscriptionItemBase* /*aExpireItem*/ )
|
|
91 |
{
|
|
92 |
|
|
93 |
}
|
|
94 |
// ---------------------------------------------------------------------------
|
|
95 |
// CSearchDataCache ::UnregisterExpiringItemL
|
|
96 |
// ---------------------------------------------------------------------------
|
|
97 |
//
|
|
98 |
void CSearchDataCache ::UnregisterExpiringItem( CXIMPSubscriptionItemBase* /*aExpireItem*/ )
|
|
99 |
{
|
|
100 |
|
|
101 |
}
|
|
102 |
// ---------------------------------------------------------------------------
|
|
103 |
// CSearchDataCache ::ItemLC
|
|
104 |
// ---------------------------------------------------------------------------
|
|
105 |
//
|
|
106 |
template< class Type >
|
|
107 |
Type& CSearchDataCache ::ItemLC( Type*& aItem )
|
|
108 |
{
|
|
109 |
if( !aItem )
|
|
110 |
{
|
|
111 |
aItem = Type::NewLC( *this );
|
|
112 |
}
|
|
113 |
else
|
|
114 |
{
|
|
115 |
User::LeaveIfError( aItem->Open() );
|
|
116 |
CleanupClosePushL( *aItem );
|
|
117 |
}
|
|
118 |
return *aItem;
|
|
119 |
}
|
|
120 |
// ---------------------------------------------------------------------------
|
|
121 |
// CSearchDataCache ::CleanResources
|
|
122 |
// ---------------------------------------------------------------------------
|
|
123 |
//
|
|
124 |
EXPORT_C void CSearchDataCache ::CleanResources( MXIMPPscContext& /*aContext*/ )
|
|
125 |
{
|
|
126 |
|
|
127 |
}
|
|
128 |
// ---------------------------------------------------------------------------
|
|
129 |
// CSearchDataCache ::CleanExpired
|
|
130 |
// ---------------------------------------------------------------------------
|
|
131 |
//
|
|
132 |
EXPORT_C void CSearchDataCache ::CleanExpired()
|
|
133 |
{
|
|
134 |
|
|
135 |
}
|
|
136 |
// ---------------------------------------------------------------------------
|
|
137 |
// CSearchDataCache ::RemoveMe
|
|
138 |
// ---------------------------------------------------------------------------
|
|
139 |
//
|
|
140 |
void CSearchDataCache ::RemoveMe( CSearchSubscriptionItem* aChild )
|
|
141 |
{
|
|
142 |
RemoveMe< CSearchSubscriptionItem >(
|
|
143 |
iSearchSubscriptionItem, aChild );
|
|
144 |
}
|
|
145 |
// ---------------------------------------------------------------------------
|
|
146 |
// CSearchDataCache ::CSearchSubscriptionItemLC
|
|
147 |
// ---------------------------------------------------------------------------
|
|
148 |
//
|
|
149 |
EXPORT_C CSearchSubscriptionItem& CSearchDataCache ::SearchSubscriptionItemLC()
|
|
150 |
{
|
|
151 |
return ItemLC< CSearchSubscriptionItem >( iSearchSubscriptionItem );
|
|
152 |
}
|
|
153 |
// ---------------------------------------------------------------------------
|
|
154 |
// CSearchDataCache ::RemoveMe
|
|
155 |
// ---------------------------------------------------------------------------
|
|
156 |
//
|
|
157 |
void CSearchDataCache ::RemoveMe( CSearchKeysSubscriptionItem* aChild )
|
|
158 |
{
|
|
159 |
RemoveMe< CSearchKeysSubscriptionItem >(
|
|
160 |
iSearchKeySubscriptionItem, aChild );
|
|
161 |
}
|
|
162 |
// ---------------------------------------------------------------------------
|
|
163 |
// CSearchDataCache ::CSearchKeysSubscriptionItemLC
|
|
164 |
// ---------------------------------------------------------------------------
|
|
165 |
//
|
|
166 |
EXPORT_C CSearchKeysSubscriptionItem& CSearchDataCache ::SearchKeysSubscriptionItemLC()
|
|
167 |
{
|
|
168 |
return ItemLC< CSearchKeysSubscriptionItem >( iSearchKeySubscriptionItem );
|
|
169 |
}
|
|
170 |
// ---------------------------------------------------------------------------
|
|
171 |
// CSearchDataCache ::GetInterface
|
|
172 |
// ---------------------------------------------------------------------------
|
|
173 |
//
|
|
174 |
TAny* CSearchDataCache ::GetInterface(TInt aInterfaceId)
|
|
175 |
{
|
|
176 |
if(aInterfaceId == SEARCH_ITEM_PARENT)
|
|
177 |
{
|
|
178 |
return static_cast<MSearchItemParent*>(this) ;
|
|
179 |
}
|
|
180 |
else
|
|
181 |
{
|
|
182 |
User::Panic( _L("CXIMPIMCache"), KErrExtensionNotSupported );
|
|
183 |
return NULL; // this line never gets executed :Just to remove warning
|
|
184 |
}
|
|
185 |
}
|
|
186 |
|
|
187 |
// End of file
|