File: autodecoder.C

package info (click to toggle)
cone 0.89-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 25,628 kB
  • ctags: 14,171
  • sloc: ansic: 85,400; cpp: 82,903; sh: 11,713; makefile: 1,732; perl: 832; yacc: 291; sed: 16
file content (67 lines) | stat: -rw-r--r-- 1,038 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
** Copyright 2002-2004, Double Precision Inc.
**
** See COPYING for distribution information.
*/
#include "libmail_config.h"
#include "misc.H"
#include "autodecoder.H"

using namespace std;

mail::autodecoder::base64::base64(mail::autodecoder &meArg)
	: me(meArg)
{
}

mail::autodecoder::base64::~base64()
{
}

void mail::autodecoder::base64::decoded(string s)
{
	me.decoded(s);
}

mail::autodecoder::qp::qp(mail::autodecoder &meArg)
	: me(meArg)
{
}

mail::autodecoder::qp::~qp()
{
}

void mail::autodecoder::qp::decoded(string s)
{
	me.decoded(s);
}

//////////////////////////////////////////////////////////////////////

mail::autodecoder::autodecoder(string cte)
	: base64Decoder(*this),
	  qpDecoder(*this),
	  decoder(NULL)
{
	mail::upper(cte);

	if (cte == "QUOTED-PRINTABLE")
		decoder= &qpDecoder;

	if (cte == "BASE64")
		decoder= &base64Decoder;
}

mail::autodecoder::~autodecoder()
{
}

void mail::autodecoder::decode(string s)
{
	if (decoder)
		decoder->decode(s);	// 7bit or 8bit, or something...
	else
		decoded(s);
}