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