|
1 /* |
|
2 * Copyright (c) 2007-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: Harvester image plugin data transfer objects |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 // --------------------------------------------------------------------------- |
|
23 // Constructor for CLocationData. |
|
24 // --------------------------------------------------------------------------- |
|
25 // |
|
26 CLocationData::CLocationData( TReal64 aGpsLatitude, TReal64 aGpsLongitude, |
|
27 TReal64 aGpsAltitude, TBool aGpsLaLExists, TBool aGpsAExists ) |
|
28 : iGpsLatitude(aGpsLatitude), iGpsLongitude(aGpsLongitude), iGpsAltitude(aGpsAltitude) |
|
29 , iGpsLatAndLongExists(aGpsLaLExists), iGpsAltitudeExists(aGpsAExists) |
|
30 { |
|
31 // initializers are enough |
|
32 } |
|
33 |
|
34 // --------------------------------------------------------------------------- |
|
35 // NewL |
|
36 // --------------------------------------------------------------------------- |
|
37 // |
|
38 CLocationData* CLocationData::NewL( TReal64 aGpsLatitude, TReal64 aGpsLongitude, |
|
39 TReal64 aGpsAltitude, TBool aGpsLaLExists, TBool aGpsAExists ) |
|
40 { |
|
41 CLocationData* self = new (ELeave) CLocationData( aGpsLatitude, |
|
42 aGpsLongitude, aGpsAltitude, aGpsLaLExists, aGpsAExists ); |
|
43 return self; |
|
44 } |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // Constructor |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 CObjectDataArray::CObjectDataArray() |
|
51 { |
|
52 // no implementation required |
|
53 } |
|
54 |
|
55 // --------------------------------------------------------------------------- |
|
56 // Destructor for CObjectDataArray. |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 CObjectDataArray::~CObjectDataArray() |
|
60 { |
|
61 ResetAndDestroy(); |
|
62 Close(); |
|
63 } |
|
64 |
|
65 // CObjectDataArray |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // NewL |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 CObjectDataArray* CObjectDataArray::NewL() |
|
72 { |
|
73 CObjectDataArray* self = new (ELeave) CObjectDataArray(); |
|
74 return self; |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // Appends a new entry to a CObjectDataArray. |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 void CObjectDataArray::Append( CMdEObject* aMdeObject, CLocationData* aLocationData, CMdEQuery* aQuery ) |
|
82 { |
|
83 iMdeObjectArray.Append( aMdeObject ); |
|
84 iLocationArray.Append( aLocationData ); |
|
85 iQueryArray.Append( aQuery ); |
|
86 } |
|
87 |
|
88 // --------------------------------------------------------------------------- |
|
89 // Removes an entry from the array. |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 void CObjectDataArray::Remove( TInt aIndex ) |
|
93 { |
|
94 if ( aIndex < 0 || aIndex >= iMdeObjectArray.Count() ) |
|
95 { |
|
96 return; |
|
97 } |
|
98 delete iMdeObjectArray[aIndex]; |
|
99 delete iLocationArray[aIndex]; |
|
100 delete iQueryArray[aIndex]; |
|
101 iMdeObjectArray.Remove( aIndex ); |
|
102 iLocationArray.Remove( aIndex ); |
|
103 iQueryArray.Remove( aIndex ); |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // Returns the count of objects in the array. |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
|
110 TInt CObjectDataArray::Count() |
|
111 { |
|
112 return iMdeObjectArray.Count(); |
|
113 } |
|
114 |
|
115 // --------------------------------------------------------------------------- |
|
116 // ResetAndDestroy() |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 void CObjectDataArray::ResetAndDestroy() |
|
120 { |
|
121 iMdeObjectArray.ResetAndDestroy(); |
|
122 iLocationArray.ResetAndDestroy(); |
|
123 iQueryArray.ResetAndDestroy(); |
|
124 } |
|
125 |
|
126 // --------------------------------------------------------------------------- |
|
127 // Close() |
|
128 // --------------------------------------------------------------------------- |
|
129 // |
|
130 void CObjectDataArray::Close() |
|
131 { |
|
132 iMdeObjectArray.Close(); |
|
133 iLocationArray.Close(); |
|
134 iQueryArray.Close(); |
|
135 } |
|
136 |
|
137 // --------------------------------------------------------------------------- |
|
138 // ObjectL() |
|
139 // --------------------------------------------------------------------------- |
|
140 // |
|
141 CMdEObject* CObjectDataArray::ObjectL( const TInt aIndex ) |
|
142 { |
|
143 if ( aIndex < 0 || aIndex >= iMdeObjectArray.Count() ) |
|
144 { |
|
145 User::Leave( KErrArgument ); |
|
146 } |
|
147 return iMdeObjectArray[aIndex]; |
|
148 } |
|
149 |
|
150 // --------------------------------------------------------------------------- |
|
151 // LocationDataL |
|
152 // --------------------------------------------------------------------------- |
|
153 // |
|
154 CLocationData* CObjectDataArray::LocationDataL( const TInt aIndex ) |
|
155 { |
|
156 if ( aIndex < 0 || aIndex >= iLocationArray.Count() ) |
|
157 { |
|
158 User::Leave( KErrArgument ); |
|
159 } |
|
160 return iLocationArray[aIndex]; |
|
161 } |
|
162 |
|
163 // --------------------------------------------------------------------------- |
|
164 // QueryL |
|
165 // --------------------------------------------------------------------------- |
|
166 // |
|
167 CMdEQuery* CObjectDataArray::QueryL( const TInt aIndex ) |
|
168 { |
|
169 if ( aIndex < 0 || aIndex >= iQueryArray.Count() ) |
|
170 { |
|
171 User::Leave( KErrArgument ); |
|
172 } |
|
173 return iQueryArray[aIndex]; |
|
174 } |
|
175 |
|
176 // --------------------------------------------------------------------------- |
|
177 // SetQuery |
|
178 // --------------------------------------------------------------------------- |
|
179 // |
|
180 void CObjectDataArray::SetQuery( const TInt aIndex, CMdEQuery* aQuery ) |
|
181 { |
|
182 if ( aIndex < 0 || aIndex >= iQueryArray.Count() ) |
|
183 { |
|
184 return; |
|
185 } |
|
186 iQueryArray[aIndex] = aQuery; |
|
187 } |
|
188 |
|
189 // --------------------------------------------------------------------------- |
|
190 // MdeObjectArray |
|
191 // --------------------------------------------------------------------------- |
|
192 // |
|
193 RPointerArray<CMdEObject>& CObjectDataArray::MdeObjectArray() |
|
194 { |
|
195 return iMdeObjectArray; |
|
196 } |
|
197 |
|
198 |
|
199 // CFileData |
|
200 |
|
201 // --------------------------------------------------------------------------- |
|
202 // NewL |
|
203 // --------------------------------------------------------------------------- |
|
204 // |
|
205 CFileData* CFileData::NewL() |
|
206 { |
|
207 CFileData* self = new (ELeave) CFileData; |
|
208 return self; |
|
209 } |
|
210 |
|
211 // --------------------------------------------------------------------------- |
|
212 // Constructor |
|
213 // --------------------------------------------------------------------------- |
|
214 // |
|
215 CFileData::CFileData() |
|
216 { |
|
217 // no implementation needed |
|
218 } |
|
219 |
|
220 // --------------------------------------------------------------------------- |
|
221 // Destructor |
|
222 // --------------------------------------------------------------------------- |
|
223 // |
|
224 CFileData::~CFileData() |
|
225 { |
|
226 if ( iImageData ) |
|
227 { |
|
228 delete iImageData; |
|
229 iImageData = NULL; |
|
230 } |
|
231 iImageDef = NULL; |
|
232 iUri = NULL; |
|
233 } |
|
234 |
|
235 |
|
236 // CHarvestData |
|
237 |
|
238 // --------------------------------------------------------------------------- |
|
239 // NewL |
|
240 // --------------------------------------------------------------------------- |
|
241 // |
|
242 CHarvestData* CHarvestData::NewL() |
|
243 { |
|
244 CHarvestData* self = new (ELeave) CHarvestData; |
|
245 return self; |
|
246 } |
|
247 |
|
248 // --------------------------------------------------------------------------- |
|
249 // Constructor |
|
250 // --------------------------------------------------------------------------- |
|
251 // |
|
252 CHarvestData::CHarvestData() |
|
253 { |
|
254 // no implementation needed |
|
255 } |
|
256 |
|
257 // --------------------------------------------------------------------------- |
|
258 // Destructor |
|
259 // --------------------------------------------------------------------------- |
|
260 // |
|
261 CHarvestData::~CHarvestData() |
|
262 { |
|
263 if ( iDescription16 ) |
|
264 { |
|
265 delete iDescription16; |
|
266 iDescription16 = NULL; |
|
267 } |
|
268 |
|
269 if ( iComment16 ) |
|
270 { |
|
271 delete iComment16; |
|
272 iComment16 = NULL; |
|
273 } |
|
274 |
|
275 if ( iCopyright16 ) |
|
276 { |
|
277 delete iCopyright16; |
|
278 iCopyright16 = NULL; |
|
279 } |
|
280 |
|
281 if ( iDateModified8 ) |
|
282 { |
|
283 delete iDateModified8; |
|
284 iDateModified8 = NULL; |
|
285 } |
|
286 |
|
287 if ( iDateOriginal8 ) |
|
288 { |
|
289 delete iDateOriginal8; |
|
290 iDateOriginal8 = NULL; |
|
291 } |
|
292 |
|
293 if ( iDateDigitized8 ) |
|
294 { |
|
295 delete iDateDigitized8; |
|
296 iDateDigitized8 = NULL; |
|
297 } |
|
298 |
|
299 if ( iMake ) |
|
300 { |
|
301 delete iMake; |
|
302 iMake = NULL; |
|
303 } |
|
304 |
|
305 if ( iModel ) |
|
306 { |
|
307 delete iModel; |
|
308 iModel = NULL; |
|
309 } |
|
310 |
|
311 if ( iArtist ) |
|
312 { |
|
313 delete iArtist; |
|
314 iArtist = NULL; |
|
315 } |
|
316 |
|
317 if ( iRelatedSoundFile ) |
|
318 { |
|
319 delete iRelatedSoundFile; |
|
320 iRelatedSoundFile = NULL; |
|
321 } |
|
322 } |
|
323 |