epoc32/include/cmsvmimeheaders.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 cmsvmimeheaders.h
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __CMSVMIMEHEADERS_H__
       
    17 #define __CMSVMIMEHEADERS_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 
       
    21 class CDesC8ArrayFlat;
       
    22 class CMsvAttachment;
       
    23 class CDesC8Array;
       
    24 
       
    25 /**
       
    26 String literal for Base64 encoding.
       
    27 @publishedAll
       
    28 @released
       
    29 */
       
    30 _LIT8(KMsvBase64String, "Base64");
       
    31 
       
    32 /**
       
    33 String literal for Quoted-Printable encoding.
       
    34 @publishedAll
       
    35 @released
       
    36 */
       
    37 _LIT8(KMsvQPString, "quoted-printable");
       
    38 
       
    39 /**
       
    40 String literal for 7 bit encoding.
       
    41 @publishedAll
       
    42 @released
       
    43 */
       
    44 _LIT8(KMsv7BitString, "7bit");
       
    45 
       
    46 /**
       
    47 String literal for 8 bit encoding.
       
    48 @publishedAll
       
    49 @released
       
    50 */
       
    51 _LIT8(KMsv8BitString, "8bit");
       
    52 
       
    53 /**
       
    54 String literal for binary encoding.
       
    55 @publishedAll
       
    56 @released
       
    57 */
       
    58 _LIT8(KMsvBinaryString, "binary");
       
    59 
       
    60 /**
       
    61 String literal for UU encoding.
       
    62 @publishedAll
       
    63 @released
       
    64 */
       
    65 _LIT8(KMsvUUString, "uuencode");
       
    66 
       
    67 /**
       
    68 Utility class to represent commonly used Mime Headers. This object represents a number
       
    69 of common Mime Headers into a single class. It is intended that this class is used to
       
    70 represent the Mime Headers for an attachment represented by the CMsvAttachment class when
       
    71 using the Attachment API. The Mime header data can be associated with an attachment and 
       
    72 stored and restored using the StoreL and RestoreL methods.
       
    73 @publishedAll
       
    74 @released
       
    75 */
       
    76 class CMsvMimeHeaders : public CBase
       
    77 	{
       
    78 public:
       
    79 
       
    80 /** Messaging encoding types. 
       
    81 @publishedAll
       
    82 @released
       
    83 */
       
    84 enum TMsvEncodingType 
       
    85 	{
       
    86 	/** Unknown. */
       
    87 	EEncodingTypeUnknown,
       
    88 	/** None. */
       
    89 	EEncodingTypeNone,
       
    90 	/** 7-bit. */
       
    91 	EEncodingType7Bit,
       
    92 	/** 8-bit. */
       
    93 	EEncodingType8Bit,		// ie lines still <1000 chars and terminated by CRLF
       
    94 	/** Binary. */
       
    95 	EEncodingTypeBinary,	// ie any length of data, not terminated by CRLF
       
    96 	/** QP. */
       
    97 	EEncodingTypeQP,
       
    98 	/** Base64. */
       
    99 	EEncodingTypeBASE64,
       
   100 	/** UU. */
       
   101 	EEncodingTypeUU
       
   102 	};
       
   103 	
       
   104 public:
       
   105 	IMPORT_C static CMsvMimeHeaders* NewL();
       
   106 	IMPORT_C static CMsvMimeHeaders* NewLC();
       
   107 	IMPORT_C ~CMsvMimeHeaders();
       
   108 	
       
   109 	IMPORT_C void StoreL(CMsvAttachment& aAttachment) const;
       
   110 	IMPORT_C void RestoreL(CMsvAttachment& aAttachment);
       
   111 	
       
   112 	IMPORT_C void SetContentDescriptionL(const TDesC8& aContentDescription);
       
   113 	IMPORT_C const TDesC8& ContentDescription() const;
       
   114 	
       
   115 	IMPORT_C void SetContentBaseL(const TDesC8& aContentBase);
       
   116 	IMPORT_C const TDesC8& ContentBase() const;
       
   117 	
       
   118 	IMPORT_C void SetContentLocationL(const TDesC16& aContentLocation);
       
   119 	IMPORT_C const TDesC16& ContentLocation() const;
       
   120 	
       
   121 	IMPORT_C void SetContentIdL(const TDesC8& aContentId);
       
   122 	IMPORT_C const TDesC8& ContentId() const;
       
   123 	
       
   124 	IMPORT_C void SetContentTypeL(const TDesC8& aContentType);
       
   125 	IMPORT_C const TDesC8& ContentType() const;
       
   126 	
       
   127 	IMPORT_C void SetContentSubTypeL(const TDesC8& aSubContentType);
       
   128 	IMPORT_C const TDesC8& ContentSubType() const;
       
   129 	
       
   130 	IMPORT_C void SetContentDispositionL(const TDesC8& aContentDisposition);
       
   131 	IMPORT_C const TDesC8& ContentDisposition() const;
       
   132 	
       
   133 	IMPORT_C CDesC8Array& ContentTypeParams();
       
   134 	IMPORT_C CDesC8Array& ContentDispositionParams();
       
   135 	IMPORT_C CDesC8Array& XTypeParams();
       
   136 	
       
   137 	IMPORT_C const CDesC8Array& ContentTypeParams() const;
       
   138 	IMPORT_C const CDesC8Array& ContentDispositionParams() const;
       
   139 	IMPORT_C const CDesC8Array& XTypeParams() const;
       
   140 	
       
   141 	IMPORT_C void SetMimeCharset(TUint aMimeCharset);
       
   142 	IMPORT_C TUint MimeCharset() const;
       
   143 	
       
   144 	IMPORT_C void SetSuggestedFilenameL(const TDesC16& aSuggestedFilename);
       
   145 	IMPORT_C const TDesC16& SuggestedFilename() const;
       
   146 	
       
   147 	IMPORT_C void SetRelativePathL(const TDesC8& aRelativePath);
       
   148 	IMPORT_C const TDesC8& RelativePath() const;
       
   149 	
       
   150 	IMPORT_C void SetContentTransferEncoding(const TDesC8& aEncodingType);
       
   151 	IMPORT_C TMsvEncodingType ContentTransferEncoding() const;
       
   152 	IMPORT_C TMsvEncodingType ContentTransferEncoding(TPtrC8& aEncodingType) const;
       
   153 	IMPORT_C const TPtrC8 GetContentTypeValue(const TDesC8& aContentTypeParameter) const;
       
   154 
       
   155 	IMPORT_C void Reset();
       
   156 	IMPORT_C TInt Size() const;
       
   157 	IMPORT_C TBool ContainsMimeHeaders(const CMsvAttachment& aAttachment);
       
   158 	
       
   159 private:
       
   160 	CMsvMimeHeaders();
       
   161 	void ConstructL();
       
   162 	
       
   163 private:
       
   164 	HBufC8* iContentDescription;
       
   165 	HBufC8* iContentBase;
       
   166 	HBufC16* iContentLocation;
       
   167 	HBufC8* iContentId;
       
   168 	HBufC8* iContentType;
       
   169 	HBufC8* iContentSubType;
       
   170 	HBufC8* iContentDisposition;
       
   171 	CDesC8ArrayFlat* iContentTypeParams;            // zero or more "parameter"
       
   172 	CDesC8ArrayFlat* iContentDispositionParams;     // zero or more "parameters"
       
   173 	CDesC8ArrayFlat* iXTypeParams;                  // zero or more X-Type "parameters"
       
   174 	TUint iMimeCharset;
       
   175 	HBufC16* iSuggestedFilename;
       
   176 	HBufC8* iRelativePath;
       
   177 	TMsvEncodingType iContentTransferEncoding;
       
   178 	};
       
   179 
       
   180 #endif // __CMSVMIMEHEADERS_H__