sl@0
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
// INCLUDE FILES
|
sl@0
|
17 |
#include <bafl/bodypart.h>
|
sl@0
|
18 |
|
sl@0
|
19 |
// CONSTANTS
|
sl@0
|
20 |
|
sl@0
|
21 |
// ============================= LOCAL FUNCTIONS ===============================
|
sl@0
|
22 |
|
sl@0
|
23 |
// ============================ MEMBER FUNCTIONS ===============================
|
sl@0
|
24 |
|
sl@0
|
25 |
// -----------------------------------------------------------------------------
|
sl@0
|
26 |
// CBodyPart::NewL
|
sl@0
|
27 |
// Two-phased constructor.
|
sl@0
|
28 |
// -----------------------------------------------------------------------------
|
sl@0
|
29 |
//
|
sl@0
|
30 |
EXPORT_C CBodyPart* CBodyPart::NewL()
|
sl@0
|
31 |
{
|
sl@0
|
32 |
CBodyPart* self = new (ELeave) CBodyPart();
|
sl@0
|
33 |
CleanupStack::PushL(self);
|
sl@0
|
34 |
self->ConstructL();
|
sl@0
|
35 |
CleanupStack::Pop(); //self
|
sl@0
|
36 |
|
sl@0
|
37 |
return self;
|
sl@0
|
38 |
}
|
sl@0
|
39 |
|
sl@0
|
40 |
// -----------------------------------------------------------------------------
|
sl@0
|
41 |
// C++ default constructor.
|
sl@0
|
42 |
// -----------------------------------------------------------------------------
|
sl@0
|
43 |
CBodyPart::CBodyPart()
|
sl@0
|
44 |
{
|
sl@0
|
45 |
iBody.Set( NULL, 0 );
|
sl@0
|
46 |
iBoundary.Set( NULL, 0 );
|
sl@0
|
47 |
iCharset.Set( NULL, 0 );
|
sl@0
|
48 |
iContentBase.Set( NULL, 0 );
|
sl@0
|
49 |
iContentLocation.Set( NULL, 0 );
|
sl@0
|
50 |
iContentTransferEncoding.Set( NULL, 0 );
|
sl@0
|
51 |
iContentType.Set( NULL, 0 );
|
sl@0
|
52 |
iContentID.Set( NULL, 0 );
|
sl@0
|
53 |
iIsDecodedBody = EFalse;
|
sl@0
|
54 |
iUrl = NULL;
|
sl@0
|
55 |
}
|
sl@0
|
56 |
|
sl@0
|
57 |
// -----------------------------------------------------------------------------
|
sl@0
|
58 |
// Symbian 2nd phase constructor
|
sl@0
|
59 |
// -----------------------------------------------------------------------------
|
sl@0
|
60 |
void CBodyPart::ConstructL()
|
sl@0
|
61 |
{
|
sl@0
|
62 |
}
|
sl@0
|
63 |
|
sl@0
|
64 |
// -----------------------------------------------------------------------------
|
sl@0
|
65 |
// Destructor.
|
sl@0
|
66 |
// -----------------------------------------------------------------------------
|
sl@0
|
67 |
EXPORT_C CBodyPart::~CBodyPart()
|
sl@0
|
68 |
{
|
sl@0
|
69 |
if( iIsDecodedBody )
|
sl@0
|
70 |
{
|
sl@0
|
71 |
delete (TUint8*) iBody.Ptr();
|
sl@0
|
72 |
}
|
sl@0
|
73 |
|
sl@0
|
74 |
delete iUrl;
|
sl@0
|
75 |
}
|
sl@0
|
76 |
|
sl@0
|
77 |
// -----------------------------------------------------------------------------
|
sl@0
|
78 |
// return The content-base of this body part
|
sl@0
|
79 |
// -----------------------------------------------------------------------------
|
sl@0
|
80 |
const TDesC8& CBodyPart::ContentBase()
|
sl@0
|
81 |
{
|
sl@0
|
82 |
return iContentBase;
|
sl@0
|
83 |
}
|
sl@0
|
84 |
|
sl@0
|
85 |
// -----------------------------------------------------------------------------
|
sl@0
|
86 |
// return The content-location of this body part
|
sl@0
|
87 |
// -----------------------------------------------------------------------------
|
sl@0
|
88 |
const TDesC8& CBodyPart::ContentLocation()
|
sl@0
|
89 |
{
|
sl@0
|
90 |
return iContentLocation;
|
sl@0
|
91 |
}
|
sl@0
|
92 |
|
sl@0
|
93 |
// -----------------------------------------------------------------------------
|
sl@0
|
94 |
// return The content-transfer-encoding of this body part
|
sl@0
|
95 |
// -----------------------------------------------------------------------------
|
sl@0
|
96 |
const TDesC8& CBodyPart::ContentTransferEncoding()
|
sl@0
|
97 |
{
|
sl@0
|
98 |
return iContentTransferEncoding;
|
sl@0
|
99 |
}
|
sl@0
|
100 |
|
sl@0
|
101 |
// -----------------------------------------------------------------------------
|
sl@0
|
102 |
// return The boundary of this body part
|
sl@0
|
103 |
// -----------------------------------------------------------------------------
|
sl@0
|
104 |
const TDesC8& CBodyPart::Boundary()
|
sl@0
|
105 |
{
|
sl@0
|
106 |
return iBoundary;
|
sl@0
|
107 |
}
|
sl@0
|
108 |
|
sl@0
|
109 |
// -----------------------------------------------------------------------------
|
sl@0
|
110 |
// return If the body of the body part is decoded or unzipped
|
sl@0
|
111 |
// -----------------------------------------------------------------------------
|
sl@0
|
112 |
TBool CBodyPart::IsDecodedBody()
|
sl@0
|
113 |
{
|
sl@0
|
114 |
return iIsDecodedBody;
|
sl@0
|
115 |
}
|
sl@0
|
116 |
|
sl@0
|
117 |
// -----------------------------------------------------------------------------
|
sl@0
|
118 |
// Set the boundary of the body part
|
sl@0
|
119 |
// -----------------------------------------------------------------------------
|
sl@0
|
120 |
void CBodyPart::SetBoundary( const TDesC8& aBoundary )
|
sl@0
|
121 |
{
|
sl@0
|
122 |
iBoundary.Set( aBoundary );
|
sl@0
|
123 |
}
|
sl@0
|
124 |
|
sl@0
|
125 |
// -----------------------------------------------------------------------------
|
sl@0
|
126 |
// Set the charset of the body part
|
sl@0
|
127 |
// -----------------------------------------------------------------------------
|
sl@0
|
128 |
void CBodyPart::SetCharset( const TDesC8& aCharset )
|
sl@0
|
129 |
{
|
sl@0
|
130 |
iCharset.Set( aCharset );
|
sl@0
|
131 |
}
|
sl@0
|
132 |
|
sl@0
|
133 |
// -----------------------------------------------------------------------------
|
sl@0
|
134 |
// Set the content-base of the body part
|
sl@0
|
135 |
// -----------------------------------------------------------------------------
|
sl@0
|
136 |
void CBodyPart::SetContentBase( const TDesC8& aContentBase )
|
sl@0
|
137 |
{
|
sl@0
|
138 |
iContentBase.Set( aContentBase );
|
sl@0
|
139 |
}
|
sl@0
|
140 |
|
sl@0
|
141 |
// -----------------------------------------------------------------------------
|
sl@0
|
142 |
// Set the content-location of the body part
|
sl@0
|
143 |
// -----------------------------------------------------------------------------
|
sl@0
|
144 |
void CBodyPart::SetContentLocation( const TDesC8& aContentLocation )
|
sl@0
|
145 |
{
|
sl@0
|
146 |
iContentLocation.Set( aContentLocation );
|
sl@0
|
147 |
}
|
sl@0
|
148 |
|
sl@0
|
149 |
// -----------------------------------------------------------------------------
|
sl@0
|
150 |
// Set the content-transfer-encoding of the body part
|
sl@0
|
151 |
// -----------------------------------------------------------------------------
|
sl@0
|
152 |
void CBodyPart::SetContentTransferEncoding( const TDesC8& aContentTransferEncoding )
|
sl@0
|
153 |
{
|
sl@0
|
154 |
iContentTransferEncoding.Set( aContentTransferEncoding );
|
sl@0
|
155 |
}
|
sl@0
|
156 |
|
sl@0
|
157 |
// -----------------------------------------------------------------------------
|
sl@0
|
158 |
// Set the content-type of the body part
|
sl@0
|
159 |
// -----------------------------------------------------------------------------
|
sl@0
|
160 |
void CBodyPart::SetContentType( const TDesC8& aContentType )
|
sl@0
|
161 |
{
|
sl@0
|
162 |
iContentType.Set( aContentType );
|
sl@0
|
163 |
}
|
sl@0
|
164 |
|
sl@0
|
165 |
// -----------------------------------------------------------------------------
|
sl@0
|
166 |
// Set the content-ID of the body part
|
sl@0
|
167 |
// -----------------------------------------------------------------------------
|
sl@0
|
168 |
void CBodyPart::SetContentID( const TDesC8& aContentID )
|
sl@0
|
169 |
{
|
sl@0
|
170 |
iContentID.Set( aContentID );
|
sl@0
|
171 |
}
|
sl@0
|
172 |
|
sl@0
|
173 |
// -----------------------------------------------------------------------------
|
sl@0
|
174 |
// Set if the body of the body part is decoded or unzipped
|
sl@0
|
175 |
// -----------------------------------------------------------------------------
|
sl@0
|
176 |
void CBodyPart::SetIsDecodedBody( TBool aIsDecodedBody )
|
sl@0
|
177 |
{
|
sl@0
|
178 |
iIsDecodedBody = aIsDecodedBody;
|
sl@0
|
179 |
}
|
sl@0
|
180 |
|
sl@0
|
181 |
// -----------------------------------------------------------------------------
|
sl@0
|
182 |
// Set the URL of the body part
|
sl@0
|
183 |
// -----------------------------------------------------------------------------
|
sl@0
|
184 |
void CBodyPart::SetUrl( HBufC16* aUrl )
|
sl@0
|
185 |
{
|
sl@0
|
186 |
iUrl = aUrl;
|
sl@0
|
187 |
}
|
sl@0
|
188 |
|
sl@0
|
189 |
|