Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QMailMessageHeaderField Class Reference
[QtMessagingModule, QtPimModule]

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.

Public Types

  • enum FieldType { StructuredField, UnstructuredField }

Public Functions

Static Public Members

  • QString decodeContent ( const QByteArray & input )
  • QString decodeParameter ( const QByteArray & input )
  • QString decodeWord ( const QByteArray & input )
  • QByteArray encodeContent ( const QString & input, const QByteArray & charset = "" )
  • QByteArray encodeParameter ( const QString & input, const QByteArray & charset = "", const QByteArray & language = "" )
  • QByteArray encodeWord ( const QString & input, const QByteArray & charset = "" )
  • QByteArray removeComments ( const QByteArray & input )
  • QByteArray removeWhitespace ( const QByteArray & input )

Detailed Description

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.


Member Type Documentation

enum QMailMessageHeaderField::FieldType

This enum type is used to describe the formatting of field content.

ConstantValueDescription
QMailMessageHeaderField::StructuredField1The field content should be parsed assuming it is structured according to the specification for RFC 2045 'Content-Type' fields.
QMailMessageHeaderField::UnstructuredField2The field content has no internal structure.


Member Function Documentation

QMailMessageHeaderField::QMailMessageHeaderField ()

Creates an uninitialised message header field object.

QMailMessageHeaderField::QMailMessageHeaderField ( const QByteArray & text, FieldType fieldType = StructuredField )

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.

QMailMessageHeaderField::QMailMessageHeaderField ( const QByteArray & id, const QByteArray & text, FieldType fieldType = StructuredField )

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.

QByteArray QMailMessageHeaderField::content () const

Returns the content of the header field, without any associated parameters.

See also setContent().

QString QMailMessageHeaderField::decodeContent ( const QByteArray & input )   [static]

Returns the content of input, decoding any encountered RFC 2045 'encoded-word' format tokens to unicode.

QString QMailMessageHeaderField::decodeParameter ( const QByteArray & input )   [static]

Returns the content of input decoded from RFC 2231 'extended-parameter' format.

QString QMailMessageHeaderField::decodeWord ( const QByteArray & input )   [static]

Returns the content of input decoded from RFC 2045 'encoded-word' format.

QString QMailMessageHeaderField::decodedContent () const   [virtual]

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.

QByteArray QMailMessageHeaderField::encodeContent ( const QString & input, const QByteArray & charset = "" )   [static]

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.

QByteArray QMailMessageHeaderField::encodeParameter ( const QString & input, const QByteArray & charset = "", const QByteArray & language = "" )   [static]

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.

QByteArray QMailMessageHeaderField::encodeWord ( const QString & input, const QByteArray & charset = "" )   [static]

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.

QByteArray QMailMessageHeaderField::id () const

Returns the ID of the header field.

See also setId().

bool QMailMessageHeaderField::isNull () const

Returns true if the header field has not been initialized.

bool QMailMessageHeaderField::isParameterEncoded ( const QByteArray & name ) const

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.

QByteArray QMailMessageHeaderField::parameter ( const QByteArray & name ) const

Returns the value of the parameter with the name name. Name comparisons are case-insensitive.

See also setParameter().

QList<ParameterType> QMailMessageHeaderField::parameters () const

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.

QByteArray QMailMessageHeaderField::removeComments ( const QByteArray & input )   [static]

Returns the content of input with any comment sections removed.

QByteArray QMailMessageHeaderField::removeWhitespace ( const QByteArray & input )   [static]

Returns the content of input with any whitespace characters removed. Whitespace inside double quotes is preserved.

void QMailMessageHeaderField::setContent ( const QByteArray & text )

Sets the content of the header field to text.

See also content().

void QMailMessageHeaderField::setId ( const QByteArray & id )

Sets the ID of the header field to id.

See also id().

void QMailMessageHeaderField::setParameter ( const QByteArray & name, const QByteArray & value )

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().

void QMailMessageHeaderField::setParameterEncoded ( const QByteArray & name )

Sets any parameters with the name name to be marked as encoded. Name comparisons are case-insensitive.

See also isParameterEncoded().

QByteArray QMailMessageHeaderField::toString ( bool includeName = true, bool presentable = true ) const   [virtual]

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"

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 64
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Developer Network au hasard

Logo

Combiner licence, à propos et fermer d'une autre manière

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtextended4.4
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web