|
1 /* |
|
2 * Copyright (c) 2002-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: An ECOM class for store plugin implementations. |
|
15 * Store implementations derives from this class. |
|
16 * |
|
17 * Implementation set default data as: |
|
18 * default_data KVPbkStorePluginDataString |
|
19 * Implementation sets opaque data as the domain part of the URIs. |
|
20 * E.g. a plugin that implements contact model store uses: |
|
21 * opaque_data "cntdb" |
|
22 * |
|
23 */ |
|
24 |
|
25 |
|
26 |
|
27 #ifndef CVPBKCONTACTSTOREDOMAIN_H |
|
28 #define CVPBKCONTACTSTOREDOMAIN_H |
|
29 |
|
30 // INCLUDES |
|
31 #include <ecom/ecom.h> |
|
32 #include "MVPbkContactStoreList.h" |
|
33 #include "MVPbkContactOperationFactory.h" |
|
34 #include "MVPbkContactOperationFactory2.h" |
|
35 |
|
36 // FORWARD DECLARATIONS |
|
37 class TVPbkContactStoreUriPtr; |
|
38 class MVPbkContactStoreListObserver; |
|
39 class MVPbkContactStore; |
|
40 class MVPbkStoreContact; |
|
41 class MVPbkContactLink; |
|
42 class MVPbkFieldTypeList; |
|
43 class MVPbkContactOperation; |
|
44 class MVPbkSingleContactOperationObserver; |
|
45 class CVPbkContactStoreUriArray; |
|
46 |
|
47 /** |
|
48 * Virtual contact storage domain class. |
|
49 * Virtual Phonebook Store plugins must derive from this class, |
|
50 * so that ecom can instantiate the plugin component. A domain |
|
51 * can contains stores. |
|
52 */ |
|
53 class CVPbkContactStoreDomain : |
|
54 public CBase, |
|
55 public MVPbkContactStoreList, |
|
56 public MVPbkContactOperationFactory, |
|
57 public MVPbkContactOperationFactory2 |
|
58 { |
|
59 public: // Constructor and desctructor |
|
60 class TStoreDomainParam |
|
61 { |
|
62 public: |
|
63 TStoreDomainParam( const CVPbkContactStoreUriArray& aURIList, |
|
64 const TSecurityInfo& iSecurityInfo ); |
|
65 public: // data |
|
66 ///Ref: Contact store URI array |
|
67 const CVPbkContactStoreUriArray& iURIList; |
|
68 ///Ref: URI domain |
|
69 const TDesC* iURIDomain; |
|
70 ///Ref: master field type list |
|
71 const MVPbkFieldTypeList* iFieldTypeList; |
|
72 ///Own: Security information |
|
73 const TSecurityInfo& iSecurityInfo; |
|
74 ///Own: Spare for future extension |
|
75 TAny* iSpare; |
|
76 ///Own: Spare for future extension |
|
77 TAny* iSpare2; |
|
78 ///Own: Spare for future extension |
|
79 TAny* iSpare3; |
|
80 |
|
81 }; |
|
82 |
|
83 /** |
|
84 * ECom constructor. |
|
85 */ |
|
86 static CVPbkContactStoreDomain* NewL(TUid aUid, TStoreDomainParam aParam); |
|
87 |
|
88 ~CVPbkContactStoreDomain(); |
|
89 |
|
90 public: // Internal store API |
|
91 /** |
|
92 * Returns the URI domain. |
|
93 */ |
|
94 virtual const TDesC& UriDomain() const =0; |
|
95 |
|
96 /** |
|
97 * Loads a new contact store implementation to this domain. |
|
98 * If the contact store with given URI already exists, this function |
|
99 * does nothing. |
|
100 */ |
|
101 virtual void LoadContactStoreL(const TVPbkContactStoreUriPtr& aUri) =0; |
|
102 |
|
103 public: // From MVPbkContactStoreList |
|
104 TInt Count() const =0; |
|
105 MVPbkContactStore& At(TInt aIndex) const =0; |
|
106 MVPbkContactStore* Find(const TVPbkContactStoreUriPtr& aUri) const =0; |
|
107 void OpenAllL(MVPbkContactStoreListObserver& aObserver) =0; |
|
108 void CloseAll(MVPbkContactStoreListObserver& aObserver) =0; |
|
109 |
|
110 private: // data members |
|
111 /// Own: Destructor ID key |
|
112 TUid iDtorIDKey; |
|
113 }; |
|
114 |
|
115 |
|
116 // INLINE FUNCTIONS |
|
117 |
|
118 inline CVPbkContactStoreDomain::TStoreDomainParam::TStoreDomainParam( |
|
119 const CVPbkContactStoreUriArray& aURIList, const TSecurityInfo& aSecurityInfo ) : |
|
120 iURIList(aURIList), iSecurityInfo( aSecurityInfo ) |
|
121 { |
|
122 } |
|
123 |
|
124 inline CVPbkContactStoreDomain* CVPbkContactStoreDomain::NewL( |
|
125 TUid aUid, |
|
126 TStoreDomainParam aParam) |
|
127 { |
|
128 TAny* ptr = NULL; |
|
129 ptr = REComSession::CreateImplementationL |
|
130 (aUid, _FOFF(CVPbkContactStoreDomain, iDtorIDKey), |
|
131 static_cast<TAny*>(&aParam)); |
|
132 |
|
133 return reinterpret_cast<CVPbkContactStoreDomain*>(ptr); |
|
134 } |
|
135 |
|
136 inline CVPbkContactStoreDomain::~CVPbkContactStoreDomain() |
|
137 { |
|
138 REComSession::DestroyedImplementation(iDtorIDKey); |
|
139 } |
|
140 |
|
141 #endif // CVPBKCONTACTSTOREDOMAIN_H |
|
142 |
|
143 //End of file |