MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

QVersitDocument Class Reference

The QVersitDocument class is a container for a list of versit properties. More...

 #include <QVersitDocument>

Public Types

enum VersitType { InvalidType, VCard21Type, VCard30Type, VCard40Type, ICalendar20Type }

Public Functions

QVersitDocument ()
QVersitDocument ( const QVersitDocument & other )
QVersitDocument ( VersitType type )
~QVersitDocument ()
void addProperty ( const QVersitProperty & property )
void addSubDocument ( const QVersitDocument & subdocument )
void clear ()
QString componentType () const
bool isEmpty () const
QList<QVersitProperty> properties () const
void removeProperties ( const QString & name )
void removeProperty ( const QVersitProperty & property )
void removeSubDocument ( const QVersitDocument & subdocument )
void setComponentType ( QString componentType )
void setProperties ( const QList<QVersitProperty> & properties )
void setSubDocuments ( const QList<QVersitDocument> & documents )
void setType ( VersitType type )
QList<QVersitDocument> subDocuments () const
VersitType type () const
bool operator!= ( const QVersitDocument & other ) const
QVersitDocument & operator= ( const QVersitDocument & other )
bool operator== ( const QVersitDocument & other ) const

Detailed Description

The QVersitDocument class is a container for a list of versit properties.

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.

In addition to the list of properties, QVersitDocument also records the type of the Versit document in two ways. The VersitType enum describes the format in which the document is to be serialized by QVersitWriter (or the format from which it was read by QVersitReader), and should not be used to infer any semantics about the document data. The componentType field is a string corresponding directly to the value of the BEGIN line in a document. For example, for a vCard, this will always be the string "VCARD"; for an iCalendar, it could be "VCALENDAR", "VEVENT", "VTODO", "VJOURNAL", "VALARM" or "VTIMEZONE".

As well as properties, a QVersitDocument can hold other documents. For iCalendar, this is how a single VCALENDAR document can compose documents of type VEVENT, VTODO, etc.

For example, for the following iCalendar:

 BEGIN:VCALENDAR
 VERSION:2.0
 BEGIN:VEVENT
 SUMMARY:Christmas
 DTSTART:20001225
 END:VEVENT
 END:VCALENDAR

This can be represented as a QVersitDocument of with componentType VCALENDAR and versitType ICalendar20Type. It contains no properties (note: the VERSION property is not stored explicitly as a property) and one sub-document. The sub-document has componentType VEVENT and versitType ICalendar20Type, and contains two properties.

QVersitDocument supports implicit sharing.

See also QVersitProperty.

Member Type Documentation

enum QVersitDocument::VersitType

This enum describes a Versit document serialization format and version.

Constant Value Description
QVersitDocument::InvalidType 0 No type specified or a document with an invalid type was parsed
QVersitDocument::VCard21Type 1 vCard version 2.1
QVersitDocument::VCard30Type 2 vCard version 3.0
QVersitDocument::VCard40Type 3 vCard version 4.0
QVersitDocument::ICalendar20Type 4 iCalendar version 2.0

Member Function Documentation

QVersitDocument::QVersitDocument ()

Constructs a new empty document

QVersitDocument::QVersitDocument ( const QVersitDocument & other )

Constructs a document that is a copy of other

QVersitDocument::QVersitDocument ( VersitType type )

Constructs a new empty document with the type set to type

QVersitDocument::~QVersitDocument ()

Frees the memory used by the document

void QVersitDocument::addProperty ( const QVersitProperty & property )

Add property to the list of contained versit properties. The property is appended as the last property of the list.

void QVersitDocument::addSubDocument ( const QVersitDocument & subdocument )

Adds subdocument to the Versit document.

void QVersitDocument::clear ()

Clears the document, removing all properties, sub-documents and metadata.

QString QVersitDocument::componentType () const

Gets the versit component type

See also setComponentType().

bool QVersitDocument::isEmpty () const

Returns true if the document is empty.

QList<QVersitProperty> QVersitDocument::properties () const

Gets the list of the contained versit properties. Note that the actual properties cannot be modified using the copy.

See also setProperties().

void QVersitDocument::removeProperties ( const QString & name )

Removes all the properties with the given name from the versit document.

void QVersitDocument::removeProperty ( const QVersitProperty & property )

Removes the property property from the versit document.

void QVersitDocument::removeSubDocument ( const QVersitDocument & subdocument )

Removes the subdocument from the versit document.

void QVersitDocument::setComponentType ( QString componentType )

Sets the versit component type to componentType (eg. VCARD, VCALENDAR, VEVENT, etc.)

See also componentType().

void QVersitDocument::setProperties ( const QList<QVersitProperty> & properties )

Sets the list of properties to properties. Logically, all of the existing properties are removed and all of the supplied properties are added.

See also properties().

void QVersitDocument::setSubDocuments ( const QList<QVersitDocument> & documents )

Sets the list of subdocuments to documents.

See also subDocuments().

void QVersitDocument::setType ( VersitType type )

Sets the versit document type to type. This determines the format in which the document is to be serialized.

See also type().

QList<QVersitDocument> QVersitDocument::subDocuments () const

Returns the list of subdocuments contained within this Versit document.

See also setSubDocuments().

VersitType QVersitDocument::type () const

Gets the versit document type.

See also setType().

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

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

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

Assigns this document to other

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

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