Qt 4.8
qnoncontiguousbytedevice_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 QtCore 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 #ifndef QNONCONTIGUOUSBYTEDEVICE_H
43 #define QNONCONTIGUOUSBYTEDEVICE_H
44 
45 //
46 // W A R N I N G
47 // -------------
48 //
49 // This file is not part of the Qt API. It exists for the convenience
50 // of a number of Qt sources files. This header file may change from
51 // version to version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55 
56 #include <QtCore/qobject.h>
57 #include <QtCore/qbytearray.h>
58 #include <QtCore/qbuffer.h>
59 #include <QtCore/qiodevice.h>
60 #include <QtCore/QSharedPointer>
61 #include "private/qringbuffer_p.h"
62 
64 
66 {
67  Q_OBJECT
68 public:
69  virtual const char* readPointer(qint64 maximumLength, qint64 &len) = 0;
70  virtual bool advanceReadPointer(qint64 amount) = 0;
71  virtual bool atEnd() = 0;
72  virtual bool reset() = 0;
73  void disableReset();
74  bool isResetDisabled() { return resetDisabled; }
75  virtual qint64 size() = 0;
76 
77  virtual ~QNonContiguousByteDevice();
78 
79 protected:
81 
82 
84 Q_SIGNALS:
85  void readyRead();
86  void readProgress(qint64 current, qint64 total);
87 };
88 
90 {
91 public:
92  static QNonContiguousByteDevice* create(QIODevice *device);
93  static QNonContiguousByteDevice* create(QByteArray *byteArray);
95  static QIODevice* wrap(QNonContiguousByteDevice* byteDevice);
96 };
97 
98 // the actual implementations
99 //
100 
102 {
103 public:
106  const char* readPointer(qint64 maximumLength, qint64 &len);
107  bool advanceReadPointer(qint64 amount);
108  bool atEnd();
109  bool reset();
110  qint64 size();
111 protected:
114 };
115 
117 {
118 public:
121  const char* readPointer(qint64 maximumLength, qint64 &len);
122  bool advanceReadPointer(qint64 amount);
123  bool atEnd();
124  bool reset();
125  qint64 size();
126 protected:
129 };
130 
131 
133 {
134  Q_OBJECT
135 public:
138  const char* readPointer(qint64 maximumLength, qint64 &len);
139  bool advanceReadPointer(qint64 amount);
140  bool atEnd();
141  bool reset();
142  qint64 size();
143 protected:
149  qint64 totalAdvancements; //progress counter used for emitting the readProgress signal
150  bool eof;
152 };
153 
155 {
156  Q_OBJECT
157 public:
160  const char* readPointer(qint64 maximumLength, qint64 &len);
161  bool advanceReadPointer(qint64 amount);
162  bool atEnd();
163  bool reset();
164  qint64 size();
165 protected:
169 };
170 
171 // ... and the reverse thing
173 {
174 public:
177  virtual bool isSequential () const;
178  virtual bool atEnd () const;
179  virtual bool reset ();
180  virtual qint64 size () const;
181 protected:
182  virtual qint64 readData ( char * data, qint64 maxSize );
183  virtual qint64 writeData ( const char * data, qint64 maxSize );
184 
186 };
187 
189 
190 #endif
double d
Definition: qnumeric_p.h:62
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
static Expression::Ptr create(Expression *const expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
Q_CORE_EXPORT QTextStream & reset(QTextStream &s)
QNonContiguousByteDevice * byteDevice
The QBuffer class provides a QIODevice interface for a QByteArray.
Definition: qbuffer.h:57
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
#define Q_SIGNALS
Definition: qobjectdefs.h:72
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
static const char * data(const QByteArray &arr)
__int64 qint64
Definition: qglobal.h:942
#define Q_OBJECT
Definition: qobjectdefs.h:157
Creates a QNonContiguousByteDevice out of a QIODevice, QByteArray etc.
#define Q_CORE_EXPORT
Definition: qglobal.h:1449
QNonContiguousByteDeviceByteArrayImpl * arrayImpl
A QNonContiguousByteDevice is a representation of a file, array or buffer that allows access with a r...
The QIODevice class is the base interface class of all I/O devices in Qt.
Definition: qiodevice.h:66