harvester/common/inc/harvestdata.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:  Harvester image plugin data transfer objects
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef HARVESTDATA_H
       
    21 #define HARVESTDATA_H
       
    22 
       
    23 #include "mdeobject.h"
       
    24 #include "mdequery.h"
       
    25 #include "f32file.h"
       
    26 
       
    27 
       
    28 /**
       
    29 * Class used to store gps location data to an array.
       
    30 * A data transfer object.
       
    31 */
       
    32 class CLocationData : public CBase
       
    33     {
       
    34     public:
       
    35         /** Standard NewL */
       
    36         inline static CLocationData* NewL( TReal64 aGpsLatitude, TReal64 aGpsLongitude,
       
    37             TReal64 aGpsAltitude, TBool aGpsLaLExists, TBool aGpsAExists );
       
    38         
       
    39     private:
       
    40         /** Constructor. */
       
    41         inline CLocationData( TReal64 aGpsLatitude, TReal64 aGpsLongitude,
       
    42             TReal64 aGpsAltitude, TBool aGpsLaLExists, TBool aGpsAExists );
       
    43 
       
    44     public:
       
    45 
       
    46         /** GPS latitude */
       
    47         TReal64 iGpsLatitude;
       
    48 
       
    49         /** GPS longitude */
       
    50         TReal64 iGpsLongitude;
       
    51 
       
    52         /** GPS altitude */
       
    53         TReal64 iGpsAltitude;
       
    54 
       
    55         /** GPS latitude and longitude exists */
       
    56         TBool   iGpsLatAndLongExists;
       
    57 
       
    58         /** GPS altitude exists */
       
    59         TBool   iGpsAltitudeExists;
       
    60     };
       
    61 
       
    62 /**
       
    63 * This class is used to match corresponding mde object and location data (if any) with two arrays.
       
    64 * Arrays are (and must be) always be of same size.
       
    65 */
       
    66 class CObjectDataArray : public CBase
       
    67     {
       
    68     public:
       
    69 
       
    70         /** Standard NewL */
       
    71         inline static CObjectDataArray* NewL();
       
    72         
       
    73         /**
       
    74         * Virtual destructor.
       
    75         */
       
    76         inline virtual ~CObjectDataArray();
       
    77         
       
    78         /**
       
    79         * Appends a new entry to the array.
       
    80         * @param aMdeObject  A mde object pointer
       
    81         * @param aLocationData  Related location data
       
    82         * @param aQuery  Location query pointer for prepared queries
       
    83         */
       
    84         inline void Append( CMdEObject* aMdeObject,
       
    85         		CLocationData* aLocationData, CMdEQuery* aQuery = NULL );
       
    86 
       
    87         /**
       
    88         * Removes an entry from the array.
       
    89         */
       
    90         inline void Remove( TInt aIndex );
       
    91 
       
    92         /**
       
    93         * Returns how many entries there are in the array.
       
    94         * @return Count on entries.
       
    95         */
       
    96         inline TInt Count();
       
    97         
       
    98         /**
       
    99         * Destroys the array. Frees memory.
       
   100         */
       
   101         inline void ResetAndDestroy();
       
   102         
       
   103         /**
       
   104         * Closes the array.
       
   105         */
       
   106         inline void Close();
       
   107         
       
   108         /**
       
   109         * Returns a mde object by index.
       
   110         * Leaves if index is out of bounds.
       
   111         * @return A pointer to mde object in the array.
       
   112         */
       
   113         inline CMdEObject* ObjectL( const TInt aIndex );
       
   114 
       
   115         /**
       
   116         * Returns a location data object by index.
       
   117         * Leaves if index is out of bounds.
       
   118         * @return A location data object in the array.
       
   119         */
       
   120         inline CLocationData* LocationDataL( const TInt aIndex );
       
   121         
       
   122         /**
       
   123         * Returns a query pointer by index.
       
   124         * Might be NULL.
       
   125         * Leaves if index is out of bounds.
       
   126         * @return A mde query pointer in the array.
       
   127         */
       
   128         inline CMdEQuery* QueryL( const TInt aIndex );
       
   129 
       
   130         /**
       
   131         * Sets a query pointer by index in the array to the given value.
       
   132         * @param aIndex  Array index. Leaves if out of bounds.
       
   133         * @param aQuery  Mde query pointer to set.
       
   134         */
       
   135         inline void SetQuery( const TInt aIndex, CMdEQuery* aQuery );
       
   136         
       
   137         /**
       
   138         * Return a reference to the mde object array used by this array.
       
   139         * Useful as a parameter to Mde API.
       
   140         * @return RPointerArray reference to an array used by this array.
       
   141         */
       
   142         inline RPointerArray<CMdEObject>& MdeObjectArray();
       
   143 
       
   144     private:
       
   145     
       
   146         /** Private constructor */
       
   147         inline CObjectDataArray();
       
   148     
       
   149     private:
       
   150 
       
   151         /** Array of mde objects. */
       
   152         RPointerArray<CMdEObject> iMdeObjectArray;
       
   153 
       
   154         /** Array of location data objects. */
       
   155         RPointerArray<CLocationData> iLocationArray;
       
   156 
       
   157         /** Array of (prepared) mde query objects. */
       
   158         RPointerArray<CMdEQuery> iQueryArray;
       
   159     };
       
   160 
       
   161 
       
   162 /**
       
   163 * Class used to store harvested file information.
       
   164 */
       
   165 class CFileData : public CBase
       
   166     {
       
   167     public:
       
   168         TBuf16<KMaxDataTypeLength> iMime16;
       
   169         TBuf8<KMaxDataTypeLength> iMime8;
       
   170         TInt64 iImageDataSize;
       
   171         TBool iJpeg;
       
   172         TTime iModified;
       
   173         TInt64 iFileSize;
       
   174         TInt iImageWidth;
       
   175         TInt iImageHeight;
       
   176         TInt iBitsPerPixel;
       
   177         TInt iFrameCount;
       
   178         TBool iExifSupported;
       
   179         TBool iDrmProtected;
       
   180         
       
   181         // no ownership to these
       
   182         CMdEObjectDef* iImageDef;
       
   183         TDesC* iUri;
       
   184         
       
   185         // ownership data
       
   186         HBufC8* iImageData;
       
   187     
       
   188     public:
       
   189         inline virtual ~CFileData();
       
   190         
       
   191         /** Standard NewL */
       
   192         inline static CFileData* NewL();
       
   193 
       
   194     private:
       
   195     
       
   196         /** Private constructor */
       
   197         inline CFileData();
       
   198     };
       
   199 
       
   200 /**
       
   201 * Class used to store harvested image data.
       
   202 */    
       
   203 class CHarvestData : public CBase
       
   204     {
       
   205     public:
       
   206     
       
   207         TUint16 iWhiteBalance;
       
   208         TUint32 iImageWidthExif; 
       
   209         TUint32 iImageHeightExif; 
       
   210         TUint16 iFlash;
       
   211         TUint16 iExposureProgram;
       
   212         TUint16 iOrientation;
       
   213         TUint16 iYCbCrPositioning;
       
   214         TUint16 iResolutionUnit;
       
   215         TUint16 iIsoSpeedRating;
       
   216         TReal32 iExposureTime;
       
   217         TUint16 iColourSpace;
       
   218         TReal32 iAperture;
       
   219         TReal32 iExposureBias;
       
   220         TUint16 iMeteringMode;
       
   221         TUint32 iExifVersion;
       
   222         TUint32 iFlashPixVersion;
       
   223         TUint32 iThumbXResolution;
       
   224         TUint32 iThumbYResolution;
       
   225         TUint16 iThumbResolutionUnit;
       
   226         TUint16 iThumbCompression;
       
   227         TReal32 iShutterSpeed;
       
   228         TUint32 iComponentsConfiguration;
       
   229         
       
   230         TReal32 iXResolution;
       
   231         TReal32 iYResolution;
       
   232         
       
   233         TReal32 iFocalPlaneXResolution;
       
   234         TReal32 iFocalPlaneYResolution;
       
   235         TUint16 iFocalPlaneResolutionUnit;
       
   236         
       
   237         TReal32 iFNumber;
       
   238         TReal32 iFocalLength;
       
   239         TUint16 iFocalLengthIn35mm;
       
   240         
       
   241         // We must not try to store these unless they can be found in exif
       
   242         TBool iStoreWhiteBalance;
       
   243         TBool iStoreExposureProgram;
       
   244         TBool iStoreExposureBias;
       
   245         TBool iStoreOrientation;
       
   246         TBool iStoreYCbCrPositioning;
       
   247         TBool iStoreExifVersion;
       
   248         TBool iStoreFlashPixVersion;
       
   249         TBool iStoreShutterSpeed;
       
   250         TBool iStoreAperture;
       
   251         TBool iStoreColourSpace;
       
   252         TBool iStoreXResolution;
       
   253         TBool iStoreYResolution;
       
   254         TBool iStoreExposureTime;
       
   255         TBool iStoreThumbCompression;
       
   256         TBool iStoreThumbResolutionUnit;
       
   257         TBool iStoreFNumber;
       
   258         TBool iStoreFocalLength;
       
   259         TBool iStoreComponentsConfig;
       
   260         TBool iStoreSamplesPerPixel;
       
   261         TBool iStoreThumbXResolution;
       
   262         TBool iStoreThumbYResolution;
       
   263         TBool iStoreFocalLengthIn35;
       
   264         TBool iStoreIsoSpeedRating;
       
   265         TBool iStoreMeteringMode;
       
   266         TBool iStoreFlash;
       
   267         TBool iStoreFocalPlaneResolutionUnit;
       
   268         TBool iStoreFocalPlaneXResolution;
       
   269         TBool iStoreFocalPlaneYResolution;
       
   270         
       
   271         // bits per sample and samples per pixel not recorded in JPEG exif
       
   272         TUint16 iSamplesPerPixel;
       
   273         
       
   274         HBufC16* iDescription16;
       
   275         HBufC16* iComment16;
       
   276         HBufC16* iCopyright16;
       
   277         HBufC8* iDateModified8;
       
   278         HBufC8* iDateOriginal8;
       
   279         HBufC8* iDateDigitized8;
       
   280         HBufC16* iMake;
       
   281         HBufC16* iModel;
       
   282         HBufC16* iArtist;
       
   283         HBufC16* iRelatedSoundFile;
       
   284         
       
   285         // location
       
   286         TReal64 iGpsLatitude;
       
   287         TReal64 iGpsLongitude;
       
   288         TReal64 iGpsAltitude;
       
   289 
       
   290         TBool iStoreGpsLatitudeAndLongitude;
       
   291         TBool iStoreGpsAltitude;
       
   292     
       
   293     public:
       
   294         /** Virtual destructor. */
       
   295         inline virtual ~CHarvestData();
       
   296 
       
   297         /** Standard NewL */
       
   298         inline static CHarvestData* NewL();
       
   299         
       
   300     private:
       
   301     
       
   302         /** Private constructor */
       
   303         inline CHarvestData();
       
   304     };
       
   305 
       
   306 #include "harvestdata.inl"
       
   307 
       
   308 #endif