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: // sl@0: sl@0: // INCLUDE FILES sl@0: #include sl@0: sl@0: // CONSTANTS sl@0: sl@0: // ============================= LOCAL FUNCTIONS =============================== sl@0: sl@0: // ============================ MEMBER FUNCTIONS =============================== sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // CBodyPart::NewL sl@0: // Two-phased constructor. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C CBodyPart* CBodyPart::NewL() sl@0: { sl@0: CBodyPart* self = new (ELeave) CBodyPart(); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(); //self sl@0: sl@0: return self; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // C++ default constructor. sl@0: // ----------------------------------------------------------------------------- sl@0: CBodyPart::CBodyPart() sl@0: { sl@0: iBody.Set( NULL, 0 ); sl@0: iBoundary.Set( NULL, 0 ); sl@0: iCharset.Set( NULL, 0 ); sl@0: iContentBase.Set( NULL, 0 ); sl@0: iContentLocation.Set( NULL, 0 ); sl@0: iContentTransferEncoding.Set( NULL, 0 ); sl@0: iContentType.Set( NULL, 0 ); sl@0: iContentID.Set( NULL, 0 ); sl@0: iIsDecodedBody = EFalse; sl@0: iUrl = NULL; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Symbian 2nd phase constructor sl@0: // ----------------------------------------------------------------------------- sl@0: void CBodyPart::ConstructL() sl@0: { sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Destructor. sl@0: // ----------------------------------------------------------------------------- sl@0: EXPORT_C CBodyPart::~CBodyPart() sl@0: { sl@0: if( iIsDecodedBody ) sl@0: { sl@0: delete (TUint8*) iBody.Ptr(); sl@0: } sl@0: sl@0: delete iUrl; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // return The content-base of this body part sl@0: // ----------------------------------------------------------------------------- sl@0: const TDesC8& CBodyPart::ContentBase() sl@0: { sl@0: return iContentBase; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // return The content-location of this body part sl@0: // ----------------------------------------------------------------------------- sl@0: const TDesC8& CBodyPart::ContentLocation() sl@0: { sl@0: return iContentLocation; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // return The content-transfer-encoding of this body part sl@0: // ----------------------------------------------------------------------------- sl@0: const TDesC8& CBodyPart::ContentTransferEncoding() sl@0: { sl@0: return iContentTransferEncoding; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // return The boundary of this body part sl@0: // ----------------------------------------------------------------------------- sl@0: const TDesC8& CBodyPart::Boundary() sl@0: { sl@0: return iBoundary; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // return If the body of the body part is decoded or unzipped sl@0: // ----------------------------------------------------------------------------- sl@0: TBool CBodyPart::IsDecodedBody() sl@0: { sl@0: return iIsDecodedBody; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Set the boundary of the body part sl@0: // ----------------------------------------------------------------------------- sl@0: void CBodyPart::SetBoundary( const TDesC8& aBoundary ) sl@0: { sl@0: iBoundary.Set( aBoundary ); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Set the charset of the body part sl@0: // ----------------------------------------------------------------------------- sl@0: void CBodyPart::SetCharset( const TDesC8& aCharset ) sl@0: { sl@0: iCharset.Set( aCharset ); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Set the content-base of the body part sl@0: // ----------------------------------------------------------------------------- sl@0: void CBodyPart::SetContentBase( const TDesC8& aContentBase ) sl@0: { sl@0: iContentBase.Set( aContentBase ); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Set the content-location of the body part sl@0: // ----------------------------------------------------------------------------- sl@0: void CBodyPart::SetContentLocation( const TDesC8& aContentLocation ) sl@0: { sl@0: iContentLocation.Set( aContentLocation ); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Set the content-transfer-encoding of the body part sl@0: // ----------------------------------------------------------------------------- sl@0: void CBodyPart::SetContentTransferEncoding( const TDesC8& aContentTransferEncoding ) sl@0: { sl@0: iContentTransferEncoding.Set( aContentTransferEncoding ); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Set the content-type of the body part sl@0: // ----------------------------------------------------------------------------- sl@0: void CBodyPart::SetContentType( const TDesC8& aContentType ) sl@0: { sl@0: iContentType.Set( aContentType ); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Set the content-ID of the body part sl@0: // ----------------------------------------------------------------------------- sl@0: void CBodyPart::SetContentID( const TDesC8& aContentID ) sl@0: { sl@0: iContentID.Set( aContentID ); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Set if the body of the body part is decoded or unzipped sl@0: // ----------------------------------------------------------------------------- sl@0: void CBodyPart::SetIsDecodedBody( TBool aIsDecodedBody ) sl@0: { sl@0: iIsDecodedBody = aIsDecodedBody; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Set the URL of the body part sl@0: // ----------------------------------------------------------------------------- sl@0: void CBodyPart::SetUrl( HBufC16* aUrl ) sl@0: { sl@0: iUrl = aUrl; sl@0: } sl@0: sl@0: