Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QVersitReader Class

The QVersitReader class provides an interface for reading versit documents such as vCards from a Stream. More...

 #include <QVersitReader>

Inherits: QObject.

Public Types

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

Public Functions

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)
  • 31 public functions inherited from QObject

Public Slots

void cancel()
bool startReading()
  • 1 public slot inherited from QObject

Signals

void resultsAvailable()
void stateChanged(QVersitReader::State state)

Additional Inherited Members

  • 1 property inherited from QObject
  • 11 static public members inherited from QObject
  • 9 protected functions inherited from QObject

Detailed Description

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.

Member Type Documentation

enum QVersitReader::Error

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

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

enum QVersitReader::State

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

ConstantValueDescription
QVersitReader::InactiveState0Read operation not yet started
QVersitReader::ActiveState1Read operation started, not yet finished
QVersitReader::CanceledState2Read operation is finished due to cancellation
QVersitReader::FinishedState3Read operation successfully completed

Member Function Documentation

QVersitReader::QVersitReader()

Constructs a new reader.

QVersitReader::QVersitReader(QIODevice * inputDevice)

Constructs a new reader that reads from inputDevice.

QVersitReader::QVersitReader(const QByteArray & inputData)

Constructs a new reader that reads from inputData.

QVersitReader::~QVersitReader()

Frees the memory used by the reader. Waits until a pending asynchronous reading has been completed.

void QVersitReader::cancel() [slot]

Attempts to asynchronously cancel the read request.

QTextCodec * QVersitReader::defaultCodec() const

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().

QIODevice * QVersitReader::device() const

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().

Error QVersitReader::error() const

Returns the error encountered by the last operation.

QList<QVersitDocument> QVersitReader::results() const

Returns the reading result. Even if there was an error or reading has not completed, a partial list of results may be returned.

void QVersitReader::resultsAvailable() [signal]

The signal is emitted by the reader as it reads from the device when it has made more Versit documents available.

void QVersitReader::setData(const QByteArray & inputData)

Sets the data to read from to the byte array input source, inputData. This overrides any device set with setDevice().

void QVersitReader::setDefaultCodec(QTextCodec * codec)

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().

void QVersitReader::setDevice(QIODevice * device)

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().

bool QVersitReader::startReading() [slot]

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.

State QVersitReader::state() const

Returns the state of the reader.

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

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.

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

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.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web