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: IM data cache implementation.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef CIMDATACACHEIMP_H
|
|
19 |
#define CIMDATACACHEIMP_H
|
|
20 |
|
|
21 |
#include "ximpapiobjbase.h"
|
|
22 |
#include "imapiobjbase.h"
|
|
23 |
//#include "ximpitemparent.h"
|
|
24 |
#include "ximpimitemparent.h"
|
|
25 |
#include "imtypehelpers.h"
|
|
26 |
//#include "ximpoperationdefs.h"
|
|
27 |
#include "ximpapieventbase.h"
|
|
28 |
|
|
29 |
class MXIMPHost;
|
|
30 |
class CConversationSubscriptionItem;
|
|
31 |
class CXIMPIdentityImp;
|
|
32 |
class MXIMPPscContext;
|
|
33 |
class CXIMPIMSubscriptionItemBase;
|
|
34 |
class MXIMPStatus;
|
|
35 |
class MXIMPIdentity;
|
|
36 |
class MXIMPDataSubscriptionState;
|
|
37 |
class CXIMPDataSubscriptionStateImp;
|
|
38 |
|
|
39 |
|
|
40 |
/**
|
|
41 |
* PSC Im Data Cache implementation.
|
|
42 |
*
|
|
43 |
* @since S60 v3.2
|
|
44 |
*/
|
|
45 |
class CImDataCache : public CBase,
|
|
46 |
public MXIMPIMItemParent
|
|
47 |
{
|
|
48 |
public: // Definitions
|
|
49 |
|
|
50 |
/** The class ID. */
|
|
51 |
enum { KClassId = IMIMP_CLSID_CIMDATACACHE };
|
|
52 |
|
|
53 |
|
|
54 |
public: // Construction and destruction
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Construction
|
|
58 |
*/
|
|
59 |
IMPORT_C static CImDataCache* NewL( MXIMPHost& aHost );
|
|
60 |
|
|
61 |
/**
|
|
62 |
* Destruction
|
|
63 |
*/
|
|
64 |
virtual ~CImDataCache();
|
|
65 |
|
|
66 |
private:
|
|
67 |
|
|
68 |
CImDataCache( MXIMPHost& aHost );
|
|
69 |
void ConstructL();
|
|
70 |
|
|
71 |
private: // MXIMPIMItemParentBase
|
|
72 |
|
|
73 |
TAny* GetInterface(TInt aInterfaceId);
|
|
74 |
// Expiring items
|
|
75 |
void RegisterExpiringItemL( CXIMPSubscriptionItemBase* aExpireItem );
|
|
76 |
void UnregisterExpiringItem( CXIMPSubscriptionItemBase* aExpireItem );
|
|
77 |
|
|
78 |
private: // From MXIMPIMItemParent
|
|
79 |
|
|
80 |
/**
|
|
81 |
* @see MXIMPIMItemParent
|
|
82 |
*/
|
|
83 |
void RemoveMe( CConversationSubscriptionItem* aChild );
|
|
84 |
|
|
85 |
// Other methods
|
|
86 |
void AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext );
|
|
87 |
|
|
88 |
public: // New methods
|
|
89 |
|
|
90 |
/**
|
|
91 |
* - If CConversationSubscriptionItem is not found, data cache
|
|
92 |
* initializes new one and returns ownership to caller
|
|
93 |
* - If CConversationSubscriptionItem is found, data cache increases
|
|
94 |
* refcount by one, and returns the old object
|
|
95 |
*/
|
|
96 |
IMPORT_C CConversationSubscriptionItem& ConversationSubscriptionItemLC();
|
|
97 |
/**
|
|
98 |
* Clean resources concerning context.
|
|
99 |
*/
|
|
100 |
IMPORT_C void CleanResources( MXIMPPscContext& aContext );
|
|
101 |
|
|
102 |
/**
|
|
103 |
*
|
|
104 |
*/
|
|
105 |
IMPORT_C void CleanExpired();
|
|
106 |
|
|
107 |
private: // Helper methods
|
|
108 |
|
|
109 |
/**
|
|
110 |
* Template method for removeMe when one subscription item is target.
|
|
111 |
* @param aItem Reference to subscription item pointer to remove.
|
|
112 |
* @param Pointer of item to remove.
|
|
113 |
*/
|
|
114 |
template< class Type >
|
|
115 |
IMPORT_C static void RemoveMe( Type*& aItem, Type* aChild );
|
|
116 |
|
|
117 |
|
|
118 |
/**
|
|
119 |
* Templated item instance creation. If item is not found it is created.
|
|
120 |
* @param aItem Reference to pointer where new item should be saved.
|
|
121 |
* @return Reference to item created.
|
|
122 |
*/
|
|
123 |
template< class Type >
|
|
124 |
Type& ItemLC( Type*& aItem );
|
|
125 |
|
|
126 |
|
|
127 |
|
|
128 |
private: // Data
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Access to host.
|
|
132 |
*/
|
|
133 |
MXIMPHost& iHost;
|
|
134 |
|
|
135 |
/**
|
|
136 |
* Does not own. Removed when RemoveMe called.
|
|
137 |
*/
|
|
138 |
CConversationSubscriptionItem* iConversationSubscriptionItem;
|
|
139 |
|
|
140 |
};
|
|
141 |
|
|
142 |
#endif // CIMDATACACHEIMP_H
|