|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef QVERSITREADER_H |
|
43 #define QVERSITREADER_H |
|
44 |
|
45 #include "qversitdocument.h" |
|
46 #include "qmobilityglobal.h" |
|
47 |
|
48 #include <QObject> |
|
49 |
|
50 QT_BEGIN_NAMESPACE |
|
51 class QIODevice; |
|
52 class QTextCodec; |
|
53 QT_END_NAMESPACE |
|
54 |
|
55 QTM_BEGIN_NAMESPACE |
|
56 |
|
57 class QVersitReaderPrivate; |
|
58 |
|
59 // reads a QVersitDocument from i/o device |
|
60 class Q_VERSIT_EXPORT QVersitReader : public QObject |
|
61 { |
|
62 Q_OBJECT |
|
63 public: |
|
64 enum Error { |
|
65 NoError = 0, |
|
66 UnspecifiedError, |
|
67 IOError, |
|
68 OutOfMemoryError, |
|
69 NotReadyError, |
|
70 ParseError |
|
71 }; |
|
72 |
|
73 enum State { |
|
74 InactiveState = 0, |
|
75 ActiveState, |
|
76 CanceledState, |
|
77 FinishedState |
|
78 }; |
|
79 |
|
80 QVersitReader(); |
|
81 QVersitReader(QIODevice* inputDevice); |
|
82 QVersitReader(const QByteArray& inputData); |
|
83 ~QVersitReader(); |
|
84 |
|
85 // input: |
|
86 void setDevice(QIODevice* inputDevice); |
|
87 QIODevice* device() const; |
|
88 void setData(const QByteArray& inputData); |
|
89 |
|
90 void setDefaultCodec(QTextCodec* codec); |
|
91 QTextCodec* defaultCodec() const; |
|
92 |
|
93 // output: |
|
94 QList<QVersitDocument> results() const; |
|
95 |
|
96 State state() const; |
|
97 Error error() const; |
|
98 |
|
99 // reading: |
|
100 public Q_SLOTS: |
|
101 bool startReading(); |
|
102 void cancel(); |
|
103 public: |
|
104 Q_INVOKABLE bool waitForFinished(int msec = -1); |
|
105 |
|
106 Q_SIGNALS: |
|
107 void stateChanged(QVersitReader::State state); |
|
108 void resultsAvailable(); |
|
109 |
|
110 private: // data |
|
111 QVersitReaderPrivate* d; |
|
112 }; |
|
113 |
|
114 QTM_END_NAMESPACE |
|
115 |
|
116 Q_DECLARE_METATYPE(QTM_PREPEND_NAMESPACE(QVersitReader::State)) |
|
117 |
|
118 #endif // QVERSITREADER_H |