|
1 /* |
|
2 * Copyright (c) 2005-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 interface for the virtual phonebook copy policies. |
|
15 * Stores have different demands on copying, like field type |
|
16 * mapping and other restrictions. |
|
17 * |
|
18 * Implementation sets default data like this: |
|
19 * default_data KVPbkCopyPolicyDataString; |
|
20 * Implemenation sets opaque data as the domain part of the URIs |
|
21 it wants to handle e.g for contact model stores: |
|
22 * opaque_data "cntdb"; |
|
23 * |
|
24 */ |
|
25 |
|
26 |
|
27 #ifndef CVPBKCONTACTCOPYPOLICY_H |
|
28 #define CVPBKCONTACTCOPYPOLICY_H |
|
29 |
|
30 // INCLUDES |
|
31 #include <e32std.h> |
|
32 #include <ecom/ecom.h> |
|
33 #include <MVPbkContactCopyPolicy.h> |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 class CVPbkContactManager; |
|
37 class MVPbkContactStore; |
|
38 |
|
39 |
|
40 /** |
|
41 * Virtual Phonebook contact copy policy. |
|
42 */ |
|
43 class CVPbkContactCopyPolicy : public CBase, |
|
44 public MVPbkContactCopyPolicy |
|
45 { |
|
46 public: // Types |
|
47 struct TParam |
|
48 { |
|
49 /** |
|
50 * @param aContactManager A contact manager that has an open |
|
51 * target store for the copy. |
|
52 */ |
|
53 inline TParam( CVPbkContactManager& aContactManager ); |
|
54 |
|
55 ///Ref: A contact manager containing a list of available field types. |
|
56 CVPbkContactManager& iContactManager; |
|
57 ///Own: Reserve for future extension |
|
58 TAny* iSpare; |
|
59 }; |
|
60 |
|
61 public: // Constructors and destructor |
|
62 /** |
|
63 * Two-phased constructor. |
|
64 * |
|
65 * @param aUid the implementation UID of the policy |
|
66 * @param aParam parameters for the copy policy |
|
67 * @return A new instance of this class |
|
68 */ |
|
69 static CVPbkContactCopyPolicy* NewL( TUid aImplementationUid, |
|
70 TParam& aParam); |
|
71 |
|
72 /** |
|
73 * Destructor. |
|
74 */ |
|
75 ~CVPbkContactCopyPolicy(); |
|
76 |
|
77 /** |
|
78 * Returns the implementation UID of the policy. |
|
79 * @return The implementation UID of the policy. |
|
80 */ |
|
81 TUid ImplementationUid() const; |
|
82 |
|
83 private: |
|
84 ///Own: Destructor ID key |
|
85 TUid iDtorIDKey; |
|
86 ///Own: implemenation uid |
|
87 TUid iImplementationUid; |
|
88 }; |
|
89 |
|
90 |
|
91 //INLINE FUNCTIONS |
|
92 |
|
93 inline CVPbkContactCopyPolicy::TParam::TParam( |
|
94 CVPbkContactManager& aContactManager) |
|
95 : iContactManager(aContactManager) |
|
96 { |
|
97 } |
|
98 |
|
99 inline CVPbkContactCopyPolicy* CVPbkContactCopyPolicy::NewL( |
|
100 TUid aImplementationUid, TParam& aParam) |
|
101 { |
|
102 TAny* ptr = NULL; |
|
103 ptr = REComSession::CreateImplementationL( |
|
104 aImplementationUid, |
|
105 _FOFF(CVPbkContactCopyPolicy, iDtorIDKey), |
|
106 &aParam); |
|
107 CVPbkContactCopyPolicy* self = |
|
108 reinterpret_cast<CVPbkContactCopyPolicy*>(ptr); |
|
109 if (self) |
|
110 { |
|
111 self->iImplementationUid = aImplementationUid; |
|
112 } |
|
113 return self; |
|
114 } |
|
115 |
|
116 inline CVPbkContactCopyPolicy::~CVPbkContactCopyPolicy() |
|
117 { |
|
118 REComSession::DestroyedImplementation(iDtorIDKey); |
|
119 } |
|
120 |
|
121 inline TUid CVPbkContactCopyPolicy::ImplementationUid() const |
|
122 { |
|
123 return iImplementationUid; |
|
124 } |
|
125 |
|
126 #endif // CVPBKCONTACTCOPYPOLICY_H |
|
127 |
|
128 //End of file |