1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/lowlevellibsandfws/apputils/multipartparser/src/bodypart.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,189 @@
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 +//
1.18 +
1.19 +// INCLUDE FILES
1.20 +#include <bafl/bodypart.h>
1.21 +
1.22 +// CONSTANTS
1.23 +
1.24 +// ============================= LOCAL FUNCTIONS ===============================
1.25 +
1.26 +// ============================ MEMBER FUNCTIONS ===============================
1.27 +
1.28 +// -----------------------------------------------------------------------------
1.29 +// CBodyPart::NewL
1.30 +// Two-phased constructor.
1.31 +// -----------------------------------------------------------------------------
1.32 +//
1.33 +EXPORT_C CBodyPart* CBodyPart::NewL()
1.34 + {
1.35 + CBodyPart* self = new (ELeave) CBodyPart();
1.36 + CleanupStack::PushL(self);
1.37 + self->ConstructL();
1.38 + CleanupStack::Pop(); //self
1.39 +
1.40 + return self;
1.41 + }
1.42 +
1.43 +// -----------------------------------------------------------------------------
1.44 +// C++ default constructor.
1.45 +// -----------------------------------------------------------------------------
1.46 +CBodyPart::CBodyPart()
1.47 + {
1.48 + iBody.Set( NULL, 0 );
1.49 + iBoundary.Set( NULL, 0 );
1.50 + iCharset.Set( NULL, 0 );
1.51 + iContentBase.Set( NULL, 0 );
1.52 + iContentLocation.Set( NULL, 0 );
1.53 + iContentTransferEncoding.Set( NULL, 0 );
1.54 + iContentType.Set( NULL, 0 );
1.55 + iContentID.Set( NULL, 0 );
1.56 + iIsDecodedBody = EFalse;
1.57 + iUrl = NULL;
1.58 + }
1.59 +
1.60 +// -----------------------------------------------------------------------------
1.61 +// Symbian 2nd phase constructor
1.62 +// -----------------------------------------------------------------------------
1.63 +void CBodyPart::ConstructL()
1.64 + {
1.65 + }
1.66 +
1.67 +// -----------------------------------------------------------------------------
1.68 +// Destructor.
1.69 +// -----------------------------------------------------------------------------
1.70 +EXPORT_C CBodyPart::~CBodyPart()
1.71 + {
1.72 + if( iIsDecodedBody )
1.73 + {
1.74 + delete (TUint8*) iBody.Ptr();
1.75 + }
1.76 +
1.77 + delete iUrl;
1.78 + }
1.79 +
1.80 +// -----------------------------------------------------------------------------
1.81 +// return The content-base of this body part
1.82 +// -----------------------------------------------------------------------------
1.83 +const TDesC8& CBodyPart::ContentBase()
1.84 + {
1.85 + return iContentBase;
1.86 + }
1.87 +
1.88 +// -----------------------------------------------------------------------------
1.89 +// return The content-location of this body part
1.90 +// -----------------------------------------------------------------------------
1.91 +const TDesC8& CBodyPart::ContentLocation()
1.92 + {
1.93 + return iContentLocation;
1.94 + }
1.95 +
1.96 +// -----------------------------------------------------------------------------
1.97 +// return The content-transfer-encoding of this body part
1.98 +// -----------------------------------------------------------------------------
1.99 +const TDesC8& CBodyPart::ContentTransferEncoding()
1.100 + {
1.101 + return iContentTransferEncoding;
1.102 + }
1.103 +
1.104 +// -----------------------------------------------------------------------------
1.105 +// return The boundary of this body part
1.106 +// -----------------------------------------------------------------------------
1.107 +const TDesC8& CBodyPart::Boundary()
1.108 + {
1.109 + return iBoundary;
1.110 + }
1.111 +
1.112 +// -----------------------------------------------------------------------------
1.113 +// return If the body of the body part is decoded or unzipped
1.114 +// -----------------------------------------------------------------------------
1.115 +TBool CBodyPart::IsDecodedBody()
1.116 + {
1.117 + return iIsDecodedBody;
1.118 + }
1.119 +
1.120 +// -----------------------------------------------------------------------------
1.121 +// Set the boundary of the body part
1.122 +// -----------------------------------------------------------------------------
1.123 +void CBodyPart::SetBoundary( const TDesC8& aBoundary )
1.124 + {
1.125 + iBoundary.Set( aBoundary );
1.126 + }
1.127 +
1.128 +// -----------------------------------------------------------------------------
1.129 +// Set the charset of the body part
1.130 +// -----------------------------------------------------------------------------
1.131 +void CBodyPart::SetCharset( const TDesC8& aCharset )
1.132 + {
1.133 + iCharset.Set( aCharset );
1.134 + }
1.135 +
1.136 +// -----------------------------------------------------------------------------
1.137 +// Set the content-base of the body part
1.138 +// -----------------------------------------------------------------------------
1.139 +void CBodyPart::SetContentBase( const TDesC8& aContentBase )
1.140 + {
1.141 + iContentBase.Set( aContentBase );
1.142 + }
1.143 +
1.144 +// -----------------------------------------------------------------------------
1.145 +// Set the content-location of the body part
1.146 +// -----------------------------------------------------------------------------
1.147 +void CBodyPart::SetContentLocation( const TDesC8& aContentLocation )
1.148 + {
1.149 + iContentLocation.Set( aContentLocation );
1.150 + }
1.151 +
1.152 +// -----------------------------------------------------------------------------
1.153 +// Set the content-transfer-encoding of the body part
1.154 +// -----------------------------------------------------------------------------
1.155 +void CBodyPart::SetContentTransferEncoding( const TDesC8& aContentTransferEncoding )
1.156 + {
1.157 + iContentTransferEncoding.Set( aContentTransferEncoding );
1.158 + }
1.159 +
1.160 +// -----------------------------------------------------------------------------
1.161 +// Set the content-type of the body part
1.162 +// -----------------------------------------------------------------------------
1.163 +void CBodyPart::SetContentType( const TDesC8& aContentType )
1.164 + {
1.165 + iContentType.Set( aContentType );
1.166 + }
1.167 +
1.168 +// -----------------------------------------------------------------------------
1.169 +// Set the content-ID of the body part
1.170 +// -----------------------------------------------------------------------------
1.171 +void CBodyPart::SetContentID( const TDesC8& aContentID )
1.172 + {
1.173 + iContentID.Set( aContentID );
1.174 + }
1.175 +
1.176 +// -----------------------------------------------------------------------------
1.177 +// Set if the body of the body part is decoded or unzipped
1.178 +// -----------------------------------------------------------------------------
1.179 +void CBodyPart::SetIsDecodedBody( TBool aIsDecodedBody )
1.180 + {
1.181 + iIsDecodedBody = aIsDecodedBody;
1.182 + }
1.183 +
1.184 +// -----------------------------------------------------------------------------
1.185 +// Set the URL of the body part
1.186 +// -----------------------------------------------------------------------------
1.187 +void CBodyPart::SetUrl( HBufC16* aUrl )
1.188 + {
1.189 + iUrl = aUrl;
1.190 + }
1.191 +
1.192 +