First public contribution.
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 #include <bafl/bodypart.h>
21 // ============================= LOCAL FUNCTIONS ===============================
23 // ============================ MEMBER FUNCTIONS ===============================
25 // -----------------------------------------------------------------------------
27 // Two-phased constructor.
28 // -----------------------------------------------------------------------------
30 EXPORT_C CBodyPart* CBodyPart::NewL()
32 CBodyPart* self = new (ELeave) CBodyPart();
33 CleanupStack::PushL(self);
35 CleanupStack::Pop(); //self
40 // -----------------------------------------------------------------------------
41 // C++ default constructor.
42 // -----------------------------------------------------------------------------
43 CBodyPart::CBodyPart()
46 iBoundary.Set( NULL, 0 );
47 iCharset.Set( NULL, 0 );
48 iContentBase.Set( NULL, 0 );
49 iContentLocation.Set( NULL, 0 );
50 iContentTransferEncoding.Set( NULL, 0 );
51 iContentType.Set( NULL, 0 );
52 iContentID.Set( NULL, 0 );
53 iIsDecodedBody = EFalse;
57 // -----------------------------------------------------------------------------
58 // Symbian 2nd phase constructor
59 // -----------------------------------------------------------------------------
60 void CBodyPart::ConstructL()
64 // -----------------------------------------------------------------------------
66 // -----------------------------------------------------------------------------
67 EXPORT_C CBodyPart::~CBodyPart()
71 delete (TUint8*) iBody.Ptr();
77 // -----------------------------------------------------------------------------
78 // return The content-base of this body part
79 // -----------------------------------------------------------------------------
80 const TDesC8& CBodyPart::ContentBase()
85 // -----------------------------------------------------------------------------
86 // return The content-location of this body part
87 // -----------------------------------------------------------------------------
88 const TDesC8& CBodyPart::ContentLocation()
90 return iContentLocation;
93 // -----------------------------------------------------------------------------
94 // return The content-transfer-encoding of this body part
95 // -----------------------------------------------------------------------------
96 const TDesC8& CBodyPart::ContentTransferEncoding()
98 return iContentTransferEncoding;
101 // -----------------------------------------------------------------------------
102 // return The boundary of this body part
103 // -----------------------------------------------------------------------------
104 const TDesC8& CBodyPart::Boundary()
109 // -----------------------------------------------------------------------------
110 // return If the body of the body part is decoded or unzipped
111 // -----------------------------------------------------------------------------
112 TBool CBodyPart::IsDecodedBody()
114 return iIsDecodedBody;
117 // -----------------------------------------------------------------------------
118 // Set the boundary of the body part
119 // -----------------------------------------------------------------------------
120 void CBodyPart::SetBoundary( const TDesC8& aBoundary )
122 iBoundary.Set( aBoundary );
125 // -----------------------------------------------------------------------------
126 // Set the charset of the body part
127 // -----------------------------------------------------------------------------
128 void CBodyPart::SetCharset( const TDesC8& aCharset )
130 iCharset.Set( aCharset );
133 // -----------------------------------------------------------------------------
134 // Set the content-base of the body part
135 // -----------------------------------------------------------------------------
136 void CBodyPart::SetContentBase( const TDesC8& aContentBase )
138 iContentBase.Set( aContentBase );
141 // -----------------------------------------------------------------------------
142 // Set the content-location of the body part
143 // -----------------------------------------------------------------------------
144 void CBodyPart::SetContentLocation( const TDesC8& aContentLocation )
146 iContentLocation.Set( aContentLocation );
149 // -----------------------------------------------------------------------------
150 // Set the content-transfer-encoding of the body part
151 // -----------------------------------------------------------------------------
152 void CBodyPart::SetContentTransferEncoding( const TDesC8& aContentTransferEncoding )
154 iContentTransferEncoding.Set( aContentTransferEncoding );
157 // -----------------------------------------------------------------------------
158 // Set the content-type of the body part
159 // -----------------------------------------------------------------------------
160 void CBodyPart::SetContentType( const TDesC8& aContentType )
162 iContentType.Set( aContentType );
165 // -----------------------------------------------------------------------------
166 // Set the content-ID of the body part
167 // -----------------------------------------------------------------------------
168 void CBodyPart::SetContentID( const TDesC8& aContentID )
170 iContentID.Set( aContentID );
173 // -----------------------------------------------------------------------------
174 // Set if the body of the body part is decoded or unzipped
175 // -----------------------------------------------------------------------------
176 void CBodyPart::SetIsDecodedBody( TBool aIsDecodedBody )
178 iIsDecodedBody = aIsDecodedBody;
181 // -----------------------------------------------------------------------------
182 // Set the URL of the body part
183 // -----------------------------------------------------------------------------
184 void CBodyPart::SetUrl( HBufC16* aUrl )