The QVersitReader class provides an interface for reading versit documents such as vCards from a Stream. More...
#include <QVersitReader>
Inherits: QObject.
enum | Error { NoError, UnspecifiedError, IOError, OutOfMemoryError, NotReadyError, ParseError } |
enum | State { InactiveState, ActiveState, CanceledState, FinishedState } |
QVersitReader () | |
QVersitReader ( QIODevice * inputDevice ) | |
QVersitReader ( const QByteArray & inputData ) | |
~QVersitReader () | |
QTextCodec * | defaultCodec () const |
QIODevice * | device () const |
Error | error () const |
QList<QVersitDocument> | results () const |
void | setData ( const QByteArray & inputData ) |
void | setDefaultCodec ( QTextCodec * codec ) |
void | setDevice ( QIODevice * device ) |
State | state () const |
bool | waitForFinished ( int msec = -1 ) |
void | cancel () |
bool | startReading () |
void | resultsAvailable () |
void | stateChanged ( QVersitReader::State state ) |
The QVersitReader class provides an interface for reading versit documents such as vCards from a Stream.
QVersitReader concatenation of Versit documents such as vCards from a text stream and returns a list of 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 asynchronously, and the waitForFinished() function can be used to make a blocking read.
See also QVersitDocument.
This enum specifies an error that occurred during the most recent operation:
Constant | Value | Description |
---|---|---|
QVersitReader::NoError | 0 | The most recent operation was successful |
QVersitReader::UnspecifiedError | 1 | The most recent operation failed for an undocumented reason |
QVersitReader::IOError | 2 | The most recent operation failed because of a problem with the device |
QVersitReader::OutOfMemoryError | 3 | The most recent operation failed due to running out of memory |
QVersitReader::NotReadyError | 4 | The most recent operation failed because there is an operation in progress |
QVersitReader::ParseError | 5 | The most recent operation failed because the input was malformed |
Enumerates the various states that a reader may be in at any given time
Constant | Value | Description |
---|---|---|
QVersitReader::InactiveState | 0 | Read operation not yet started |
QVersitReader::ActiveState | 1 | Read operation started, not yet finished |
QVersitReader::CanceledState | 2 | Read operation is finished due to cancellation |
QVersitReader::FinishedState | 3 | Read operation successfully completed |
Constructs a new reader.
Constructs a new reader that reads from inputDevice.
Constructs a new reader that reads from inputData.
Frees the memory used by the reader. Waits until a pending asynchronous reading has been completed.
Attempts to asynchronously cancel the read request.
Returns the codec the reader uses when parsing the input stream. If the codec is null, this denotes that the reader will try to detect the codec from the input.
See also setDefaultCodec().
Returns the device used for reading input, or 0 if no device has been set (or if the input source was set with setData().
See also setDevice().
Returns the error encountered by the last operation.
Returns the reading result. Even if there was an error or reading has not completed, a partial list of results may be returned.
The signal is emitted by the reader as it reads from the device when it has made more Versit documents available.
Sets the data to read from to the byte array input source, inputData. This overrides any device set with setDevice().
Sets codec as the codec for the reader to use when parsing the input stream to. This codec is not used for values where the CHARSET Versit parameter occurs. If the codec is null, this denotes that the reader will try to detect the codec from the input. The codec autodetection algorithm can detect UTF-8, UTF-16 or UTF-32. If the input is in some 8-bit codec, it will fall back to using the system locale's codec.
See also defaultCodec().
Sets the device used for reading the input to be the given device. Does not take ownership of the device. This overrides any byte array input source set with setData().
The caller must ensure that device remains valid for the lifetime of this QVersitReader object.
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 stateChanged() is emitted with parameter FinishedState when the reading has finished.
The device must be already open. The client is responsible for closing it when finished.
Returns the state of the reader.
The signal is emitted by the reader when its state has changed (eg. when it has finished reading from the device). state is the new state of the reader.
If the state is ActiveState, blocks until the reader has finished reading or msec milliseconds has elapsed, returning true if it successfully finishes or is cancelled by the user. If msec is negative or zero, the function blocks until the writer has finished, regardless of how long it takes. If the state is FinishedState, returns true immediately. Otherwise, returns false immediately.
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.