sl@0: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Implementation of the Multipart Body Part sl@0: // sl@0: sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @publishedPartner sl@0: @prototype sl@0: */ sl@0: sl@0: #ifndef BODYPART_H sl@0: #define BODYPART_H sl@0: sl@0: #include sl@0: #include sl@0: sl@0: /** sl@0: Implementation of the MIME Multipart Body Part sl@0: @see MultipartParser sl@0: */ sl@0: NONSHARABLE_CLASS(CBodyPart) : public CBase sl@0: { sl@0: public: sl@0: sl@0: /** Allocates and constructs a new CBodyPart object */ sl@0: IMPORT_C static CBodyPart* NewL(); sl@0: sl@0: /** Destructor */ sl@0: IMPORT_C virtual ~CBodyPart(); sl@0: sl@0: /** Gets the Body sl@0: @return The body of this body part sl@0: */ sl@0: inline const TDesC8& Body() { return iBody; } sl@0: sl@0: /** Gets the Content-Type sl@0: @return The Content-Type of this body part sl@0: */ sl@0: inline const TDesC8& ContentType() { return iContentType; } sl@0: sl@0: /** Gets the charset sl@0: @return The charset of this body part sl@0: */ sl@0: inline const TDesC8& Charset() { return iCharset; } sl@0: sl@0: /** Gets the Content ID sl@0: @return The content ID of this body part sl@0: */ sl@0: inline const TDesC8& ContentID() { return iContentID; } sl@0: sl@0: /** Gets the URL sl@0: @return The URL of this body part sl@0: */ sl@0: inline const TDesC16& Url() { return *iUrl; } sl@0: sl@0: /** Gets the headers sl@0: @return The headers of this body part sl@0: */ sl@0: inline const TDesC8& Headers() { return iHeaders; } sl@0: sl@0: /** Get the Boundary sl@0: @return The boundary of this body part sl@0: */ sl@0: const TDesC8& Boundary(); sl@0: sl@0: /** Gets the Content-Base sl@0: @return The Content-Base of this body part sl@0: */ sl@0: const TDesC8& ContentBase(); sl@0: sl@0: /** Gets the Content-Location sl@0: @return The Content-Location of this body part sl@0: */ sl@0: const TDesC8& ContentLocation(); sl@0: sl@0: /** Gets the Content-Transfer-Encoding sl@0: @return The Content-Transfer-Encoding of this body part sl@0: */ sl@0: const TDesC8& ContentTransferEncoding(); sl@0: sl@0: /** Check if the body is decoded or unzipped sl@0: @return If the body of the body part is decoded or unzipped sl@0: */ sl@0: TBool IsDecodedBody(); sl@0: sl@0: /** Sets the Body sl@0: @param aBody The body to set sl@0: */ sl@0: inline void SetBody( const TDesC8& aBody ) { iBody.Set( aBody ); } sl@0: sl@0: /** Sets the Boundary sl@0: @param aBoundary The boundary to set sl@0: */ sl@0: void SetBoundary( const TDesC8& aBoundary ); sl@0: sl@0: /** Sets the charset sl@0: @param aCharset The charset to set sl@0: */ sl@0: void SetCharset( const TDesC8& aCharset ); sl@0: sl@0: /** Sets the Content-Base sl@0: @param aContentBase The Content-Base to set sl@0: */ sl@0: void SetContentBase( const TDesC8& aContentBase ); sl@0: sl@0: /** Sets the Content-Location sl@0: @param aContentLocation The Content-Location to set sl@0: */ sl@0: void SetContentLocation( const TDesC8& aContentLocation ); sl@0: sl@0: /** Sets the Content-Transfer-Encoding sl@0: @param aContentTransferEncoding The Content-Transfer-Encoding to set sl@0: */ sl@0: void SetContentTransferEncoding( const TDesC8& aContentTransferEncoding ); sl@0: sl@0: /** Set the Content-Type sl@0: @param aContentType The Content-Type to set sl@0: */ sl@0: void SetContentType( const TDesC8& aContentType ); sl@0: sl@0: /** Sets the Content ID sl@0: @param aContentID The content-ID to set sl@0: */ sl@0: void SetContentID( const TDesC8& aContentID ); sl@0: sl@0: /** Sets the headers sl@0: @param aHeaders The headers to set sl@0: */ sl@0: inline void SetHeaders( const TDesC8& aHeaders ) { iHeaders.Set( aHeaders ); } sl@0: sl@0: /** Sets whether the body part is decoded or unzipped sl@0: @param aIsDecodedBody If the body of the body part is decoded or unzipped sl@0: */ sl@0: void SetIsDecodedBody( TBool aIsDecodedBody ); sl@0: sl@0: /** Sets the URL sl@0: * @param aUrl The URL to set sl@0: */ sl@0: void SetUrl( HBufC16* aUrl ); sl@0: sl@0: private: sl@0: sl@0: /** Default constructor */ sl@0: CBodyPart(); sl@0: sl@0: /** 2nd phase constructor */ sl@0: void ConstructL(); sl@0: sl@0: sl@0: private: sl@0: TPtrC8 iBody; sl@0: TPtrC8 iBoundary; sl@0: TPtrC8 iCharset; sl@0: TPtrC8 iContentBase; sl@0: TPtrC8 iContentLocation; sl@0: TPtrC8 iContentTransferEncoding; sl@0: TPtrC8 iContentType; sl@0: TPtrC8 iContentID; sl@0: TPtrC8 iHeaders; sl@0: TBool iIsDecodedBody; // if ETrue, this class is responsible for freeing the memory of iBody sl@0: HBufC16* iUrl; sl@0: }; sl@0: sl@0: #endif // BODYPART_H sl@0: