os/ossrv/lowlevellibsandfws/apputils/multipartparser/inc/bodypart.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2005-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 "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Implementation of the Multipart Body Part
    15 //
    16 
    17 
    18 
    19 /**
    20  @file
    21  @publishedPartner
    22  @prototype
    23 */
    24 
    25 #ifndef BODYPART_H
    26 #define BODYPART_H
    27 
    28 #include <e32std.h>
    29 #include <e32base.h>
    30 
    31 /**
    32 Implementation of the MIME Multipart Body Part
    33 @see MultipartParser
    34 */
    35 NONSHARABLE_CLASS(CBodyPart) : public CBase
    36     {
    37     public:
    38         
    39         /** Allocates and constructs a new CBodyPart object */
    40         IMPORT_C static CBodyPart* NewL();
    41         
    42         /** Destructor */
    43         IMPORT_C virtual ~CBodyPart();
    44 
    45         /** Gets the Body
    46         @return The body of this body part
    47         */
    48 	    inline const TDesC8& Body() { return iBody; }
    49 
    50         /** Gets the Content-Type
    51         @return The Content-Type of this body part
    52         */
    53 	    inline const TDesC8& ContentType() { return iContentType; }
    54 
    55         /** Gets the charset
    56         @return The charset of this body part
    57         */
    58 	    inline const TDesC8& Charset() { return iCharset; }	
    59 
    60         /** Gets the Content ID
    61         @return The content ID of this body part
    62         */
    63 	    inline const TDesC8& ContentID() { return iContentID; }
    64 
    65         /** Gets the URL
    66         @return The URL of this body part
    67         */
    68 	    inline const TDesC16& Url() { return *iUrl; }
    69 
    70         /** Gets the headers
    71         @return The headers of this body part
    72         */
    73 	    inline const TDesC8& Headers() { return iHeaders; }
    74 
    75         /** Get the Boundary
    76         @return The boundary of this body part
    77         */
    78         const TDesC8& Boundary();
    79 
    80         /** Gets the Content-Base
    81         @return The Content-Base of this body part
    82         */
    83         const TDesC8& ContentBase();
    84 
    85         /** Gets the Content-Location
    86         @return The Content-Location of this body part
    87         */
    88         const TDesC8& ContentLocation();
    89 
    90         /** Gets the Content-Transfer-Encoding
    91         @return The Content-Transfer-Encoding of this body part
    92         */
    93         const TDesC8& ContentTransferEncoding();
    94 
    95         /** Check if the body is decoded or unzipped
    96         @return If the body of the body part is decoded or unzipped
    97         */
    98         TBool IsDecodedBody();
    99 
   100         /** Sets the Body
   101         @param aBody   The body to set
   102         */
   103         inline void SetBody( const TDesC8& aBody ) { iBody.Set( aBody ); }
   104 
   105         /** Sets the Boundary
   106         @param aBoundary   The boundary to set
   107         */
   108         void SetBoundary( const TDesC8& aBoundary );
   109 
   110         /** Sets the charset
   111         @param aCharset   The charset to set
   112         */
   113         void SetCharset( const TDesC8& aCharset );
   114 
   115         /** Sets the Content-Base
   116         @param aContentBase   The Content-Base to set
   117         */
   118         void SetContentBase( const TDesC8& aContentBase );
   119 
   120         /** Sets the Content-Location
   121         @param aContentLocation   The Content-Location to set
   122         */
   123         void SetContentLocation( const TDesC8& aContentLocation );
   124 
   125         /** Sets the Content-Transfer-Encoding
   126         @param aContentTransferEncoding   The Content-Transfer-Encoding to set
   127         */
   128         void SetContentTransferEncoding( const TDesC8& aContentTransferEncoding );
   129 
   130         /** Set the Content-Type
   131         @param aContentType   The Content-Type to set
   132         */
   133         void SetContentType( const TDesC8& aContentType );
   134 
   135         /** Sets the Content ID
   136         @param aContentID   The content-ID to set
   137         */
   138         void SetContentID( const TDesC8& aContentID );
   139 
   140         /** Sets the headers
   141         @param aHeaders   The headers to set
   142         */
   143         inline void SetHeaders( const TDesC8& aHeaders ) { iHeaders.Set( aHeaders ); }
   144 
   145         /** Sets whether the body part is decoded or unzipped
   146         @param aIsDecodedBody   If the body of the body part is decoded or unzipped
   147         */
   148         void SetIsDecodedBody( TBool aIsDecodedBody );
   149 
   150         /** Sets the URL
   151         * @param aUrl   The URL to set
   152         */
   153         void SetUrl( HBufC16* aUrl );
   154 
   155     private:
   156 
   157         /** Default constructor */
   158         CBodyPart();
   159 
   160         /** 2nd phase constructor */
   161         void ConstructL();
   162 
   163 
   164     private:
   165         TPtrC8   iBody;
   166         TPtrC8   iBoundary;
   167         TPtrC8   iCharset;
   168         TPtrC8   iContentBase;
   169         TPtrC8   iContentLocation;
   170         TPtrC8   iContentTransferEncoding;
   171         TPtrC8   iContentType;
   172         TPtrC8   iContentID;
   173         TPtrC8   iHeaders;
   174         TBool    iIsDecodedBody;  // if ETrue, this class is responsible for freeing the memory of iBody
   175         HBufC16* iUrl;
   176     };
   177 
   178 #endif      // BODYPART_H   
   179