1MAIL::HEADER::MIME(3x) Cone: COnsole Newsreader And E MAIL::HEADER::MIME(3x)
2
3
4
6 mail::Header::mime - A structured MIME header.
7
9 #include <libmail/headers.H>
10
11 mail::Header::mime content_type("Content-Type", "text/plain");
12
13 content_type.parameters.set_simple("charset", "iso-8859-1");
14
15 mail::Header::mime content_disposition("Content-Disposition", "attachment")
16 ("filename", "document.doc")
17 ("name", "Monthly Sales", "iso-8859-1", "EN");
18
19 std::cout << content_type.toString();
20
21
23 This class creates a structured MIME header. A structured MIME header,
24 like Content-Type or Content-Disposition contains a literal value, and
25 zero or more “name=setting” parameters, separated by semicolons.
26
27 Two arguments are provided to the constructor, the header´s name, and
28 its literal value. After constructing, use the parameters member to set
29 the parameters. This member has the following methods:
30
31 set_simple(std::string name, std::string value)
32 Set parameter name to value. value must contain US-ASCII text
33 only.
34
35 set(std::string name, std::string value, std::string charset,
36 std::string language)
37 Set parameter name to value. charset specifies value´s character
38 set. language is optional, and specifies value´s language. value
39 is converted to US-ASCII text according to RFC 2231[1].
40
41 erase(std::string name)
42 Remove parameter name.
43
44 The toString() returns the header as a single text string: “name:
45 value”. Long headers are folded accordingly.
46
47 Dynamic parameter generation
48 Parameters can also be dynamically populated by repeatedly calling the
49 “()”.
50
51 One version of the “()” operator receives the parameter name and value,
52 and corresponds to the set_simple method. The second version also
53 receives the character set and language information, and corresponds to
54 the set function.
55
57 mail::Header::addresslist(3x), mail::Header::encoded(3x),
58 mail::Header::list(3x), mail::Header::plain(3x).
59
61 1. RFC 2231
62 http://www.rfc-editor.org/rfc/rfc2231.txt
63
64
65
66[FIXME: source] 05/08/2010 MAIL::HEADER::MIME(3x)