|
a/src/utils/mimeparse.h |
|
b/src/utils/mimeparse.h |
1 |
#ifndef _MIME_H_INCLUDED_
|
1 |
#ifndef _MIME_H_INCLUDED_
|
2 |
#define _MIME_H_INCLUDED_
|
2 |
#define _MIME_H_INCLUDED_
|
3 |
/* @(#$Id: mimeparse.h,v 1.3 2005-10-15 12:18:04 dockes Exp $ (C) 2004 J.F.Dockes */
|
3 |
/* @(#$Id: mimeparse.h,v 1.4 2006-01-17 10:08:51 dockes Exp $ (C) 2004 J.F.Dockes */
|
4 |
|
4 |
|
5 |
#include <string>
|
5 |
#include <string>
|
6 |
#include <map>
|
6 |
#include <map>
|
7 |
|
7 |
|
8 |
// Simple (no quoting) mime value parser. Input: "value; pn1=pv1; pn2=pv2
|
8 |
#include "base64.h"
|
|
|
9 |
|
|
|
10 |
/** A class to represent a MIME header value with parameters */
|
9 |
class MimeHeaderValue {
|
11 |
class MimeHeaderValue {
|
10 |
public:
|
12 |
public:
|
11 |
std::string value;
|
13 |
std::string value;
|
12 |
std::map<std::string, std::string> params;
|
14 |
std::map<std::string, std::string> params;
|
13 |
};
|
15 |
};
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* Parse MIME Content-type and Content-disposition value
|
|
|
19 |
*
|
|
|
20 |
* @param in the input string should be like: value; pn1=pv1; pn2=pv2.
|
|
|
21 |
* Example: text/plain; charset="iso-8859-1"
|
|
|
22 |
*/
|
14 |
extern bool parseMimeHeaderValue(const std::string& in, MimeHeaderValue& psd);
|
23 |
extern bool parseMimeHeaderValue(const std::string& in, MimeHeaderValue& psd);
|
15 |
|
24 |
|
|
|
25 |
/** Quoted printable decoding */
|
16 |
bool qp_decode(const std::string& in, std::string &out);
|
26 |
extern bool qp_decode(const std::string& in, std::string &out);
|
17 |
bool base64_decode(const std::string& in, std::string &out);
|
27 |
|
|
|
28 |
/** Decode an Internet mail header value encoded according to rfc2047
|
|
|
29 |
*
|
|
|
30 |
* Example input: =?iso-8859-1?Q?RE=A0=3A_Smoke_Tests?=
|
|
|
31 |
* @param in input string, ascii with rfc2047 markup
|
|
|
32 |
* @return out output string encoded in utf-8
|
|
|
33 |
*/
|
18 |
bool rfc2047_decode(const std::string& in, std::string &out);
|
34 |
extern bool rfc2047_decode(const std::string& in, std::string &out);
|
19 |
|
35 |
|
20 |
#endif /* _MIME_H_INCLUDED_ */
|
36 |
#endif /* _MIME_H_INCLUDED_ */
|