emailservices/emailstore/message_store/client/api/MsgStorePropertyContainerWithContent.h
changeset 0 8466d47a6819
child 8 e1b6206813b4
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2006 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:   Message store property container with content.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __MSG_STORE_PROPERTY_CONTAINER_WITH_CONTENT_H__
       
    21 #define __MSG_STORE_PROPERTY_CONTAINER_WITH_CONTENT_H__
       
    22 
       
    23 #include <f32file.h>
       
    24 //<cmail>
       
    25 #include "MsgStoreWritablePropertyContainer.h"
       
    26 //</cmail>
       
    27 
       
    28 
       
    29 /** This class adds the capability to store content to a property container.
       
    30 
       
    31 	This class adds the capability to store content with a set of name/value pairs.  The content can be
       
    32 	accessed via descriptor buffers or file handles.  File handles are used in order to more easily
       
    33 	transfer large data within a data-caged environment.
       
    34 */
       
    35 class CMsgStorePropertyContainerWithContent : public CMsgStoreWritablePropertyContainer
       
    36 	{
       
    37 	public:
       
    38 
       
    39 		/** Returns the type of the current content. */	
       
    40 		IMPORT_C const TDesC& ContentTypeL();
       
    41 
       
    42 		/** Sets the type of the current content. */	
       
    43 		IMPORT_C void SetContentTypeL(const TDesC& aType);
       
    44 
       
    45 		/** Returns the length of the current content. */	
       
    46 		IMPORT_C TUint ContentLengthL();
       
    47 	
       
    48 		/** Fetches the content into a buffer.
       
    49 		
       
    50 		    This function reads a portion or all of the content into a contiguous RAM buffer provided
       
    51 		    by the caller. 	The content will be will be truncated if the amount in local storage is
       
    52 		    larger than the given buffer.
       
    53 		    
       
    54 			ECapabilityReadUserData is required to use this function.						
       
    55 		*/
       
    56 		IMPORT_C void FetchContentToBufferL( TDes8& aBuffer, TUint aStartOffset = 0 );
       
    57 
       
    58 		/** Fetches the content into the designated file. 
       
    59 		
       
    60 		    This function copies the entire content buffer into the given file.  The given file is opened
       
    61 		    in the caller's process, so any file that is accessible by the caller can be used in this call
       
    62 		    (including private files).
       
    63 		    
       
    64 			ECapabilityReadUserData is required to use this function.						
       
    65 		*/
       
    66 		IMPORT_C void FetchContentToFileL( const TDesC& aFilename );
       
    67 		
       
    68 		/** Wipes the contents of the content from local storage. 
       
    69 		
       
    70 			ECapabilityWriteUserData is required to use this function.						
       
    71 		*/
       
    72 		IMPORT_C void RemoveContentL();
       
    73 	
       
    74 		/** Appends the given buffer to the content in the message store.
       
    75 		
       
    76 			ECapabilityWriteUserData is required to use this function.						
       
    77 		*/
       
    78 		IMPORT_C void AppendToContentL( const TDesC8& aBuffer );
       
    79 	
       
    80 		/** Replaces the current content with the given buffer.
       
    81 		
       
    82 			ECapabilityWriteUserData is required to use this function.						
       
    83 		*/
       
    84 		IMPORT_C void ReplaceContentL( const TDesC8& aBuffer );
       
    85 	
       
    86 		/** Replaces the current content with the contents of the given file.  
       
    87 		
       
    88 			ECapabilityWriteUserData is required to use this function.  The given file is opened
       
    89 		    in the caller's process, so any file that is accessible by the caller can be used in this call
       
    90 		    (including private files).						
       
    91 		*/
       
    92 		IMPORT_C void ReplaceContentWithFileL( const TDesC& aFilename );
       
    93         
       
    94         /** Opens the original content file and transfer the file handle to the provided RFile handle.  
       
    95         
       
    96             This method is intended to be used when the message store is NOT encrypted.
       
    97             It leaves with KErrNotSupported if the content is encrypted.            
       
    98             The file will be opened with EFileRead and EFileShareAny
       
    99             ECapabilityReadUserData is required to use this function.   
       
   100         */
       
   101         IMPORT_C void OpenOriginalContentFileL( RFile& aFile );
       
   102         
       
   103         /** Prepends the given buffer to the content in the message store.
       
   104         
       
   105             ECapabilityWriteUserData is required to use this function.                      
       
   106         */
       
   107         IMPORT_C void PrependToContentL( const TDesC8& aBuffer );
       
   108 
       
   109 	protected:
       
   110 
       
   111 	 	CMsgStorePropertyContainerWithContent( CMsgStoreSessionContext& aSessionContext, TMsgStoreId aId, TMsgStoreId aParentId, TMsgStoreId aMailBoxId );
       
   112 
       
   113 	 	TBool iHasContent;
       
   114 	
       
   115 	}; // end class CMsgStorePropertyContainerWithContent
       
   116 
       
   117 #endif   //__MSG_STORE_WRITABLE_PROPERTY_CONTAINER_H__