Diffstat (limited to 'noncore/net/mail/mailtypes.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/mailtypes.cpp | 90 |
1 files changed, 89 insertions, 1 deletions
diff --git a/noncore/net/mail/mailtypes.cpp b/noncore/net/mail/mailtypes.cpp index 8d9b247..d8a36e7 100644 --- a/noncore/net/mail/mailtypes.cpp +++ b/noncore/net/mail/mailtypes.cpp | |||
@@ -1,3 +1,3 @@ | |||
1 | #include "mailtypes.h" | 1 | #include "mailtypes.h" |
2 | 2 | #include <stdlib.h> | |
3 | 3 | ||
@@ -247 +247,89 @@ const RecPart& RecBody::Description()const | |||
247 | } | 247 | } |
248 | |||
249 | /* handling encoded content */ | ||
250 | encodedString::encodedString() | ||
251 | { | ||
252 | init(); | ||
253 | } | ||
254 | |||
255 | encodedString::encodedString(const char*nContent,unsigned int nSize) | ||
256 | { | ||
257 | init(); | ||
258 | setContent(nContent,nSize); | ||
259 | } | ||
260 | |||
261 | encodedString::encodedString(char*nContent,unsigned int nSize) | ||
262 | { | ||
263 | init(); | ||
264 | setContent(nContent,nSize); | ||
265 | } | ||
266 | |||
267 | encodedString::encodedString(const encodedString&old) | ||
268 | { | ||
269 | init(); | ||
270 | copy_old(old); | ||
271 | qDebug("encodedeString: copy constructor!"); | ||
272 | } | ||
273 | |||
274 | encodedString& encodedString::operator=(const encodedString&old) | ||
275 | { | ||
276 | init(); | ||
277 | copy_old(old); | ||
278 | qDebug("encodedString: assign operator!"); | ||
279 | return *this; | ||
280 | } | ||
281 | |||
282 | encodedString::~encodedString() | ||
283 | { | ||
284 | clean(); | ||
285 | } | ||
286 | |||
287 | void encodedString::init() | ||
288 | { | ||
289 | content = 0; | ||
290 | size = 0; | ||
291 | } | ||
292 | |||
293 | void encodedString::clean() | ||
294 | { | ||
295 | if (content) { | ||
296 | free(content); | ||
297 | } | ||
298 | content = 0; | ||
299 | size = 0; | ||
300 | } | ||
301 | |||
302 | void encodedString::copy_old(const encodedString&old) | ||
303 | { | ||
304 | clean(); | ||
305 | if (old.size>0 && old.content) { | ||
306 | content = (char*)malloc(old.size*sizeof(char)); | ||
307 | memcpy(content,old.content,size); | ||
308 | size = old.size; | ||
309 | } | ||
310 | } | ||
311 | |||
312 | const char*encodedString::Content()const | ||
313 | { | ||
314 | return content; | ||
315 | } | ||
316 | |||
317 | const int encodedString::Length()const | ||
318 | { | ||
319 | return size; | ||
320 | } | ||
321 | |||
322 | void encodedString::setContent(const char*nContent,int nSize) | ||
323 | { | ||
324 | if (nSize>0 && nContent) { | ||
325 | content = (char*)malloc(nSize*sizeof(char)); | ||
326 | memcpy(content,nContent,nSize); | ||
327 | size = nSize; | ||
328 | } | ||
329 | } | ||
330 | |||
331 | void encodedString::setContent(char*nContent,int nSize) | ||
332 | { | ||
333 | content = nContent; | ||
334 | size = nSize; | ||
335 | } | ||