harvester/common/inc/harvesterexifutil.h
changeset 0 c53acadfccc6
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     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:  Common Exif-utilities for harvester
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef HARVESTEREXIFUTIL_H
       
    20 #define HARVESTEREXIFUTIL_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 #include <ExifRead.h>
       
    26 #include <ExifTag.h>
       
    27 #include <apmstd.h>
       
    28 #include "harvesterlog.h"
       
    29 #include "harvestdata.h"
       
    30 #include "mdeobject.h"
       
    31 #include "mdesession.h"
       
    32 
       
    33 class CExifModify;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 *  CHarvesterExifUtil
       
    39 * 
       
    40 */
       
    41 NONSHARABLE_CLASS( CHarvesterExifUtil ) : public CBase
       
    42 {
       
    43 public: // Constructors and destructor
       
    44 
       
    45 	/**
       
    46 		* Destructor.
       
    47 		*/
       
    48 	IMPORT_C ~CHarvesterExifUtil();
       
    49 
       
    50 		/**
       
    51 		* Two-phased constructor.
       
    52 		*/
       
    53 	IMPORT_C static CHarvesterExifUtil* NewL();
       
    54 
       
    55 		/**
       
    56 		* Two-phased constructor.
       
    57 		*/
       
    58 	IMPORT_C static CHarvesterExifUtil* NewLC();
       
    59 	
       
    60 
       
    61 	IMPORT_C void SetSession( CMdESession* aSession );
       
    62 		/**
       
    63 		* 
       
    64 		*/
       
    65 	IMPORT_C static TBool IsValidExifData(TPtr8 aData);
       
    66 
       
    67 	IMPORT_C static TInt ReadExifDataL( CHarvestData& aHd, CFileData& aFileData );
       
    68 	
       
    69 	IMPORT_C static TTime ConvertExifDateTimeToSymbianTimeL( const TDesC8& aDateTime );
       
    70 	
       
    71 	IMPORT_C TInt ComposeExifDataL( CMdEObject& aObject, TPtr8 aImagePtr, HBufC8*& aModified );
       
    72 
       
    73 	IMPORT_C void ComposeLocationL( CMdEObject* aLocation, TPtr8 aImagePtr, HBufC8*& aModified );
       
    74 	
       
    75 protected:
       
    76 	void SetExifDefaultsL( CMdEObject& aMdeObject, CExifModify& aExifModify );
       
    77 	void AddPropertyL( CMdEObjectDef& aObjectDef, CMdEObject& aMdeObject,
       
    78 			const TDesC& aProperty, TUint32 aValue );
       
    79 	void AddPropertyL( CMdEObjectDef& aObjectDef, CMdEObject& aMdeObject,
       
    80 			const TDesC& aProperty, TUint16 aValue );
       
    81 	TBool ModifyExifTagL( CMdEObject& aMdeObject, CExifModify& aExifModify,
       
    82 			const TDesC& aProperty, TExifIfdType aIFD, TUint16 aTagID, TBool aRemove = EFalse );
       
    83 	HBufC8* GetPropertyValueLC( const CMdEPropertyDef& aPropDef,
       
    84 			const CMdEProperty& aProperty );
       
    85 	CExifTag::TExifTagDataType ExifTagDataType( TUint16 aTagID, const CMdEPropertyDef& aPropDef );
       
    86 	
       
    87 	TBool CompareTag( TPtrC8 aMdeData, const CExifTag* aTag );
       
    88 	
       
    89 	static HBufC16* ReadExifTagL( const CExifRead& aReader, TExifIfdType aIFD, TUint16 aTagID );
       
    90 
       
    91 	static void StripNulls( HBufC& aString );
       
    92 
       
    93 private:
       
    94 
       
    95 	/**
       
    96 		* Constructor for performing 1st stage construction
       
    97 		*/
       
    98 	CHarvesterExifUtil();
       
    99 
       
   100 	/**
       
   101 		* default constructor for performing 2nd stage construction
       
   102 		*/
       
   103 	void ConstructL();
       
   104 	
       
   105 	static void ReadUserCommentL( CHarvestData& aHd, CExifRead* aReader );
       
   106 	
       
   107 	static void ReadXResolutionL( CHarvestData& aHd, CExifRead* aReader );
       
   108 	
       
   109 	static void ReadYResolutionL( CHarvestData& aHd, CExifRead* aReader );
       
   110 	
       
   111 	static void ReadExposureBiasL( CHarvestData& aHd, CExifRead* aReader );
       
   112 	
       
   113 	static void ReadExposureTimeL( CHarvestData& aHd, CExifRead* aReader );
       
   114 	
       
   115 	static void ReadFNumberL( CHarvestData& aHd, CExifRead* aReader );
       
   116 	
       
   117 	static void ReadShutterSpeedL( CHarvestData& aHd, CExifRead* aReader );
       
   118 	
       
   119 	static void ReadApertureValueL( CHarvestData& aHd, CExifRead* aReader );
       
   120 	
       
   121 	static void ReadFocalLengthL( CHarvestData& aHd, CExifRead* aReader );
       
   122 	
       
   123 	static void ReadFocalLength35mmL( CHarvestData& aHd, CExifRead* aReader );
       
   124 	
       
   125 	static void ReadFocalXPlaneResolutionL( CHarvestData& aHd, CExifRead* aReader );
       
   126 	
       
   127 	static void ReadFocalYPlaneResolutionL( CHarvestData& aHd, CExifRead* aReader );
       
   128 	
       
   129 	static void ReadGPSLatitudeL( CHarvestData& aHd, CExifRead* aReader, TBool& aLatitude );
       
   130 	
       
   131 	static void ReadGPSLongitudeL( CHarvestData& aHd, CExifRead* aReader, TBool& aLatitude );
       
   132 	
       
   133 	static void ReadGPSAltitudeL( CHarvestData& aHd, CExifRead* aReader );
       
   134 	
       
   135 private:
       
   136 	
       
   137 	/** Pointer to mde session to use */
       
   138     CMdESession* iSession;
       
   139     
       
   140     /** Mde default namespace. NOT OWN. */
       
   141     CMdENamespaceDef* iDefaultNamespace;
       
   142     
       
   143     
       
   144 
       
   145 };
       
   146 
       
   147 #endif // HARVESTEREXIFUTIL_H
       
   148