Home · All Classes · All Functions ·

QVersitWriter Class Reference

The QVersitWriter class writes Versit documents such as vCards to a device. More...

    #include <QVersitWriter>

This class is under development and is subject to change.

Inherits QObject.


Public Types

enum Error { NoError, UnspecifiedError, IOError, OutOfMemoryError, NotReadyError }
enum State { InactiveState, ActiveState, CanceledState, FinishedState }

Public Functions

QVersitWriter ()
~QVersitWriter ()
void cancel ()
QTextCodec * defaultCodec () const
QIODevice * device () const
Error error () const
void setDefaultCodec ( QTextCodec * codec )
void setDevice ( QIODevice * device )
bool startWriting ( const QList<QVersitDocument> & input )
State state () const
bool waitForFinished ( int msec = -1 )

Signals

void stateChanged ( QVersitWriter::State state )

Additional Inherited Members


Detailed Description

The QVersitWriter class writes Versit documents such as vCards to a device.

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 asynchronously and the waitForFinished() function can be used to implement a blocking write.

See also QVersitDocument and QVersitProperty.


Member Type Documentation

enum QVersitWriter::Error

This enum specifies an error that occurred during the most recent operation:

ConstantValueDescription
QVersitWriter::NoError0The most recent operation was successful
QVersitWriter::UnspecifiedError1The most recent operation failed for an undocumented reason
QVersitWriter::IOError2The most recent operation failed because of a problem with the device
QVersitWriter::OutOfMemoryError3The most recent operation failed due to running out of memory
QVersitWriter::NotReadyError4The most recent operation failed because there is an operation in progress

enum QVersitWriter::State

Enumerates the various states that a reader may be in at any given time

ConstantValueDescription
QVersitWriter::InactiveState0Write operation not yet started
QVersitWriter::ActiveState1Write operation started, not yet finished
QVersitWriter::CanceledState2Write operation is finished due to cancelation
QVersitWriter::FinishedState3Write operation successfully completed


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.

void QVersitWriter::cancel ()

Attempts to asynchronously cancel the write request.

QTextCodec * QVersitWriter::defaultCodec () const

Returns the document's codec.

See also setDefaultCodec().

QIODevice * QVersitWriter::device () const

Returns the device used for writing.

See also setDevice().

Error QVersitWriter::error () const

Returns the error encountered by the last operation.

void QVersitWriter::setDefaultCodec ( QTextCodec * codec )

Sets the default codec for the writer to use for writing the entire output.

If codec is NULL, the writer uses the codec according to the specification prescribed default. (for vCard 2.1, ASCII; for vCard 3.0, UTF-8).

See also defaultCodec().

void QVersitWriter::setDevice ( QIODevice * device )

Sets the device used for writing to device.

See also device().

bool QVersitWriter::startWriting ( const QList<QVersitDocument> & input )

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

State QVersitWriter::state () const

Returns the state of the writer.

void QVersitWriter::stateChanged ( QVersitWriter::State state )   [signal]

The signal is emitted by the writer when its state has changed (eg. when it has finished writing to the device). state is the new state of the writer.

bool QVersitWriter::waitForFinished ( int msec = -1 )

If the state is ActiveState, blocks until the writer has finished writing or msec milliseconds has elapsed, returning true if it successfully finishes or is cancelled by the user. If the state is FinishedState, returns true immediately. Otherwise, returns false immediately.


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