Home · All Classes · All Functions ·

QVersitWriter Class Reference

The QVersitWriter class provides an interface for writing a versit document such as a vCard to a text stream. More...

    #include <QVersitWriter>

Inherits QObject.


Public Functions

QVersitWriter ()
~QVersitWriter ()
QIODevice * device () const
void setDevice ( QIODevice * device )
void setVersitDocument ( const QVersitDocument & versitDocument )
bool startWriting ()
QVersitDocument versitDocument () const
bool writeAll ()

Signals

void writingDone ()

Additional Inherited Members


Detailed Description

The QVersitWriter class provides an interface for writing a versit document such as a vCard to a text stream.

QVersitWriter converts a QVersitDocument into its textual representation. QVersitWriter supports writing to an abstract I/O device which can be for example a file or a memory buffer. The writing can be done synchronously or asynchronously.

    // An example of writing a simple vCard to a memory buffer:
    QBuffer vCardBuffer;
    vCardBuffer.open(QBuffer::ReadWrite);
    QVersitWriter writer;
    writer.setDevice(&vCardBuffer);
    QVersitDocument document;
    QVersitProperty property;
    property.setName("N");
    property.setValue("Citizen;John;Q;;");
    document.addProperty(property);
    writer.setVersitDocument(document);
    if (writer.writeAll()) {
        // Use the vCardBuffer...
    }

See also QVersitDocument and QVersitProperty.


Member Function Documentation

QVersitWriter::QVersitWriter ()

Constructs a new writer.

QVersitWriter::~QVersitWriter ()

Frees the memory used by the writer. Waits until a pending asynchronous writing has been completed.

QIODevice * QVersitWriter::device () const

Returns the device used for writing.

See also setDevice().

void QVersitWriter::setDevice ( QIODevice * device )

Sets the device used for writing to device.

See also device().

void QVersitWriter::setVersitDocument ( const QVersitDocument & versitDocument )

Set the versit document to be written to versitDocument and selects the actual writer implementation based on the versit document type.

See also versitDocument().

bool QVersitWriter::startWriting ()

Starts writing the output asynchronously. Returns false if the output device has not been set or opened or if there is another asynchronous write operation already pending. Signal writingDone() is emitted when the writing has finished.

QVersitDocument QVersitWriter::versitDocument () const

Returns the current versit document.

See also setVersitDocument().

bool QVersitWriter::writeAll ()

Writes the output synchronously. Returns false if the output device has not been set or opened or if there is an asynchronous write operation pending. Using this function may block the user thread for an undefined period. In most cases asynchronous startWriting() should be used instead.

void QVersitWriter::writingDone ()   [signal]

The signal is emitted by the writer when the asynchronous writing has been completed.


Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt Mobility Project 1.0.0 (Technical Preview)