equal
deleted
inserted
replaced
51 |
51 |
52 QTM_USE_NAMESPACE |
52 QTM_USE_NAMESPACE |
53 |
53 |
54 /*! |
54 /*! |
55 \class QVersitReader |
55 \class QVersitReader |
56 \brief The QVersitReader class reads Versit documents such as vCards from a device. |
56 \brief The QVersitReader class provides an interface for reading versit |
|
57 documents such as vCards from a Stream. |
57 \ingroup versit |
58 \ingroup versit |
|
59 \inmodule QtVersit |
58 |
60 |
59 QVersitReader concatenation of Versit documents such as vCards |
61 QVersitReader concatenation of Versit documents such as vCards |
60 from a text stream and returns a list of QVersitDocument instances. |
62 from a text stream and returns a list of QVersitDocument instances. |
61 QVersitReader supports reading from an abstract I/O device |
63 QVersitReader supports reading from an abstract I/O device |
62 which can be, for example, a file or a memory buffer. |
64 which can be, for example, a file or a memory buffer. |
211 * if there is another asynchronous read operation already pending. |
213 * if there is another asynchronous read operation already pending. |
212 * Signal \l stateChanged() is emitted with parameter FinishedState |
214 * Signal \l stateChanged() is emitted with parameter FinishedState |
213 * when the reading has finished. |
215 * when the reading has finished. |
214 */ |
216 */ |
215 bool QVersitReader::startReading() |
217 bool QVersitReader::startReading() |
216 { if (d->state() == ActiveState || d->isRunning()) { |
218 { |
|
219 if (d->state() == ActiveState || d->isRunning()) { |
217 d->setError(QVersitReader::NotReadyError); |
220 d->setError(QVersitReader::NotReadyError); |
218 return false; |
221 return false; |
219 } else if (!d->mIoDevice || !d->mIoDevice->isReadable()) { |
222 } else if (!d->mIoDevice || !d->mIoDevice->isReadable()) { |
220 d->setError(QVersitReader::IOError); |
223 d->setError(QVersitReader::IOError); |
221 return false; |
224 return false; |
237 } |
240 } |
238 |
241 |
239 /*! |
242 /*! |
240 * If the state is ActiveState, blocks until the reader has finished reading or \a msec milliseconds |
243 * If the state is ActiveState, blocks until the reader has finished reading or \a msec milliseconds |
241 * has elapsed, returning true if it successfully finishes or is cancelled by the user. |
244 * has elapsed, returning true if it successfully finishes or is cancelled by the user. |
|
245 * If \m msec is negative or zero, the function blocks until the writer has finished, regardless of |
|
246 * how long it takes. |
242 * If the state is FinishedState, returns true immediately. |
247 * If the state is FinishedState, returns true immediately. |
243 * Otherwise, returns false immediately. |
248 * Otherwise, returns false immediately. |
244 */ |
249 */ |
245 bool QVersitReader::waitForFinished(int msec) |
250 bool QVersitReader::waitForFinished(int msec) |
246 { |
251 { |
247 State state = d->state(); |
252 State state = d->state(); |
248 if (state == ActiveState) { |
253 if (state == ActiveState) { |
249 return d->wait(msec); |
254 if (msec <= 0) |
|
255 return d->wait(ULONG_MAX); |
|
256 else |
|
257 return d->wait(msec); |
250 } else if (state == FinishedState) { |
258 } else if (state == FinishedState) { |
251 return true; |
259 return true; |
252 } else { |
260 } else { |
253 return false; |
261 return false; |
254 } |
262 } |