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