The QVersitProperty class stores the name, value, groups and parameters of a Versit property. More...
#include <QVersitProperty>
enum | ValueType { PlainType, CompoundType, ListType, BinaryType, VersitDocumentType, PreformattedType } |
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 |
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.
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.
Constant | Value | Description |
---|---|---|
QVersitProperty::PlainType | 0 | The property value holds an unstructured string and can be retrieved with QVersitProperty::value() |
QVersitProperty::CompoundType | 1 | The property value holds a compound string and can be retrieved with QVersitProperty::value<QStringList>() |
QVersitProperty::ListType | 2 | The property value holds a list of strings and can be retrieved with QVersitProperty::value<QStringList>() |
QVersitProperty::BinaryType | 3 | The property value holds a binary value and can be retrieved with QVersitProperty::value<QByteArray>() |
QVersitProperty::VersitDocumentType | 4 | The property value holds a nested Versit document and can be retrieved |
QVersitProperty::PreformattedType | 5 | The 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. |
Constructs a new empty property
Constructs a property that is a copy of other
Frees the memory used by the property
Clears the contents of this property.
Gets the groups of the property.
See also setGroups().
Adds a new parameter with name and value. The parameter name is converted to upper-case.
Returns true if the property is empty.
Gets the name of the property in upper-case.
See also setName().
Return a copy of the contained list of parameters. Note that actual the parameters cannot be modified using the copy.
See also setParameters().
Removes a parameter with name and value.
See also removeParameters().
Removes all parameters with the given name.
See also removeParameter().
Sets the groups in the property to the given list of groups.
See also groups().
Sets the name of the property. The name is converted to upper-case.
See also name().
Replaces all the parameters with parameters. The names of the parameters are converted to upper-case.
See also parameters().
Sets the property value to value.
See also value().
Sets the type of value held in the property to type.
See also valueType().
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().
This is an overloaded function.
Returns the value of the property as a T.
Returns the type of value held in the property.
See also setValueType().
Returns the value of the property.
Returns true if this is not equal to other; false otherwise.
Assigns this property to other
Returns true if this is equal to other; false otherwise.