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  · 

QVersitProperty Class Reference

The QVersitProperty class stores the name, value, groups and parameters of a Versit property. More...

 #include <QVersitProperty>

Public Types

enum ValueType { PlainType, CompoundType, ListType, BinaryType, VersitDocumentType, PreformattedType }

Public Functions

QVersitProperty ()
QVersitProperty ( const QVersitProperty & other )
~QVersitProperty ()
void clear ()
QStringList groups () const
void insertParameter ( const QString & name, const QString & value )
bool isEmpty () const
QString name () const
QMultiHash<QString, QString> parameters () const
void removeParameter ( const QString & name, const QString & value )
void removeParameters ( const QString & name )
void setGroups ( const QStringList & groups )
void setName ( const QString & name )
void setParameters ( const QMultiHash<QString, QString> & parameters )
void setValue ( const QVariant & value )
void setValueType ( ValueType type )
QString value () const
T value () const
ValueType valueType () const
QVariant variantValue () const
bool operator!= ( const QVersitProperty & other ) const
QVersitProperty & operator= ( const QVersitProperty & other )
bool operator== ( const QVersitProperty & other ) const

Detailed Description

The QVersitProperty class stores the name, value, groups and parameters of a Versit property.

A vCard is represented in abstract form as a QVersitDocument that consists of a number of properties such as a name (N), a telephone number (TEL) and an email address (EMAIL), for instance. Each of these properties is stored as an instance of a QVersitProperty in a QVersitDocument.

A QVersitProperty consists of a list of groups, a name, a list of parameters (key/value pairs), and a value.

The value of a QVersitProperty is stored as a QVariant and should always be one of four types: QString for textual values, QByteArray for binary data (eg. images), QStringList for structured textual data, or QVersitDocument for nested documents. The QVersitReader will parse Versit properties and assign the correct type of object to the property value. The QVersitWriter will serialize objects of these types correctly into the (text-based) Versit format.

For example, a property might appear in a vCard as:

 ADR;TYPE=home,postal:;;123 Main Street;Any Town;CA;91921-1234

This would be stored as a QVersitProperty with the name ADR and two parameters (both named TYPE and with values home and postal respectively. The value of the QVersitProperty is a QStringList with six strings, and the valueType is CompoundType.

QVersitProperty supports implicit sharing. The property name and parameter names of a QVersitProperty are converted to upper-case when they are stored to a QVersitProperty.

See also QVersitDocument.

Member Type Documentation

enum QVersitProperty::ValueType

Describes the type of data held in the property's value.

The vCard and iCalendar specifications allows a property value to hold a string, binary data, or a nested document. String values can either be unstructured or structured. Structured strings can be either of compound type or list type. A compound value is one that is delimited by semicolons, allows empty components, and has a property-specific cardinality and ordering. A list value is one that is delimited by commas, does not have empty components, and has no restrictions on cardinality or ordering.

ConstantValueDescription
QVersitProperty::PlainType0The property value holds an unstructured string and can be retrieved with QVersitProperty::value()
QVersitProperty::CompoundType1The property value holds a compound string and can be retrieved with QVersitProperty::value<QStringList>()
QVersitProperty::ListType2The property value holds a list of strings and can be retrieved with QVersitProperty::value<QStringList>()
QVersitProperty::BinaryType3The property value holds a binary value and can be retrieved with QVersitProperty::value<QByteArray>()
QVersitProperty::VersitDocumentType4The property value holds a nested Versit document and can be retrieved
QVersitProperty::PreformattedType5The property value holds a string that represents exactly the text for the property in the vCard file, bar line-wrapping. That is, if the property were to be written to file it should be written as-is, with no backslash escaping.

Member Function Documentation

QVersitProperty::QVersitProperty ()

Constructs a new empty property

QVersitProperty::QVersitProperty ( const QVersitProperty & other )

Constructs a property that is a copy of other

QVersitProperty::~QVersitProperty ()

Frees the memory used by the property

void QVersitProperty::clear ()

Clears the contents of this property.

QStringList QVersitProperty::groups () const

Gets the groups of the property.

See also setGroups().

void QVersitProperty::insertParameter ( const QString & name, const QString & value )

Adds a new parameter with name and value. The parameter name is converted to upper-case.

bool QVersitProperty::isEmpty () const

Returns true if the property is empty.

QString QVersitProperty::name () const

Gets the name of the property in upper-case.

See also setName().

QMultiHash<QString, QString> QVersitProperty::parameters () const

Return a copy of the contained list of parameters. Note that actual the parameters cannot be modified using the copy.

See also setParameters().

void QVersitProperty::removeParameter ( const QString & name, const QString & value )

Removes a parameter with name and value.

See also removeParameters().

void QVersitProperty::removeParameters ( const QString & name )

Removes all parameters with the given name.

See also removeParameter().

void QVersitProperty::setGroups ( const QStringList & groups )

Sets the groups in the property to the given list of groups.

See also groups().

void QVersitProperty::setName ( const QString & name )

Sets the name of the property. The name is converted to upper-case.

See also name().

void QVersitProperty::setParameters ( const QMultiHash<QString, QString> & parameters )

Replaces all the parameters with parameters. The names of the parameters are converted to upper-case.

See also parameters().

void QVersitProperty::setValue ( const QVariant & value )

Sets the property value to value.

See also value().

void QVersitProperty::setValueType ( ValueType type )

Sets the type of value held in the property to type.

See also valueType().

QString QVersitProperty::value () const

Returns the value of the property as a string if possible, otherwise return an empty string. If the property is stored as a QByteArray, it is decoded using the charset specified in the property's parameters.

See also setValue() and QVariant::toString().

T QVersitProperty::value () const

This is an overloaded function.

Returns the value of the property as a T.

ValueType QVersitProperty::valueType () const

Returns the type of value held in the property.

See also setValueType().

QVariant QVersitProperty::variantValue () const

Returns the value of the property.

bool QVersitProperty::operator!= ( const QVersitProperty & other ) const

Returns true if this is not equal to other; false otherwise.

QVersitProperty & QVersitProperty::operator= ( const QVersitProperty & other )

Assigns this property to other

bool QVersitProperty::operator== ( const QVersitProperty & other ) const

Returns true if this is equal to other; false otherwise.

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.

[0]; s.parentNode.insertBefore(ga, s); })();
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 94
  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. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 48
  4. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  5. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 13
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
Page suivante

Le Qt Developer Network au hasard

Logo

Génération de bindings PySide avec Shiboken

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 qtmobility-1.1
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