|
1 /* |
|
2 * Copyright (c) 2003, 2004 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: Exif IFD wrapper class for handling the storage of the tags |
|
15 * and manipulating IFDs. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef EXIFIFD_H |
|
21 #define EXIFIFD_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "ExifRead.h" |
|
25 #include <e32base.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CExifTagImpl; |
|
29 |
|
30 /** |
|
31 * Exif IFD wrapper base class |
|
32 * Provides the base for the other IFD structures. |
|
33 * |
|
34 * @lib ExifLib |
|
35 * @since 2.6 |
|
36 */ |
|
37 NONSHARABLE_CLASS( CExifIfd ): public CBase |
|
38 { |
|
39 public: // Constructors and destructor |
|
40 |
|
41 /** |
|
42 * Two-phased constructor. |
|
43 */ |
|
44 static CExifIfd* NewBaseL( TExifIfdType aIfdType ); |
|
45 |
|
46 /** |
|
47 * Destructor. |
|
48 */ |
|
49 virtual ~CExifIfd(); |
|
50 |
|
51 public: // New functions |
|
52 |
|
53 /** |
|
54 * Checks if the IFD is in valid format, and contains all mandatory tags. |
|
55 * @since 2.6 |
|
56 * @return Boolean stating if the IFD is valid. |
|
57 */ |
|
58 virtual TBool IsValid() const; |
|
59 |
|
60 /** |
|
61 * Checks if specified tag exists in the IFD. |
|
62 * @since 2.6 |
|
63 * @param aTagId The queried tag ID |
|
64 * @return Boolean stating if the tag exists. |
|
65 */ |
|
66 TBool TagExists( TUint16 aTagId ) const; |
|
67 |
|
68 /** |
|
69 * Returns the size of the IFD structure in bytes. |
|
70 * @since 2.6 |
|
71 * @return Size of the IFD in bytes. |
|
72 */ |
|
73 TUint16 Size() const; |
|
74 |
|
75 /** |
|
76 * Sets the next IFD offset. |
|
77 * @since 2.6 |
|
78 * @param aIfdOffset Next IFD offset |
|
79 * @return void |
|
80 */ |
|
81 void SetNextIfdOffset( TUint32 aIfdOffset ); |
|
82 |
|
83 /** |
|
84 * Writes the tag data in the IFD structure to the location defined by |
|
85 * the given pointer and the offset. |
|
86 * @since 2.6 |
|
87 * @param aExifDataPtr Pointer to the Exif data |
|
88 * @param aPos Offset for the beginning of the IFD data. |
|
89 * @return void |
|
90 */ |
|
91 void WriteTagsL( TUint16*& aExifDataPtr, TUint& aPos ) const; |
|
92 |
|
93 /** |
|
94 * Inserts/Replaces the given tag in the IFD structure. |
|
95 * @since 2.6 |
|
96 * @param aExifTag Pointer to the tag instance updated. |
|
97 * @param aCheckValidity When ETrue then tag validity is checked |
|
98 * @return void |
|
99 */ |
|
100 virtual void InsertTagL( CExifTagImpl* aExifTag, TBool aCheckValidity ); |
|
101 |
|
102 /** |
|
103 * Removes the specified tag from the IFD structure |
|
104 * @since 2.6 |
|
105 * @param aTagId The target tag ID. |
|
106 * @return Error code. |
|
107 */ |
|
108 TInt DeleteTag( TUint16 aTagId ); |
|
109 |
|
110 /** |
|
111 * Gets the unmodifiable specified tag instance from the IFD structure. |
|
112 * @since 2.6 |
|
113 * @param aTagId The queried tag ID. |
|
114 * @return Constant pointer to the tag instance. |
|
115 */ |
|
116 const CExifTagImpl* GetTagL( TUint16 aTagId ) const; |
|
117 |
|
118 /** |
|
119 * Gets the IDs and amount of the tags existing in the IFD structure. |
|
120 * @since 2.6 |
|
121 * @param aNoTags Number of tag IDs returned. |
|
122 * @return Pointer to the tag IDs. |
|
123 */ |
|
124 TUint16* GetTagIdsL( TInt& aNoTags ) const; |
|
125 |
|
126 /** |
|
127 * Checks if the given tag ID is one of the IDs that can be stored in |
|
128 * the IFD structure. |
|
129 * @since 2.6 |
|
130 * @param aTagId The queried tag ID. |
|
131 * @return Boolean stating if the specified tag ID is valid for the IFD. |
|
132 */ |
|
133 TBool IsAcceptableTagId( TUint16 aTagId ) const; |
|
134 |
|
135 protected: // New functions |
|
136 |
|
137 /** |
|
138 * C++ default constructor. |
|
139 */ |
|
140 CExifIfd(); |
|
141 |
|
142 private: |
|
143 |
|
144 /** |
|
145 * By default Symbian 2nd phase constructor is private. |
|
146 */ |
|
147 void ConstructL(); |
|
148 |
|
149 protected: |
|
150 |
|
151 // The tag instances stored in the IFD. |
|
152 CArrayPtrSeg< CExifTagImpl > iTagArray; |
|
153 |
|
154 // Type of the IFD. |
|
155 TExifIfdType iIfdType; |
|
156 |
|
157 // Next IFD's offset. |
|
158 TUint32 iNextIfdOffset; |
|
159 |
|
160 // Size of the IFD data in bytes. |
|
161 TUint16 iSize; |
|
162 |
|
163 }; |
|
164 |
|
165 |
|
166 /** |
|
167 * Exif IFD0 wrapper class |
|
168 * |
|
169 * |
|
170 * @lib ExifLib |
|
171 * @since 2.6 |
|
172 */ |
|
173 NONSHARABLE_CLASS( CExifIfd0 ) : public CExifIfd |
|
174 { |
|
175 public: // Constructors and destructor |
|
176 |
|
177 /** |
|
178 * Two-phased constructor. |
|
179 */ |
|
180 static CExifIfd0* NewL(); |
|
181 |
|
182 /** |
|
183 * C++ default constructor. |
|
184 */ |
|
185 CExifIfd0(); |
|
186 |
|
187 /** |
|
188 * Destructor. |
|
189 */ |
|
190 virtual ~CExifIfd0(); |
|
191 |
|
192 public: // Functions from base classes |
|
193 |
|
194 /** |
|
195 * From CExifIfd Checks if the IFD is in valid format, and contains all |
|
196 * mandatory tags. |
|
197 * @since 2.6 |
|
198 * @return Boolean stating if the IFD is valid. |
|
199 */ |
|
200 TBool IsValid() const; |
|
201 |
|
202 private: |
|
203 |
|
204 /** |
|
205 * By default Symbian 2nd phase constructor is private. |
|
206 */ |
|
207 void ConstructL(); |
|
208 |
|
209 }; |
|
210 |
|
211 |
|
212 /** |
|
213 * Exif Exif-IFD wrapper class |
|
214 * |
|
215 * |
|
216 * @lib ExifLib |
|
217 * @since 2.6 |
|
218 */ |
|
219 NONSHARABLE_CLASS( CExifIfdExif ): public CExifIfd |
|
220 { |
|
221 public: |
|
222 |
|
223 /** |
|
224 * Two-phased constructor. |
|
225 */ |
|
226 static CExifIfdExif* NewL(); |
|
227 |
|
228 /** |
|
229 * C++ default constructor. |
|
230 */ |
|
231 CExifIfdExif(); |
|
232 |
|
233 /** |
|
234 * Destructor. |
|
235 */ |
|
236 virtual ~CExifIfdExif(); |
|
237 |
|
238 public: // Functions from base classes |
|
239 |
|
240 /** |
|
241 * From CExifIfd Checks if the IFD is in valid format, and contains all |
|
242 * mandatory tags. |
|
243 * @since 2.6 |
|
244 * @return Boolean stating if the IFD is valid. |
|
245 */ |
|
246 TBool IsValid() const; |
|
247 |
|
248 private: |
|
249 |
|
250 /** |
|
251 * By default Symbian 2nd phase constructor is private. |
|
252 */ |
|
253 void ConstructL(); |
|
254 }; |
|
255 |
|
256 |
|
257 /** |
|
258 * Exif IFD1 wrapper class |
|
259 * |
|
260 * |
|
261 * @lib ExifLib |
|
262 * @since 2.6 |
|
263 */ |
|
264 NONSHARABLE_CLASS( CExifIfd1 ): public CExifIfd |
|
265 { |
|
266 public: // Constructors and destructor |
|
267 |
|
268 /** |
|
269 * Two-phased constructor. |
|
270 */ |
|
271 static CExifIfd1* NewL(); |
|
272 |
|
273 /** |
|
274 * C++ default constructor. |
|
275 */ |
|
276 CExifIfd1(); |
|
277 |
|
278 /** |
|
279 * Destructor. |
|
280 */ |
|
281 virtual ~CExifIfd1(); |
|
282 |
|
283 public: // New functions |
|
284 |
|
285 /** |
|
286 * Inserts/Updates the given Exif thumbnail image. |
|
287 * @since 2.6 |
|
288 * @param aThumbnailData The Exif thumbnail image data that is updated |
|
289 * @return Error code. |
|
290 */ |
|
291 TInt SetThumbnailData( TDesC8* aThumbnailData ); |
|
292 |
|
293 /** |
|
294 * Gets the Exif thumbnail image. |
|
295 * @since 2.6 |
|
296 * @param aThumbnailData The Exif thumbnail image data returned. |
|
297 * @return Error code. |
|
298 */ |
|
299 TInt GetThumbnailData( TDesC8*& aThumbnailData ) const; |
|
300 |
|
301 /** |
|
302 * Removes the Exif thumbnail image. |
|
303 * @since 2.6 |
|
304 * @return Error code. |
|
305 */ |
|
306 TInt RemoveThumbnailData(); |
|
307 |
|
308 /** |
|
309 * Returns the size of the Exif thumbnail image in bytes. |
|
310 * @since 2.6 |
|
311 * @return Thumbnail image size |
|
312 */ |
|
313 TUint16 ThumbnailSize() const; |
|
314 |
|
315 /** |
|
316 * Writes the Exif thumbnail image to the location defined by the given |
|
317 * pointer and the offset. |
|
318 * @since 2.6 |
|
319 * @param aExifDataPtr Pointer to the Exif data. |
|
320 * @param aPos Offset for the beginning of the thumbnail image data. |
|
321 * @return Thumbnail image size |
|
322 */ |
|
323 void WriteThumbnailL( TUint8*& aExifDataPtr, TUint& aPos ) const; |
|
324 |
|
325 public: // Functions from base classes |
|
326 |
|
327 /** |
|
328 * From CExifIfd Checks if the IFD is in valid format, and contains all |
|
329 * mandatory tags. |
|
330 * @since 2.6 |
|
331 * @return Boolean stating if the IFD is valid. |
|
332 */ |
|
333 TBool IsValid() const; |
|
334 |
|
335 /** |
|
336 * From CExifIfd Inserts/Replaces the given tag in the IFD structure. |
|
337 * @since 2.6 |
|
338 * @param aExifTag Pointer to the tag instance updated. |
|
339 * @param aCheckValidity When ETrue then tag validity is checked |
|
340 * @return void |
|
341 */ |
|
342 void InsertTagL( CExifTagImpl* aExifTag, TBool aCheckValidity ); |
|
343 |
|
344 private: |
|
345 /** |
|
346 * By default Symbian 2nd phase constructor is private. |
|
347 */ |
|
348 void ConstructL(); |
|
349 |
|
350 private: |
|
351 |
|
352 // Pointer to the descriptor containing thumbnail image data. |
|
353 TDesC8* iThumbnailBuffer; |
|
354 }; |
|
355 |
|
356 |
|
357 /** |
|
358 * Exif Interoperability IFD wrapper class |
|
359 * |
|
360 * |
|
361 * @lib ExifLib |
|
362 * @since 2.6 |
|
363 */ |
|
364 NONSHARABLE_CLASS( CExifIfdIntOp ): public CExifIfd |
|
365 { |
|
366 public: |
|
367 |
|
368 /** |
|
369 * Two-phased constructor. |
|
370 */ |
|
371 static CExifIfdIntOp* NewL(); |
|
372 |
|
373 /** |
|
374 * C++ default constructor. |
|
375 */ |
|
376 CExifIfdIntOp(); |
|
377 |
|
378 /** |
|
379 * Destructor. |
|
380 */ |
|
381 virtual ~CExifIfdIntOp(); |
|
382 |
|
383 public: // Functions from base classes |
|
384 |
|
385 /** |
|
386 * From CExifIfd Checks if the IFD is in valid format, and contains all |
|
387 * mandatory tags. |
|
388 * @since 2.6 |
|
389 * @return Boolean stating if the IFD is valid. |
|
390 */ |
|
391 TBool IsValid() const; |
|
392 |
|
393 private: |
|
394 |
|
395 /** |
|
396 * By default Symbian 2nd phase constructor is private. |
|
397 */ |
|
398 void ConstructL(); |
|
399 }; |
|
400 |
|
401 |
|
402 /** |
|
403 * Exif Gps IFD wrapper class |
|
404 * |
|
405 * |
|
406 * @lib ExifLib |
|
407 * @since 2.6 |
|
408 */ |
|
409 |
|
410 NONSHARABLE_CLASS( CExifIfdGps ): public CExifIfd |
|
411 { |
|
412 public: |
|
413 |
|
414 /** |
|
415 * Two-phased constructor. |
|
416 */ |
|
417 static CExifIfdGps* NewL(); |
|
418 |
|
419 /** |
|
420 * C++ default constructor. |
|
421 */ |
|
422 CExifIfdGps(); |
|
423 |
|
424 /** |
|
425 * Destructor. |
|
426 */ |
|
427 virtual ~CExifIfdGps(); |
|
428 |
|
429 public: // Functions from base classes |
|
430 |
|
431 /** |
|
432 * From CExifIfd Checks if the IFD is in valid format, and contains all |
|
433 * mandatory tags. |
|
434 * @since 2.6 |
|
435 * @return Boolean stating if the IFD is valid. |
|
436 */ |
|
437 TBool IsValid() const; |
|
438 |
|
439 private: |
|
440 |
|
441 /** |
|
442 * By default Symbian 2nd phase constructor is private. |
|
443 */ |
|
444 void ConstructL(); |
|
445 }; |
|
446 |
|
447 #endif // EXIFIFD_H |
|
448 |
|
449 // End of File |