![]() |
Home · All Classes · All Functions · | ![]() |
The QVersitReader class provides an interface for reading versit documents such as vCards from a stream. More...
#include <QVersitReader>
Inherits QObject.
QVersitReader () | |
~QVersitReader () | |
QIODevice * | device () const |
bool | readAll () |
QList<QVersitDocument> | result () const |
void | setDevice ( QIODevice * device ) |
bool | startReading () |
void | readingDone () |
The QVersitReader class provides an interface for reading versit documents such as vCards from a stream.
QVersitReader reads 0..n versit documents such as vCards from a text stream into 0..n QVersitDocument instances. QVersitReader supports reading from an abstract I/O device which can be for example a file or a memory buffer. The reading can be done synchronously or asynchronously.
// An example of reading a simple vCard from a memory buffer: QBuffer vCardBuffer; vCardBuffer.open(QBuffer::ReadWrite); QByteArray vCard = "BEGIN:VCARD\r\nVERSION:2.1\r\nN:Citizen;John;Q;;\r\nEND:VCARD\r\n"; vCardBuffer.write(vCard); vCardBuffer.seek(0); QVersitReader reader; reader.setDevice(&vCardBuffer); if (reader.readAll()) { QList<QVersitDocument> versitDocuments = reader.result(); // Use the resulting document(s)... }
See also QVersitDocument.
Constructs a new reader.
Frees the memory used by the reader. Waits until a pending asynchronous reading has been completed.
Returns the device used for reading input.
See also setDevice().
Reads the input synchronously. Returns false if the input device has not been set or opened or if there is an asynchronous read operation pending. Using this function may block the user thread for an undefined period. In most cases asynchronous startReading() should be used instead.
The signal is emitted by the reader when the asynchronous reading has been completed.
Returns the reading result or an empty list if the reading was not completed successfully.
Sets the device used for reading the input to be the given device device.
See also device().
Starts reading the input asynchronously. Returns false if the input device has not been set or opened or if there is another asynchronous read operation already pending. Signal readingDone() is emitted when the reading has finished.
Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) | Trademarks | Qt Mobility Project 1.0.0 (Technical Preview) |