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 "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 * CUniMimeInfo, Storage for objects mime headers. |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef __UNIMIMEINFO_H |
|
22 #define __UNIMIMEINFO_H |
|
23 |
|
24 // INCLUDES |
|
25 |
|
26 #include <cmsvattachment.h> |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 // MACROS |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 |
|
34 // DATA TYPES |
|
35 |
|
36 // FUNCTION PROTOTYPES |
|
37 |
|
38 // CLASS DECLARATION |
|
39 class MMsvAttachmentManager; |
|
40 class CBaseMtm; |
|
41 class CUniDataUtils; |
|
42 |
|
43 /** |
|
44 * CUniMimeInfo - Container for the MIME headers of an attachment. |
|
45 * NOTE no support for X-Type-Params |
|
46 * only support for filename ContentDisposition parameter |
|
47 * only support for charset ContentTypeL parameter |
|
48 * |
|
49 * If some header is not set zero lenght descriptor is returned. |
|
50 * |
|
51 * @lib UniDataModel.lib |
|
52 * @since 3.1 |
|
53 */ |
|
54 class CUniMimeInfo : public CBase |
|
55 { |
|
56 public: |
|
57 |
|
58 /** |
|
59 * Constructor |
|
60 * |
|
61 * @since 3.1 |
|
62 */ |
|
63 CUniMimeInfo(); |
|
64 |
|
65 /** |
|
66 * Destructor |
|
67 * |
|
68 * @since 3.1 |
|
69 */ |
|
70 ~CUniMimeInfo(); |
|
71 |
|
72 // |
|
73 // Accessors/Mutators |
|
74 // |
|
75 |
|
76 /** |
|
77 * SetContentTypeL |
|
78 * NOTE: 8-bit |
|
79 * |
|
80 * @since 3.1 |
|
81 * @param aMimeType IN content type |
|
82 */ |
|
83 void SetContentTypeL( const TDesC8& aMimeType ); |
|
84 |
|
85 /** |
|
86 * ContentType |
|
87 * NOTE: 8-bit |
|
88 * |
|
89 * @since 3.1 |
|
90 * @return pointer to content type buffer |
|
91 */ |
|
92 inline const TPtrC8 ContentType() const; |
|
93 |
|
94 /** |
|
95 * SetCharset |
|
96 * As content type charset parameter |
|
97 * No other content type specific parameters supported |
|
98 * charset = 0 means no charset is set |
|
99 * (0 is IANA reserved number, not allocated currently to any charset.) |
|
100 * |
|
101 * @since 3.1 |
|
102 * @param aCharset IN character set as MIB enumeration |
|
103 */ |
|
104 inline void SetCharset( TUint aCharset ); |
|
105 |
|
106 /** |
|
107 * Charset |
|
108 * As content type charset parameter |
|
109 * No other content type specific parameters supported |
|
110 * charset = 0 means no charset is set |
|
111 * (0 is IANA reserved number, not allocated currently to any charset.) |
|
112 * |
|
113 * @since 3.1 |
|
114 * @return character set MIB enumeration |
|
115 */ |
|
116 inline TUint Charset() const; |
|
117 |
|
118 /** |
|
119 * SetContentTypeL |
|
120 * NOTE: 16-bit |
|
121 * |
|
122 * @since 3.1 |
|
123 * @param aContLoc IN content location |
|
124 */ |
|
125 void SetContentLocationL( const TDesC& aContLoc ); |
|
126 |
|
127 /** |
|
128 * ContentLocation |
|
129 * NOTE: 16-bit |
|
130 * |
|
131 * @since 3.1 |
|
132 * @return pointer to content location buffer |
|
133 */ |
|
134 inline const TPtrC ContentLocation() const; |
|
135 |
|
136 /** |
|
137 * SetContentIdL |
|
138 * NOTE: 8-bit |
|
139 * |
|
140 * @since 3.1 |
|
141 * @param aCid IN content id |
|
142 */ |
|
143 void SetContentIdL( const TDesC8& aCid ); |
|
144 |
|
145 /** |
|
146 * ContentId |
|
147 * NOTE: 8-bit |
|
148 * |
|
149 * @since 3.1 |
|
150 * @return pointer to content id buffer |
|
151 */ |
|
152 inline const TPtrC8 ContentId() const; |
|
153 |
|
154 /** |
|
155 * SetContentBaseL |
|
156 * NOTE: 8-bit |
|
157 * |
|
158 * @since 3.1 |
|
159 * @param aContBase IN content base |
|
160 */ |
|
161 void SetContentBaseL( const TDesC8& aContBase ); |
|
162 |
|
163 /** |
|
164 * ContentBase |
|
165 * NOTE: 8-bit |
|
166 * |
|
167 * @since 3.1 |
|
168 * @return pointer to content base buffer |
|
169 */ |
|
170 inline const TPtrC8 ContentBase() const; |
|
171 |
|
172 /** |
|
173 * SetContentDescriptionL |
|
174 * NOTE: 8-bit |
|
175 * |
|
176 * @since 3.1 |
|
177 * @param aContDesc IN content description |
|
178 */ |
|
179 void SetContentDescriptionL( const TDesC8& aContDesc ); |
|
180 |
|
181 /** |
|
182 * ContentDescription |
|
183 * NOTE: 8-bit |
|
184 * |
|
185 * @since 3.1 |
|
186 * @return pointer to content description buffer |
|
187 */ |
|
188 inline const TPtrC8 ContentDescription() const; |
|
189 |
|
190 /** |
|
191 * SetContentDispositionL |
|
192 * NOTE: 8-bit |
|
193 * |
|
194 * @since 3.1 |
|
195 * @param aContDesc IN content disposition |
|
196 */ |
|
197 void SetContentDispositionL( const TDesC8& aContDisp ); |
|
198 |
|
199 /** |
|
200 * ContentDisposition |
|
201 * NOTE: 8-bit |
|
202 * |
|
203 * @since 3.1 |
|
204 * @return pointer to content disposition buffer |
|
205 */ |
|
206 inline const TPtrC8 ContentDisposition() const; |
|
207 |
|
208 /** |
|
209 * Size |
|
210 * |
|
211 * @since 3.1 |
|
212 * @return size of the mime headers in bytes |
|
213 */ |
|
214 TInt Size() const; |
|
215 |
|
216 /** |
|
217 * SaveMimeInfoL |
|
218 * Save objects mime info into message store |
|
219 * |
|
220 * @since 3.1 |
|
221 * @param aManager IN reference to attachment manager |
|
222 * @param aAttachment IN reference to attachment |
|
223 */ |
|
224 void SaveMimeInfoL( MMsvAttachmentManager& aManager, CMsvAttachment& aAttachment ); |
|
225 |
|
226 /** |
|
227 * ReadMimeInfoL |
|
228 * Reads attachments mime info from message store |
|
229 * |
|
230 * @since 3.1 |
|
231 * @param aAttachment IN reference to attachment |
|
232 */ |
|
233 void ReadMimeInfoL( CMsvAttachment& aAttachment ); |
|
234 |
|
235 /** |
|
236 * EnsureContentLocationL |
|
237 * Make sure that ContentLocation exists. In case it |
|
238 * doesn't one is created from the file name. |
|
239 * |
|
240 * @since 3.1 |
|
241 * @param aManager IN reference to attachment manager |
|
242 * @param aAttachment IN reference to attachment |
|
243 * @param aPlainFileName IN attachment file name |
|
244 */ |
|
245 void EnsureContentLocationL( |
|
246 MMsvAttachmentManager& aManager, |
|
247 CMsvAttachment& aAttachment, |
|
248 TDesC& aPlainFileName ); |
|
249 |
|
250 private: // data |
|
251 |
|
252 HBufC8* iContentDescription; |
|
253 |
|
254 HBufC8* iContentBase; |
|
255 HBufC16* iContentLocation; |
|
256 HBufC8* iContentId; |
|
257 |
|
258 HBufC8* iContentType; |
|
259 TUint iContentTypeCharset; // As MIB enum. |
|
260 |
|
261 HBufC8* iContentDisposition; |
|
262 }; |
|
263 |
|
264 #include <UniMimeInfo.inl> |
|
265 |
|
266 #endif //__UNIMIMEINFO_H |
|
267 |
|
268 |
|
269 |
|