|
1 /* |
|
2 * Copyright (c) 2002-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CCLFITEMIMPL_H |
|
21 #define CCLFITEMIMPL_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <MCLFModifiableItem.h> |
|
25 #include <e32base.h> |
|
26 #include <e32hashtab.h> |
|
27 #include <mdesession.h> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CMdEObject; |
|
31 class CCLFContainerItem; |
|
32 class CCLFDbItemContainer; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * This class implements MCLFModifiableItem interface. |
|
38 * |
|
39 * @lib ContentListingFramework.lib |
|
40 * @since Series 60 3.0 |
|
41 */ |
|
42 NONSHARABLE_CLASS( CCLFItemImpl ) : public CBase, |
|
43 public MCLFItem |
|
44 { |
|
45 public: // Constructors and destructor |
|
46 |
|
47 /** |
|
48 * Two-phased constructor. |
|
49 */ |
|
50 static CCLFItemImpl* NewLC( CCLFContainerItem& aContainerItem, |
|
51 CCLFDbItemContainer& aDbItemContainer ); |
|
52 |
|
53 /** |
|
54 * Two-phased constructor. |
|
55 */ |
|
56 static CCLFItemImpl* NewL( CCLFContainerItem& aContainerItem, |
|
57 CCLFDbItemContainer& aDbItemContainer ); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 virtual ~CCLFItemImpl(); |
|
63 |
|
64 protected: // Functions from base classes |
|
65 |
|
66 /** |
|
67 * From MCLFItem |
|
68 */ |
|
69 virtual TCLFItemId ItemId() const; |
|
70 |
|
71 /** |
|
72 * From MCLFItem |
|
73 */ |
|
74 virtual TCLFItemDataType DataType( TCLFFieldId aFieldId ) const; |
|
75 |
|
76 /** |
|
77 * From MCLFItem |
|
78 */ |
|
79 virtual TInt GetField( TCLFFieldId aFieldId, TPtrC& aData ) const; |
|
80 |
|
81 /** |
|
82 * From MCLFItem |
|
83 */ |
|
84 virtual TInt GetField( TCLFFieldId aFieldId, TInt32& aData ) const; |
|
85 |
|
86 /** |
|
87 * From MCLFItem |
|
88 */ |
|
89 virtual TInt GetField( TCLFFieldId aFieldId, TTime& aData ) const; |
|
90 |
|
91 private: |
|
92 |
|
93 TBool DeduceFieldFromURI( const TCLFFieldId aFieldId, TPtrC& aValue ) const; |
|
94 |
|
95 /** |
|
96 * Map MdE object definition to CLF media type. |
|
97 * @param aObjectDef Object definition |
|
98 * @param aValue Media type |
|
99 * @return KErrNone if media type was identified. |
|
100 * KErrNotFound if media type was unknown. |
|
101 */ |
|
102 TInt GetMediaTypeL( CMdEObjectDef& aObjectDef, TInt32& aValue ) const; |
|
103 |
|
104 void DetermineIfMusicL( CMdEObjectDef& aObjectDef, TInt32& aValue ) const; |
|
105 |
|
106 |
|
107 /** |
|
108 * Map CLF field to MdE property. |
|
109 * @param aField Field ID. |
|
110 * @return Property name |
|
111 */ |
|
112 static const TDesC& MapFieldToMdEProperty( TCLFFieldId aField ); |
|
113 |
|
114 /** |
|
115 * C++ default constructor. |
|
116 */ |
|
117 CCLFItemImpl( CCLFContainerItem& aContainerItem, |
|
118 CCLFDbItemContainer& aDbItemContainer ); |
|
119 |
|
120 private: // Data |
|
121 |
|
122 // Ref |
|
123 CCLFContainerItem& iItem; |
|
124 // Ref |
|
125 const CMdEObject& iMdEObject; |
|
126 // Ref |
|
127 CCLFDbItemContainer& iDbItemContainer; |
|
128 }; |
|
129 |
|
130 // CLASS DECLARATION |
|
131 |
|
132 /** |
|
133 * This class implements MCLFModifiableItem interface. |
|
134 * |
|
135 * @lib N/A |
|
136 * @since Series 60 3.0 |
|
137 */ |
|
138 NONSHARABLE_CLASS( CCLFModifiableItemImpl ) : public CBase, |
|
139 public MCLFModifiableItem |
|
140 { |
|
141 public: // Constructors and destructor |
|
142 |
|
143 /** |
|
144 * Two-phased constructor. |
|
145 */ |
|
146 static CCLFModifiableItemImpl* NewL(); |
|
147 |
|
148 /** |
|
149 * Destructor. |
|
150 */ |
|
151 virtual ~CCLFModifiableItemImpl(); |
|
152 |
|
153 protected: // Functions from base classes |
|
154 |
|
155 /** |
|
156 * From MCLFModifiableItem |
|
157 */ |
|
158 virtual TCLFItemId ItemId() const; |
|
159 |
|
160 /** |
|
161 * From MCLFModifiableItem |
|
162 */ |
|
163 virtual TCLFItemDataType DataType( TCLFFieldId aFieldId ) const; |
|
164 |
|
165 /** |
|
166 * From MCLFModifiableItem |
|
167 */ |
|
168 virtual TInt GetField( TCLFFieldId aFieldId, TPtrC& aData ) const; |
|
169 |
|
170 /** |
|
171 * From MCLFModifiableItem |
|
172 */ |
|
173 virtual TInt GetField( TCLFFieldId aFieldId, TInt32& aData ) const; |
|
174 |
|
175 /** |
|
176 * From MCLFModifiableItem |
|
177 */ |
|
178 virtual TInt GetField( TCLFFieldId aFieldId, TTime& aData ) const; |
|
179 |
|
180 /** |
|
181 * From MCLFModifiableItem |
|
182 */ |
|
183 virtual void AddFieldL( TCLFFieldId aFieldID, const TDesC& aValue ); |
|
184 |
|
185 /** |
|
186 * From MCLFModifiableItem |
|
187 */ |
|
188 virtual void AddFieldL( TCLFFieldId aFieldID, TInt32 aValue ); |
|
189 |
|
190 /** |
|
191 * From MCLFModifiableItem |
|
192 */ |
|
193 virtual void AddFieldL( TCLFFieldId aFieldID, const TTime& aValue ); |
|
194 |
|
195 private: |
|
196 |
|
197 /** |
|
198 * C++ default constructor. |
|
199 */ |
|
200 inline CCLFModifiableItemImpl(); |
|
201 |
|
202 private: // Data |
|
203 |
|
204 RHashMap<TCLFFieldId, TInt32> iIntMap; |
|
205 RHashMap<TCLFFieldId, HBufC*> iTextMap; |
|
206 RHashMap<TCLFFieldId, TInt64> iTimeMap; |
|
207 |
|
208 }; |
|
209 |
|
210 #endif // CCLFITEMIMPL_H |
|
211 |
|
212 // End of File |