Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions |
The QMailMessageHeaderField class encapsulates the parsing of message header fields. More...
#include <QMailMessageHeaderField>
This class is under development and is subject to change.
Inherited by QMailMessageContentDisposition and QMailMessageContentType.
The QMailMessageHeaderField class encapsulates the parsing of message header fields.
QMailMessageHeaderField provides simplified access to the various components of the header field, and allows the field content to be extracted in a standardized form.
The content of a header field may be formed of unstructured text, or it may have an internal structure. If a structured field is specified, QMailMessageHeaderField assumes that the contained header field is structured in a format equivalent to that used for the RFC 2045 'Content-Type' and RFC 2183 'Content-Disposition' header fields. If the field is unstructured, or conforms to a different structure, then the parameter() and parameters() functions will return empty results, and the setParameter() function will have no effect.
QMailMessageHeaderField contains static functions to assist in creating correct header field content, and presenting header field content. The encodeWord() and decodeWord() functions translate between plain text and the encoded-word specification defined in RFC 2045. The encodeParameter() and decodeParameter() functions translate between plain text and the encoded-parameter format defined in RFC 2231.
The removeWhitespace() function can be used to remove irrelevant whitespace characters from a string, and the removeComments() function can remove any comment sequences present, encododed according to the RFC 2822 specification.
This enum type is used to describe the formatting of field content.
Constant | Value | Description |
---|---|---|
QMailMessageHeaderField::StructuredField | 1 | The field content should be parsed assuming it is structured according to the specification for RFC 2045 'Content-Type' fields. |
QMailMessageHeaderField::UnstructuredField | 2 | The field content has no internal structure. |
Creates an uninitialised message header field object.
Creates a message header field object from the data in text. If fieldType is QMailMessageHeaderField::StructuredField, then text will be parsed assuming a format equivalent to that used for the RFC 2045 'Content-Type' and RFC 2183 'Content-Disposition' header fields.
Creates a message header field object with the field id id and the content data in text. If fieldType is QMailMessageHeaderField::StructuredField, then text will be parsed assuming a format equivalent to that used for the RFC 2045 'Content-Type' and RFC 2183 'Content-Disposition' header fields.
Returns the content of the header field, without any associated parameters.
See also setContent().
Returns the content of input, decoding any encountered RFC 2045 'encoded-word' format tokens to unicode.
Returns the content of input decoded from RFC 2231 'extended-parameter' format.
Returns the content of input decoded from RFC 2045 'encoded-word' format.
Returns the content of the header field as unicode text. If the content of the field contains any encoded-word or encoded-parameter values, they will be decoded on output.
Returns the content of the string input encoded into a sequence of RFC 2045 'encoded-word' format tokens. The encoding used can be specified in charset, or can be deduced for each token read from input if charset is empty.
Returns the content of the string input encoded into RFC 2231 'extended-parameter' format. The encoding used can be specified in charset, or can be deduced from the content of input if charset is empty. If language is non-empty, it will be included in the encoded output; otherwise the language component will be extracted from charset, if it contains a trailing language specifier as defined in RFC 2231.
Returns the content of the string input encoded into a series of RFC 2045 'encoded-word' format tokens, each no longer than 75 characters. The encoding used can be specified in charset, or can be deduced from the content of input if charset is empty.
Returns the ID of the header field.
See also setId().
Returns true if the header field has not been initialized.
Returns true if the parameter with name name exists and is marked as encoded according to RFC 2231; otherwise returns false. Name comparisons are case-insensitive.
Returns the value of the parameter with the name name. Name comparisons are case-insensitive.
See also setParameter().
Returns the list of parameters from the header field. For each parameter, the member first contains the name text, and the member second contains the value text.
Returns the content of input with any comment sections removed.
Returns the content of input with any whitespace characters removed. Whitespace inside double quotes is preserved.
Sets the content of the header field to text.
See also content().
Sets the ID of the header field to id.
See also id().
Sets the parameter with the name name to have the value value, if present; otherwise a new parameter is appended with the supplied properties. If name ends with a single asterisk, the parameter will be flagged as encoded.
See also parameter() and setParameterEncoded().
Sets any parameters with the name name to be marked as encoded. Name comparisons are case-insensitive.
See also isParameterEncoded().
Returns the entire header field text as a formatted string, with the name of the field included if includeName is true. If presentable is true, artifacts of RFC 2822 transmission format such as parameter folding will be removed. For example:
QMailMessageHeaderField hdr;
hdr.setId("Content-Type");
hdr.setContent("text/plain");
hdr.setParameter("charset", "us-ascii");
QString s = hdr.toString(); // s: "Content-Type: text/plain; charset=us-ascii"
Copyright © 2009 Trolltech | Trademarks | Qt Extended 4.4.3 |