imagehandling_plat/thumbnailmanager_api/inc/thumbnailobjectsource.h
changeset 0 2014ca87e772
child 30 b67379558a75
equal deleted inserted replaced
-1:000000000000 0:2014ca87e772
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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:  Class for encapsulating the data source for objects.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef THUMBNAILOBJECTSOURCE_H
       
    20 #define THUMBNAILOBJECTSOURCE_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <f32file.h>
       
    24 
       
    25 typedef TUint32 TThumbnailId;
       
    26 
       
    27 class CFbsBitmap;
       
    28 
       
    29 /**
       
    30  *  Object source for thumbnails.
       
    31  *
       
    32  *  Class for encapsulating the data source for objects.
       
    33  *
       
    34  *  @since S60 v5.0
       
    35  */
       
    36 NONSHARABLE_CLASS( CThumbnailObjectSource ): public CBase
       
    37     {
       
    38 public:
       
    39     /**
       
    40      * Construct a new CThumbnailObjectSource referring to an URI.
       
    41      * @param aUri      Object URI or a full path to a file in the file system.
       
    42      * @param aMimeType MIME type. Optional, but should be specified if known.
       
    43      * @since S60 v5.0
       
    44      * @return New CThumbnailObjectSource instance.
       
    45      */
       
    46     IMPORT_C static CThumbnailObjectSource* NewL( const TDesC& aUri, const
       
    47         TDesC& aMimeType = KNullDesC );
       
    48 
       
    49     /**
       
    50      * Construct a new CThumbnailObjectSource referring to an URI.
       
    51      * @param aUri      Object URI or a full path to a file in the file system.
       
    52      * @param aMimeType MIME type. Optional, but should be specified if known.
       
    53      * @since S60 v5.0
       
    54      * @return New CThumbnailObjectSource instance.
       
    55      */
       
    56     IMPORT_C static CThumbnailObjectSource* NewLC( const TDesC& aUri, const
       
    57         TDesC& aMimeType = KNullDesC );
       
    58 
       
    59     /**
       
    60      * Construct a new CThumbnailObjectSource referring to a file handle.
       
    61      * The file handle must refer to an open file and it must remain
       
    62      * valid until this object source is deleted.
       
    63      *
       
    64      * @param aFile     File handle.
       
    65      * @param aMimeType MIME type. Optional, but should be specified if known.
       
    66      * @since S60 v5.0
       
    67      * @return New CThumbnailObjectSource instance.
       
    68      */
       
    69     IMPORT_C static CThumbnailObjectSource* NewL( const RFile64& aFile, const
       
    70         TDesC& aMimeType = KNullDesC );
       
    71 
       
    72     /**
       
    73      * Construct a new CThumbnailObjectSource referring to a file handle.
       
    74      * The file handle must refer to an open file and it must remain
       
    75      * valid until this object source is deleted.
       
    76      *
       
    77      * @param aFile     File handle.
       
    78      * @param aMimeType MIME type. Optional, but should be specified if known.
       
    79      * @since S60 v5.0
       
    80      * @return New CThumbnailObjectSource instance.
       
    81      */
       
    82     IMPORT_C static CThumbnailObjectSource* NewLC( const RFile64& aFile, const
       
    83         TDesC& aMimeType = KNullDesC );
       
    84 
       
    85     /**
       
    86      * Destructor
       
    87      *
       
    88      * @since S60 v5.0
       
    89      */
       
    90     virtual ~CThumbnailObjectSource();
       
    91 
       
    92 public:
       
    93 
       
    94     /**
       
    95      * Returns file handle.
       
    96      *
       
    97      * @since S60 v5.0
       
    98      * @return reference to file handle
       
    99      */
       
   100     IMPORT_C RFile64& FileHandle();
       
   101 
       
   102     /**
       
   103      * Returns source uri.
       
   104      *
       
   105      * @since S60 v5.0
       
   106      * @return uri
       
   107      */
       
   108     IMPORT_C const TDesC& Uri();
       
   109 
       
   110 private:
       
   111 
       
   112     /**
       
   113      * C++ default constructor
       
   114      *
       
   115      * @since S60 v5.0
       
   116      */
       
   117     CThumbnailObjectSource();
       
   118 
       
   119     /**
       
   120      * Symbian 2nd phase constructor can leave.
       
   121      *
       
   122      * @since S60 v5.0
       
   123      * @param aUri Object URI or a full path to a file in the file system.
       
   124      * @param aMimeType MIME type. Optional, but should be specified if known.
       
   125      */
       
   126     void ConstructL( const TDesC& aUri, const TDesC& aMimeType );
       
   127 
       
   128     /**
       
   129      * Symbian 2nd phase constructor can leave.
       
   130      *
       
   131      * @since S60 v5.0
       
   132      * @param aFile File handle.
       
   133      * @param aMimeType MIME type. Optional, but should be specified if known.
       
   134      */
       
   135     void ConstructL( const RFile64& aFile, const TDesC& aMimeType );
       
   136 
       
   137 private:
       
   138     // data
       
   139 
       
   140     /**
       
   141      * File
       
   142      */
       
   143     RFile64 iFile;
       
   144 
       
   145     /**
       
   146      * Uri
       
   147      */
       
   148     HBufC* iUri; // own
       
   149 
       
   150     /**
       
   151      * Mime type
       
   152      */
       
   153     HBufC8* iMimeType; // own
       
   154     
       
   155     /**
       
   156      * Buffer
       
   157      */
       
   158     TDesC8* iBuffer; // own
       
   159     
       
   160     /**
       
   161      * Bitmap
       
   162      */
       
   163 
       
   164     CFbsBitmap* iBitmap; // own
       
   165     
       
   166     /**
       
   167      * ThumbnailId
       
   168      */
       
   169     
       
   170     TThumbnailId iThumbnailId; //own
       
   171 	
       
   172 public:
       
   173     /**
       
   174      * Symbian 2nd phase constructor can leave.
       
   175      *
       
   176      * @since S60 v5.0
       
   177      * @param aURI URI.
       
   178      * @param aMimeType MimeType.
       
   179      * @param aThumbnailId ThumbnailId
       
   180      */
       
   181 	void ConstructL( const TDesC& aUri, const TDesC& aMimeType, TThumbnailId aThumbnailId );
       
   182 	    
       
   183     /**
       
   184      * Construct a new CThumbnailObjectSource referring to a buffer 
       
   185      * containing an image.
       
   186      *
       
   187      * @param aBuffer   Buffer.
       
   188      * @param aUri      Object URI or a full path to a file in the file system.
       
   189      * @since S60 v5.0
       
   190      * @return New CThumbnailObjectSource instance.
       
   191      */    
       
   192     IMPORT_C static CThumbnailObjectSource* NewL( CFbsBitmap*  aBitmap, const TDesC& aUri );
       
   193 
       
   194     /**
       
   195      * Construct a new CThumbnailObjectSource referring to a buffer 
       
   196      * containing an image.
       
   197      *
       
   198      * @param aFile     File handle.
       
   199      * @param aUri      Object URI or a full path to a file in the file system.
       
   200      * @since S60 v5.0
       
   201      * @return New CThumbnailObjectSource instance.
       
   202      */        
       
   203     IMPORT_C static CThumbnailObjectSource* NewLC( CFbsBitmap*  aBitmap, const TDesC& aUri );
       
   204  
       
   205     /**
       
   206      * Construct a new CThumbnailObjectSource referring to a buffer 
       
   207      * containing an image.
       
   208      *
       
   209      * @param aBuffer   Buffer.
       
   210      * @param aUri      Object URI or a full path to a file in the file system.
       
   211      * @since S60 v5.0
       
   212      * @return New CThumbnailObjectSource instance.
       
   213      */       
       
   214     IMPORT_C static CThumbnailObjectSource* NewL( TDesC8* aBuffer,  TDesC& aMimeType, const TDesC& aUri );
       
   215     
       
   216     /**
       
   217      * Construct a new CThumbnailObjectSource referring to a buffer 
       
   218      * containing an image.
       
   219      *
       
   220      * @param aBuffer   Buffer.
       
   221      * @param aMimeType MIME type. Optional, but should be specified if known.
       
   222      * @param aUri      Object URI or a full path to a file in the file system.
       
   223      * @since S60 v5.0
       
   224      * @return New CThumbnailObjectSource instance.
       
   225      */       
       
   226     IMPORT_C static CThumbnailObjectSource* NewLC( TDesC8* aBuffer,  TDesC& aMimeType, const TDesC& aUri);
       
   227 
       
   228     /**
       
   229      * Construct a new CThumbnailObjectSource referring to an URI.
       
   230      * @param aUri      Object URI or a full path to a file in the file system.
       
   231      * @param aMimeType MIME type. Optional, but should be specified if known.
       
   232      * @since S60 v5.0
       
   233      * @return New CThumbnailObjectSource instance.
       
   234      */
       
   235     IMPORT_C static CThumbnailObjectSource* NewL( const TDesC& aUri, 
       
   236             TThumbnailId aThumbnailId = 0, const TDesC& aMimeType = KNullDesC );
       
   237 
       
   238     /**
       
   239      * Construct a new CThumbnailObjectSource referring to an URI.
       
   240      * @param aUri      Object URI or a full path to a file in the file system.
       
   241      * @param aMimeType MIME type. Optional, but should be specified if known.
       
   242      * @since S60 v5.0
       
   243      * @return New CThumbnailObjectSource instance.
       
   244      */
       
   245     IMPORT_C static CThumbnailObjectSource* NewLC( const TDesC& aUri,
       
   246             TThumbnailId aThumbnailId = 0, const TDesC& aMimeType = KNullDesC );
       
   247     
       
   248 	 
       
   249     /**
       
   250      * Returns source buffer.
       
   251      *
       
   252      * @since S60 v5.0
       
   253      * @return buffer
       
   254      */  
       
   255     IMPORT_C TDesC8* Buffer();
       
   256     
       
   257     /**
       
   258      * Gets ownership of buffer from source object.
       
   259      * After that Buffer() returns NULL.
       
   260      *
       
   261      * @since S60 v5.0
       
   262      * @return buffer
       
   263      */
       
   264     IMPORT_C TDesC8* GetBufferOwnership();
       
   265     
       
   266     /**
       
   267      * Gets MIME type.
       
   268      *
       
   269      * @since S60 v5.0
       
   270      * @return MIME type
       
   271      */   
       
   272     IMPORT_C const TDesC8& MimeType();
       
   273     
       
   274     /**
       
   275      * Gets ThumbnailId.
       
   276      *
       
   277      * @since S60 v5.0
       
   278      * @return ThumbnailId 
       
   279      */ 
       
   280     
       
   281     IMPORT_C TThumbnailId Id(); 
       
   282 	    
       
   283     /**
       
   284      * Symbian 2nd phase constructor can leave.
       
   285      *
       
   286      * @since S60 v5.0
       
   287      * @param aBitmap Bitmap.
       
   288      * @param aURI URI.
       
   289      */   
       
   290     void ConstructL( CFbsBitmap* aBitmap, const TDesC&
       
   291             aUri );
       
   292 
       
   293     /**
       
   294      * Symbian 2nd phase constructor can leave.
       
   295      *
       
   296      * @since S60 v5.0
       
   297      * @param aBuffer Buffer.
       
   298      * @param aMimeType MIME type. Optional, but should be specified if known.
       
   299      * @param aURI URI.
       
   300      */
       
   301     void ConstructL( TDesC8* aBuffer, const TDesC&
       
   302         aMimeType, const TDesC& aUri );
       
   303     
       
   304     /**
       
   305      * Returns source bitmap.
       
   306      *
       
   307      * @since S60 v5.0
       
   308      * @return bitmap
       
   309      */  
       
   310     IMPORT_C CFbsBitmap* Bitmap();
       
   311     
       
   312     /**
       
   313      * Gets ownership of bitmap from source object.
       
   314      * After that Bitmap() returns NULL.
       
   315      *
       
   316      * @since S60 v5.0
       
   317      * @return bitmap
       
   318      */
       
   319     IMPORT_C CFbsBitmap* GetBitmapOwnership();
       
   320 };
       
   321 
       
   322 #endif // THUMBNAILOBJECTSOURCE_H