Qt 4.8
qiodevicedelegate_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtXmlPatterns module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 //
43 // W A R N I N G
44 // -------------
45 //
46 // This file is not part of the Qt API. It exists purely as an
47 // implementation detail. This header file may change from version to
48 // version without notice, or even be removed.
49 //
50 // We mean it.
51 
52 #ifndef QIODEVICEDELEGATE_P_H
53 #define QIODEVICEDELEGATE_P_H
54 
55 #include <QtCore/QTimer>
56 #include <QtNetwork/QNetworkReply>
57 
59 
60 namespace QPatternist
61 {
66  {
67  Q_OBJECT
68  public:
69  QIODeviceDelegate(QIODevice *const source);
70 
71  virtual void abort();
72 
73  virtual bool atEnd() const;
74  virtual qint64 bytesAvailable() const;
75  virtual qint64 bytesToWrite() const;
76  virtual bool canReadLine() const;
77  virtual void close();
78  virtual bool isSequential() const;
79  virtual bool open(OpenMode mode);
80  virtual qint64 pos() const;
81  virtual bool reset();
82  virtual bool seek(qint64 pos);
83  virtual qint64 size() const;
84  virtual bool waitForBytesWritten(int msecs);
85  virtual bool waitForReadyRead(int msecs);
86 
87  protected:
88  virtual qint64 readData(char *data, qint64 maxSize);
89 
90  private Q_SLOTS:
91  void networkTimeout();
92  private:
93  enum
94  {
98  Timeout = 20000
99  };
100 
103  };
104 }
105 
107 
108 #endif
virtual bool atEnd() const
Returns true if the current read and write position is at the end of the device (i.e.
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
virtual qint64 bytesAvailable() const
Returns the number of bytes that are available for reading.
virtual qint64 readData(char *data, qint64 maxSize)
Reads up to maxSize bytes from the device into data, and returns the number of bytes read or -1 if an...
virtual qint64 size() const
For open random-access devices, this function returns the size of the device.
The QNetworkReply class contains the data and headers for a request sent with QNetworkAccessManager.
Definition: qnetworkreply.h:65
virtual qint64 pos() const
For random-access devices, this function returns the position that data is written to or read from...
QIODeviceDelegate(QIODevice *const source)
#define Q_SLOTS
Definition: qobjectdefs.h:71
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
virtual void close()
Closes this device for reading.
The namespace for the internal API of QtXmlPatterns.
static const char * data(const QByteArray &arr)
virtual bool waitForReadyRead(int msecs)
Blocks until new data is available for reading and the readyRead() signal has been emitted...
__int64 qint64
Definition: qglobal.h:942
#define Q_OBJECT
Definition: qobjectdefs.h:157
virtual bool seek(qint64 pos)
For random-access devices, this function sets the current position to pos, returning true on success...
virtual bool canReadLine() const
Returns true if a complete line of data can be read from the device; otherwise returns false...
virtual bool open(OpenMode mode)
Opens the device and sets its OpenMode to mode.
virtual qint64 bytesToWrite() const
For buffered devices, this function returns the number of bytes waiting to be written.
virtual bool reset()
Seeks to the start of input for random-access devices.
The QTimer class provides repetitive and single-shot timers.
Definition: qtimer.h:56
virtual bool waitForBytesWritten(int msecs)
For buffered devices, this function waits until a payload of buffered written data has been written t...
The QIODevice class is the base interface class of all I/O devices in Qt.
Definition: qiodevice.h:66
virtual void abort()
Aborts the operation immediately and close down any network connections still open.