1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/lowlevellibsandfws/apputils/multipartparser/inc/bodypart.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,179 @@
1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Implementation of the Multipart Body Part
1.18 +//
1.19 +
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @publishedPartner
1.25 + @prototype
1.26 +*/
1.27 +
1.28 +#ifndef BODYPART_H
1.29 +#define BODYPART_H
1.30 +
1.31 +#include <e32std.h>
1.32 +#include <e32base.h>
1.33 +
1.34 +/**
1.35 +Implementation of the MIME Multipart Body Part
1.36 +@see MultipartParser
1.37 +*/
1.38 +NONSHARABLE_CLASS(CBodyPart) : public CBase
1.39 + {
1.40 + public:
1.41 +
1.42 + /** Allocates and constructs a new CBodyPart object */
1.43 + IMPORT_C static CBodyPart* NewL();
1.44 +
1.45 + /** Destructor */
1.46 + IMPORT_C virtual ~CBodyPart();
1.47 +
1.48 + /** Gets the Body
1.49 + @return The body of this body part
1.50 + */
1.51 + inline const TDesC8& Body() { return iBody; }
1.52 +
1.53 + /** Gets the Content-Type
1.54 + @return The Content-Type of this body part
1.55 + */
1.56 + inline const TDesC8& ContentType() { return iContentType; }
1.57 +
1.58 + /** Gets the charset
1.59 + @return The charset of this body part
1.60 + */
1.61 + inline const TDesC8& Charset() { return iCharset; }
1.62 +
1.63 + /** Gets the Content ID
1.64 + @return The content ID of this body part
1.65 + */
1.66 + inline const TDesC8& ContentID() { return iContentID; }
1.67 +
1.68 + /** Gets the URL
1.69 + @return The URL of this body part
1.70 + */
1.71 + inline const TDesC16& Url() { return *iUrl; }
1.72 +
1.73 + /** Gets the headers
1.74 + @return The headers of this body part
1.75 + */
1.76 + inline const TDesC8& Headers() { return iHeaders; }
1.77 +
1.78 + /** Get the Boundary
1.79 + @return The boundary of this body part
1.80 + */
1.81 + const TDesC8& Boundary();
1.82 +
1.83 + /** Gets the Content-Base
1.84 + @return The Content-Base of this body part
1.85 + */
1.86 + const TDesC8& ContentBase();
1.87 +
1.88 + /** Gets the Content-Location
1.89 + @return The Content-Location of this body part
1.90 + */
1.91 + const TDesC8& ContentLocation();
1.92 +
1.93 + /** Gets the Content-Transfer-Encoding
1.94 + @return The Content-Transfer-Encoding of this body part
1.95 + */
1.96 + const TDesC8& ContentTransferEncoding();
1.97 +
1.98 + /** Check if the body is decoded or unzipped
1.99 + @return If the body of the body part is decoded or unzipped
1.100 + */
1.101 + TBool IsDecodedBody();
1.102 +
1.103 + /** Sets the Body
1.104 + @param aBody The body to set
1.105 + */
1.106 + inline void SetBody( const TDesC8& aBody ) { iBody.Set( aBody ); }
1.107 +
1.108 + /** Sets the Boundary
1.109 + @param aBoundary The boundary to set
1.110 + */
1.111 + void SetBoundary( const TDesC8& aBoundary );
1.112 +
1.113 + /** Sets the charset
1.114 + @param aCharset The charset to set
1.115 + */
1.116 + void SetCharset( const TDesC8& aCharset );
1.117 +
1.118 + /** Sets the Content-Base
1.119 + @param aContentBase The Content-Base to set
1.120 + */
1.121 + void SetContentBase( const TDesC8& aContentBase );
1.122 +
1.123 + /** Sets the Content-Location
1.124 + @param aContentLocation The Content-Location to set
1.125 + */
1.126 + void SetContentLocation( const TDesC8& aContentLocation );
1.127 +
1.128 + /** Sets the Content-Transfer-Encoding
1.129 + @param aContentTransferEncoding The Content-Transfer-Encoding to set
1.130 + */
1.131 + void SetContentTransferEncoding( const TDesC8& aContentTransferEncoding );
1.132 +
1.133 + /** Set the Content-Type
1.134 + @param aContentType The Content-Type to set
1.135 + */
1.136 + void SetContentType( const TDesC8& aContentType );
1.137 +
1.138 + /** Sets the Content ID
1.139 + @param aContentID The content-ID to set
1.140 + */
1.141 + void SetContentID( const TDesC8& aContentID );
1.142 +
1.143 + /** Sets the headers
1.144 + @param aHeaders The headers to set
1.145 + */
1.146 + inline void SetHeaders( const TDesC8& aHeaders ) { iHeaders.Set( aHeaders ); }
1.147 +
1.148 + /** Sets whether the body part is decoded or unzipped
1.149 + @param aIsDecodedBody If the body of the body part is decoded or unzipped
1.150 + */
1.151 + void SetIsDecodedBody( TBool aIsDecodedBody );
1.152 +
1.153 + /** Sets the URL
1.154 + * @param aUrl The URL to set
1.155 + */
1.156 + void SetUrl( HBufC16* aUrl );
1.157 +
1.158 + private:
1.159 +
1.160 + /** Default constructor */
1.161 + CBodyPart();
1.162 +
1.163 + /** 2nd phase constructor */
1.164 + void ConstructL();
1.165 +
1.166 +
1.167 + private:
1.168 + TPtrC8 iBody;
1.169 + TPtrC8 iBoundary;
1.170 + TPtrC8 iCharset;
1.171 + TPtrC8 iContentBase;
1.172 + TPtrC8 iContentLocation;
1.173 + TPtrC8 iContentTransferEncoding;
1.174 + TPtrC8 iContentType;
1.175 + TPtrC8 iContentID;
1.176 + TPtrC8 iHeaders;
1.177 + TBool iIsDecodedBody; // if ETrue, this class is responsible for freeing the memory of iBody
1.178 + HBufC16* iUrl;
1.179 + };
1.180 +
1.181 +#endif // BODYPART_H
1.182 +