| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qnoncontiguousbytedevice.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||||||||||||||
| 2 | ** | - | ||||||||||||||||||||||||
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||||||||||||||||||||
| 4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||||||||
| 6 | ** This file is part of the QtCore module of the Qt Toolkit. | - | ||||||||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||||||||||||||
| 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 The Qt Company. For licensing terms | - | ||||||||||||||||||||||||
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||||||||
| 15 | ** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free | - | ||||||||||||||||||||||||
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||||||||||||||
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||||||||||||||
| 22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||||||||||||||
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||||||||||||||
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||||||||||||||
| 25 | ** | - | ||||||||||||||||||||||||
| 26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||||||||||||||
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||||||||||||||
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||||||||||||||
| 29 | ** | - | ||||||||||||||||||||||||
| 30 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||||||||
| 31 | ** | - | ||||||||||||||||||||||||
| 32 | ****************************************************************************/ | - | ||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||
| 34 | #include "qnoncontiguousbytedevice_p.h" | - | ||||||||||||||||||||||||
| 35 | #include <qbuffer.h> | - | ||||||||||||||||||||||||
| 36 | #include <qdebug.h> | - | ||||||||||||||||||||||||
| 37 | #include <qfile.h> | - | ||||||||||||||||||||||||
| 38 | - | |||||||||||||||||||||||||
| 39 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||
| 40 | - | |||||||||||||||||||||||||
| 41 | /*! | - | ||||||||||||||||||||||||
| 42 | \class QNonContiguousByteDevice | - | ||||||||||||||||||||||||
| 43 | \inmodule QtCore | - | ||||||||||||||||||||||||
| 44 | \brief A QNonContiguousByteDevice is a representation of a | - | ||||||||||||||||||||||||
| 45 | file, array or buffer that allows access with a read pointer. | - | ||||||||||||||||||||||||
| 46 | \since 4.6 | - | ||||||||||||||||||||||||
| 47 | - | |||||||||||||||||||||||||
| 48 | The goal of this class is to have a data representation that | - | ||||||||||||||||||||||||
| 49 | allows us to avoid doing a memcpy as we have to do with QIODevice. | - | ||||||||||||||||||||||||
| 50 | - | |||||||||||||||||||||||||
| 51 | \sa QNonContiguousByteDeviceFactory | - | ||||||||||||||||||||||||
| 52 | - | |||||||||||||||||||||||||
| 53 | \internal | - | ||||||||||||||||||||||||
| 54 | */ | - | ||||||||||||||||||||||||
| 55 | /*! | - | ||||||||||||||||||||||||
| 56 | \fn virtual const char* QNonContiguousByteDevice::readPointer(qint64 maximumLength, qint64 &len) | - | ||||||||||||||||||||||||
| 57 | - | |||||||||||||||||||||||||
| 58 | Return a byte pointer for at most \a maximumLength bytes of that device. | - | ||||||||||||||||||||||||
| 59 | if \a maximumLength is -1, the caller does not care about the length and | - | ||||||||||||||||||||||||
| 60 | the device may return what it desires to. | - | ||||||||||||||||||||||||
| 61 | The actual number of bytes the pointer is valid for is returned in | - | ||||||||||||||||||||||||
| 62 | the \a len variable. | - | ||||||||||||||||||||||||
| 63 | \a len will be -1 if EOF or an error occurs. | - | ||||||||||||||||||||||||
| 64 | If it was really EOF can then afterwards be checked with atEnd() | - | ||||||||||||||||||||||||
| 65 | Returns 0 if it is not possible to read at that position. | - | ||||||||||||||||||||||||
| 66 | - | |||||||||||||||||||||||||
| 67 | \sa atEnd() | - | ||||||||||||||||||||||||
| 68 | - | |||||||||||||||||||||||||
| 69 | \internal | - | ||||||||||||||||||||||||
| 70 | */ | - | ||||||||||||||||||||||||
| 71 | /*! | - | ||||||||||||||||||||||||
| 72 | \fn virtual bool QNonContiguousByteDevice::advanceReadPointer(qint64 amount) | - | ||||||||||||||||||||||||
| 73 | - | |||||||||||||||||||||||||
| 74 | will advance the internal read pointer by \a amount bytes. | - | ||||||||||||||||||||||||
| 75 | The old readPointer is invalid after this call. | - | ||||||||||||||||||||||||
| 76 | - | |||||||||||||||||||||||||
| 77 | \sa readPointer() | - | ||||||||||||||||||||||||
| 78 | - | |||||||||||||||||||||||||
| 79 | \internal | - | ||||||||||||||||||||||||
| 80 | */ | - | ||||||||||||||||||||||||
| 81 | /*! | - | ||||||||||||||||||||||||
| 82 | \fn virtual bool QNonContiguousByteDevice::atEnd() | - | ||||||||||||||||||||||||
| 83 | - | |||||||||||||||||||||||||
| 84 | Returns \c true if everything has been read and the read | - | ||||||||||||||||||||||||
| 85 | pointer cannot be advanced anymore. | - | ||||||||||||||||||||||||
| 86 | - | |||||||||||||||||||||||||
| 87 | \sa readPointer(), advanceReadPointer(), reset() | - | ||||||||||||||||||||||||
| 88 | - | |||||||||||||||||||||||||
| 89 | \internal | - | ||||||||||||||||||||||||
| 90 | */ | - | ||||||||||||||||||||||||
| 91 | /*! | - | ||||||||||||||||||||||||
| 92 | \fn virtual bool QNonContiguousByteDevice::reset() | - | ||||||||||||||||||||||||
| 93 | - | |||||||||||||||||||||||||
| 94 | Moves the internal read pointer back to the beginning. | - | ||||||||||||||||||||||||
| 95 | Returns \c false if this was not possible. | - | ||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||
| 97 | \sa atEnd() | - | ||||||||||||||||||||||||
| 98 | - | |||||||||||||||||||||||||
| 99 | \internal | - | ||||||||||||||||||||||||
| 100 | */ | - | ||||||||||||||||||||||||
| 101 | /*! | - | ||||||||||||||||||||||||
| 102 | \fn virtual qint64 QNonContiguousByteDevice::size() | - | ||||||||||||||||||||||||
| 103 | - | |||||||||||||||||||||||||
| 104 | Returns the size of the complete device or -1 if unknown. | - | ||||||||||||||||||||||||
| 105 | May also return less/more than what can be actually read with readPointer() | - | ||||||||||||||||||||||||
| 106 | - | |||||||||||||||||||||||||
| 107 | \internal | - | ||||||||||||||||||||||||
| 108 | */ | - | ||||||||||||||||||||||||
| 109 | /*! | - | ||||||||||||||||||||||||
| 110 | \fn void QNonContiguousByteDevice::readyRead() | - | ||||||||||||||||||||||||
| 111 | - | |||||||||||||||||||||||||
| 112 | Emitted when there is data available | - | ||||||||||||||||||||||||
| 113 | - | |||||||||||||||||||||||||
| 114 | \internal | - | ||||||||||||||||||||||||
| 115 | */ | - | ||||||||||||||||||||||||
| 116 | /*! | - | ||||||||||||||||||||||||
| 117 | \fn void QNonContiguousByteDevice::readProgress(qint64 current, qint64 total) | - | ||||||||||||||||||||||||
| 118 | - | |||||||||||||||||||||||||
| 119 | Emitted when data has been "read" by advancing the read pointer | - | ||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||
| 121 | \internal | - | ||||||||||||||||||||||||
| 122 | */ | - | ||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||
| 124 | QNonContiguousByteDevice::QNonContiguousByteDevice() : QObject((QObject*)0) | - | ||||||||||||||||||||||||
| 125 | { | - | ||||||||||||||||||||||||
| 126 | } executed 494 times by 4 tests: end of blockExecuted by:
| 494 | ||||||||||||||||||||||||
| 127 | - | |||||||||||||||||||||||||
| 128 | QNonContiguousByteDevice::~QNonContiguousByteDevice() | - | ||||||||||||||||||||||||
| 129 | { | - | ||||||||||||||||||||||||
| 130 | } | - | ||||||||||||||||||||||||
| 131 | - | |||||||||||||||||||||||||
| 132 | // FIXME we should scrap this whole implementation and instead change the ByteArrayImpl to be able to cope with sub-arrays? | - | ||||||||||||||||||||||||
| 133 | QNonContiguousByteDeviceBufferImpl::QNonContiguousByteDeviceBufferImpl(QBuffer *b) : QNonContiguousByteDevice() | - | ||||||||||||||||||||||||
| 134 | { | - | ||||||||||||||||||||||||
| 135 | buffer = b; | - | ||||||||||||||||||||||||
| 136 | byteArray = QByteArray::fromRawData(buffer->buffer().constData() + buffer->pos(), buffer->size() - buffer->pos()); | - | ||||||||||||||||||||||||
| 137 | arrayImpl = new QNonContiguousByteDeviceByteArrayImpl(&byteArray); | - | ||||||||||||||||||||||||
| 138 | arrayImpl->setParent(this); | - | ||||||||||||||||||||||||
| 139 | connect(arrayImpl, SIGNAL(readyRead()), SIGNAL(readyRead())); | - | ||||||||||||||||||||||||
| 140 | connect(arrayImpl, SIGNAL(readProgress(qint64,qint64)), SIGNAL(readProgress(qint64,qint64))); | - | ||||||||||||||||||||||||
| 141 | } executed 79 times by 3 tests: end of blockExecuted by:
| 79 | ||||||||||||||||||||||||
| 142 | - | |||||||||||||||||||||||||
| 143 | QNonContiguousByteDeviceBufferImpl::~QNonContiguousByteDeviceBufferImpl() | - | ||||||||||||||||||||||||
| 144 | { | - | ||||||||||||||||||||||||
| 145 | } | - | ||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||
| 147 | const char* QNonContiguousByteDeviceBufferImpl::readPointer(qint64 maximumLength, qint64 &len) | - | ||||||||||||||||||||||||
| 148 | { | - | ||||||||||||||||||||||||
| 149 | return arrayImpl->readPointer(maximumLength, len); executed 1306 times by 3 tests: return arrayImpl->readPointer(maximumLength, len);Executed by:
| 1306 | ||||||||||||||||||||||||
| 150 | } | - | ||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||
| 152 | bool QNonContiguousByteDeviceBufferImpl::advanceReadPointer(qint64 amount) | - | ||||||||||||||||||||||||
| 153 | { | - | ||||||||||||||||||||||||
| 154 | return arrayImpl->advanceReadPointer(amount); executed 1273 times by 2 tests: return arrayImpl->advanceReadPointer(amount);Executed by:
| 1273 | ||||||||||||||||||||||||
| 155 | } | - | ||||||||||||||||||||||||
| 156 | - | |||||||||||||||||||||||||
| 157 | bool QNonContiguousByteDeviceBufferImpl::atEnd() | - | ||||||||||||||||||||||||
| 158 | { | - | ||||||||||||||||||||||||
| 159 | return arrayImpl->atEnd(); executed 1051 times by 3 tests: return arrayImpl->atEnd();Executed by:
| 1051 | ||||||||||||||||||||||||
| 160 | } | - | ||||||||||||||||||||||||
| 161 | - | |||||||||||||||||||||||||
| 162 | bool QNonContiguousByteDeviceBufferImpl::reset() | - | ||||||||||||||||||||||||
| 163 | { | - | ||||||||||||||||||||||||
| 164 | return arrayImpl->reset(); executed 3 times by 1 test: return arrayImpl->reset();Executed by:
| 3 | ||||||||||||||||||||||||
| 165 | } | - | ||||||||||||||||||||||||
| 166 | - | |||||||||||||||||||||||||
| 167 | qint64 QNonContiguousByteDeviceBufferImpl::size() | - | ||||||||||||||||||||||||
| 168 | { | - | ||||||||||||||||||||||||
| 169 | return arrayImpl->size(); executed 1100 times by 3 tests: return arrayImpl->size();Executed by:
| 1100 | ||||||||||||||||||||||||
| 170 | } | - | ||||||||||||||||||||||||
| 171 | - | |||||||||||||||||||||||||
| 172 | QNonContiguousByteDeviceByteArrayImpl::QNonContiguousByteDeviceByteArrayImpl(QByteArray *ba) : QNonContiguousByteDevice(), currentPosition(0) | - | ||||||||||||||||||||||||
| 173 | { | - | ||||||||||||||||||||||||
| 174 | byteArray = ba; | - | ||||||||||||||||||||||||
| 175 | } executed 84 times by 4 tests: end of blockExecuted by:
| 84 | ||||||||||||||||||||||||
| 176 | - | |||||||||||||||||||||||||
| 177 | QNonContiguousByteDeviceByteArrayImpl::~QNonContiguousByteDeviceByteArrayImpl() | - | ||||||||||||||||||||||||
| 178 | { | - | ||||||||||||||||||||||||
| 179 | } | - | ||||||||||||||||||||||||
| 180 | - | |||||||||||||||||||||||||
| 181 | const char* QNonContiguousByteDeviceByteArrayImpl::readPointer(qint64 maximumLength, qint64 &len) | - | ||||||||||||||||||||||||
| 182 | { | - | ||||||||||||||||||||||||
| 183 | if (atEnd()) {
| 32-1278 | ||||||||||||||||||||||||
| 184 | len = -1; | - | ||||||||||||||||||||||||
| 185 | return 0; executed 32 times by 2 tests: return 0;Executed by:
| 32 | ||||||||||||||||||||||||
| 186 | } | - | ||||||||||||||||||||||||
| 187 | - | |||||||||||||||||||||||||
| 188 | if (maximumLength != -1)
| 6-1272 | ||||||||||||||||||||||||
| 189 | len = qMin(maximumLength, size() - currentPosition); executed 1272 times by 4 tests: len = qMin(maximumLength, size() - currentPosition);Executed by:
| 1272 | ||||||||||||||||||||||||
| 190 | else | - | ||||||||||||||||||||||||
| 191 | len = size() - currentPosition; executed 6 times by 1 test: len = size() - currentPosition;Executed by:
| 6 | ||||||||||||||||||||||||
| 192 | - | |||||||||||||||||||||||||
| 193 | return byteArray->constData() + currentPosition; executed 1278 times by 4 tests: return byteArray->constData() + currentPosition;Executed by:
| 1278 | ||||||||||||||||||||||||
| 194 | } | - | ||||||||||||||||||||||||
| 195 | - | |||||||||||||||||||||||||
| 196 | bool QNonContiguousByteDeviceByteArrayImpl::advanceReadPointer(qint64 amount) | - | ||||||||||||||||||||||||
| 197 | { | - | ||||||||||||||||||||||||
| 198 | currentPosition += amount; | - | ||||||||||||||||||||||||
| 199 | emit readProgress(currentPosition, size()); | - | ||||||||||||||||||||||||
| 200 | return true; executed 1277 times by 3 tests: return true;Executed by:
| 1277 | ||||||||||||||||||||||||
| 201 | } | - | ||||||||||||||||||||||||
| 202 | - | |||||||||||||||||||||||||
| 203 | bool QNonContiguousByteDeviceByteArrayImpl::atEnd() | - | ||||||||||||||||||||||||
| 204 | { | - | ||||||||||||||||||||||||
| 205 | return currentPosition >= size(); executed 2361 times by 4 tests: return currentPosition >= size();Executed by:
| 2361 | ||||||||||||||||||||||||
| 206 | } | - | ||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||
| 208 | bool QNonContiguousByteDeviceByteArrayImpl::reset() | - | ||||||||||||||||||||||||
| 209 | { | - | ||||||||||||||||||||||||
| 210 | currentPosition = 0; | - | ||||||||||||||||||||||||
| 211 | return true; executed 3 times by 1 test: return true;Executed by:
| 3 | ||||||||||||||||||||||||
| 212 | } | - | ||||||||||||||||||||||||
| 213 | - | |||||||||||||||||||||||||
| 214 | qint64 QNonContiguousByteDeviceByteArrayImpl::size() | - | ||||||||||||||||||||||||
| 215 | { | - | ||||||||||||||||||||||||
| 216 | return byteArray->size(); executed 6028 times by 4 tests: return byteArray->size();Executed by:
| 6028 | ||||||||||||||||||||||||
| 217 | } | - | ||||||||||||||||||||||||
| 218 | - | |||||||||||||||||||||||||
| 219 | qint64 QNonContiguousByteDeviceByteArrayImpl::pos() | - | ||||||||||||||||||||||||
| 220 | { | - | ||||||||||||||||||||||||
| 221 | return currentPosition; executed 4 times by 1 test: return currentPosition;Executed by:
| 4 | ||||||||||||||||||||||||
| 222 | } | - | ||||||||||||||||||||||||
| 223 | - | |||||||||||||||||||||||||
| 224 | QNonContiguousByteDeviceRingBufferImpl::QNonContiguousByteDeviceRingBufferImpl(QSharedPointer<QRingBuffer> rb) | - | ||||||||||||||||||||||||
| 225 | : QNonContiguousByteDevice(), currentPosition(0) | - | ||||||||||||||||||||||||
| 226 | { | - | ||||||||||||||||||||||||
| 227 | ringBuffer = rb; | - | ||||||||||||||||||||||||
| 228 | } executed 99 times by 1 test: end of blockExecuted by:
| 99 | ||||||||||||||||||||||||
| 229 | - | |||||||||||||||||||||||||
| 230 | QNonContiguousByteDeviceRingBufferImpl::~QNonContiguousByteDeviceRingBufferImpl() | - | ||||||||||||||||||||||||
| 231 | { | - | ||||||||||||||||||||||||
| 232 | } | - | ||||||||||||||||||||||||
| 233 | - | |||||||||||||||||||||||||
| 234 | const char* QNonContiguousByteDeviceRingBufferImpl::readPointer(qint64 maximumLength, qint64 &len) | - | ||||||||||||||||||||||||
| 235 | { | - | ||||||||||||||||||||||||
| 236 | if (atEnd()) {
| 0-892 | ||||||||||||||||||||||||
| 237 | len = -1; | - | ||||||||||||||||||||||||
| 238 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 239 | } | - | ||||||||||||||||||||||||
| 240 | - | |||||||||||||||||||||||||
| 241 | const char *returnValue = ringBuffer->readPointerAtPosition(currentPosition, len); | - | ||||||||||||||||||||||||
| 242 | - | |||||||||||||||||||||||||
| 243 | if (maximumLength != -1)
| 0-892 | ||||||||||||||||||||||||
| 244 | len = qMin(len, maximumLength); executed 892 times by 1 test: len = qMin(len, maximumLength);Executed by:
| 892 | ||||||||||||||||||||||||
| 245 | - | |||||||||||||||||||||||||
| 246 | return returnValue; executed 892 times by 1 test: return returnValue;Executed by:
| 892 | ||||||||||||||||||||||||
| 247 | } | - | ||||||||||||||||||||||||
| 248 | - | |||||||||||||||||||||||||
| 249 | bool QNonContiguousByteDeviceRingBufferImpl::advanceReadPointer(qint64 amount) | - | ||||||||||||||||||||||||
| 250 | { | - | ||||||||||||||||||||||||
| 251 | currentPosition += amount; | - | ||||||||||||||||||||||||
| 252 | emit readProgress(currentPosition, size()); | - | ||||||||||||||||||||||||
| 253 | return true; executed 892 times by 1 test: return true;Executed by:
| 892 | ||||||||||||||||||||||||
| 254 | } | - | ||||||||||||||||||||||||
| 255 | - | |||||||||||||||||||||||||
| 256 | bool QNonContiguousByteDeviceRingBufferImpl::atEnd() | - | ||||||||||||||||||||||||
| 257 | { | - | ||||||||||||||||||||||||
| 258 | return currentPosition >= size(); executed 1126 times by 1 test: return currentPosition >= size();Executed by:
| 1126 | ||||||||||||||||||||||||
| 259 | } | - | ||||||||||||||||||||||||
| 260 | - | |||||||||||||||||||||||||
| 261 | qint64 QNonContiguousByteDeviceRingBufferImpl::pos() | - | ||||||||||||||||||||||||
| 262 | { | - | ||||||||||||||||||||||||
| 263 | return currentPosition; executed 716 times by 1 test: return currentPosition;Executed by:
| 716 | ||||||||||||||||||||||||
| 264 | } | - | ||||||||||||||||||||||||
| 265 | - | |||||||||||||||||||||||||
| 266 | bool QNonContiguousByteDeviceRingBufferImpl::reset() | - | ||||||||||||||||||||||||
| 267 | { | - | ||||||||||||||||||||||||
| 268 | currentPosition = 0; | - | ||||||||||||||||||||||||
| 269 | return true; executed 117 times by 1 test: return true;Executed by:
| 117 | ||||||||||||||||||||||||
| 270 | } | - | ||||||||||||||||||||||||
| 271 | - | |||||||||||||||||||||||||
| 272 | qint64 QNonContiguousByteDeviceRingBufferImpl::size() | - | ||||||||||||||||||||||||
| 273 | { | - | ||||||||||||||||||||||||
| 274 | return ringBuffer->size(); executed 2334 times by 1 test: return ringBuffer->size();Executed by:
| 2334 | ||||||||||||||||||||||||
| 275 | } | - | ||||||||||||||||||||||||
| 276 | - | |||||||||||||||||||||||||
| 277 | QNonContiguousByteDeviceIoDeviceImpl::QNonContiguousByteDeviceIoDeviceImpl(QIODevice *d) | - | ||||||||||||||||||||||||
| 278 | : QNonContiguousByteDevice(), | - | ||||||||||||||||||||||||
| 279 | currentReadBuffer(0), currentReadBufferSize(16*1024), | - | ||||||||||||||||||||||||
| 280 | currentReadBufferAmount(0), currentReadBufferPosition(0), totalAdvancements(0), | - | ||||||||||||||||||||||||
| 281 | eof(false) | - | ||||||||||||||||||||||||
| 282 | { | - | ||||||||||||||||||||||||
| 283 | device = d; | - | ||||||||||||||||||||||||
| 284 | initialPosition = d->pos(); | - | ||||||||||||||||||||||||
| 285 | connect(device, SIGNAL(readyRead()), this, SIGNAL(readyRead()), Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 286 | connect(device, SIGNAL(readChannelFinished()), this, SIGNAL(readyRead()), Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 287 | } executed 77 times by 2 tests: end of blockExecuted by:
| 77 | ||||||||||||||||||||||||
| 288 | - | |||||||||||||||||||||||||
| 289 | QNonContiguousByteDeviceIoDeviceImpl::~QNonContiguousByteDeviceIoDeviceImpl() | - | ||||||||||||||||||||||||
| 290 | { | - | ||||||||||||||||||||||||
| 291 | delete currentReadBuffer; | - | ||||||||||||||||||||||||
| 292 | } executed 77 times by 2 tests: end of blockExecuted by:
| 77 | ||||||||||||||||||||||||
| 293 | - | |||||||||||||||||||||||||
| 294 | const char* QNonContiguousByteDeviceIoDeviceImpl::readPointer(qint64 maximumLength, qint64 &len) | - | ||||||||||||||||||||||||
| 295 | { | - | ||||||||||||||||||||||||
| 296 | if (eof == true) {
| 0-2250 | ||||||||||||||||||||||||
| 297 | len = -1; | - | ||||||||||||||||||||||||
| 298 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 299 | } | - | ||||||||||||||||||||||||
| 300 | - | |||||||||||||||||||||||||
| 301 | if (currentReadBuffer == 0)
| 77-2173 | ||||||||||||||||||||||||
| 302 | currentReadBuffer = new QByteArray(currentReadBufferSize, '\0'); // lazy alloc executed 77 times by 2 tests: currentReadBuffer = new QByteArray(currentReadBufferSize, '\0');Executed by:
| 77 | ||||||||||||||||||||||||
| 303 | - | |||||||||||||||||||||||||
| 304 | if (maximumLength == -1)
| 698-1552 | ||||||||||||||||||||||||
| 305 | maximumLength = currentReadBufferSize; executed 698 times by 1 test: maximumLength = currentReadBufferSize;Executed by:
| 698 | ||||||||||||||||||||||||
| 306 | - | |||||||||||||||||||||||||
| 307 | if (currentReadBufferAmount - currentReadBufferPosition > 0) {
| 0-2250 | ||||||||||||||||||||||||
| 308 | len = currentReadBufferAmount - currentReadBufferPosition; | - | ||||||||||||||||||||||||
| 309 | return currentReadBuffer->data() + currentReadBufferPosition; never executed: return currentReadBuffer->data() + currentReadBufferPosition; | 0 | ||||||||||||||||||||||||
| 310 | } | - | ||||||||||||||||||||||||
| 311 | - | |||||||||||||||||||||||||
| 312 | qint64 haveRead = device->read(currentReadBuffer->data(), qMin(maximumLength, currentReadBufferSize)); | - | ||||||||||||||||||||||||
| 313 | - | |||||||||||||||||||||||||
| 314 | if ((haveRead == -1) || (haveRead == 0 && device->atEnd() && !device->isSequential())) {
| 4-2222 | ||||||||||||||||||||||||
| 315 | eof = true; | - | ||||||||||||||||||||||||
| 316 | len = -1; | - | ||||||||||||||||||||||||
| 317 | // size was unknown before, emit a readProgress with the final size | - | ||||||||||||||||||||||||
| 318 | if (size() == -1)
| 11-28 | ||||||||||||||||||||||||
| 319 | emit readProgress(totalAdvancements, totalAdvancements); executed 28 times by 1 test: readProgress(totalAdvancements, totalAdvancements);Executed by:
| 28 | ||||||||||||||||||||||||
| 320 | return 0; executed 39 times by 2 tests: return 0;Executed by:
| 39 | ||||||||||||||||||||||||
| 321 | } | - | ||||||||||||||||||||||||
| 322 | - | |||||||||||||||||||||||||
| 323 | currentReadBufferAmount = haveRead; | - | ||||||||||||||||||||||||
| 324 | currentReadBufferPosition = 0; | - | ||||||||||||||||||||||||
| 325 | - | |||||||||||||||||||||||||
| 326 | len = haveRead; | - | ||||||||||||||||||||||||
| 327 | return currentReadBuffer->data(); executed 2211 times by 2 tests: return currentReadBuffer->data();Executed by:
| 2211 | ||||||||||||||||||||||||
| 328 | } | - | ||||||||||||||||||||||||
| 329 | - | |||||||||||||||||||||||||
| 330 | bool QNonContiguousByteDeviceIoDeviceImpl::advanceReadPointer(qint64 amount) | - | ||||||||||||||||||||||||
| 331 | { | - | ||||||||||||||||||||||||
| 332 | totalAdvancements += amount; | - | ||||||||||||||||||||||||
| 333 | - | |||||||||||||||||||||||||
| 334 | // normal advancement | - | ||||||||||||||||||||||||
| 335 | currentReadBufferPosition += amount; | - | ||||||||||||||||||||||||
| 336 | - | |||||||||||||||||||||||||
| 337 | if (size() == -1)
| 577-1545 | ||||||||||||||||||||||||
| 338 | emit readProgress(totalAdvancements, totalAdvancements); executed 577 times by 1 test: readProgress(totalAdvancements, totalAdvancements);Executed by:
| 577 | ||||||||||||||||||||||||
| 339 | else | - | ||||||||||||||||||||||||
| 340 | emit readProgress(totalAdvancements, size()); executed 1545 times by 2 tests: readProgress(totalAdvancements, size());Executed by:
| 1545 | ||||||||||||||||||||||||
| 341 | - | |||||||||||||||||||||||||
| 342 | // advancing over that what has actually been read before | - | ||||||||||||||||||||||||
| 343 | if (currentReadBufferPosition > currentReadBufferAmount) {
| 0-2122 | ||||||||||||||||||||||||
| 344 | qint64 i = currentReadBufferPosition - currentReadBufferAmount; | - | ||||||||||||||||||||||||
| 345 | while (i > 0) {
| 0 | ||||||||||||||||||||||||
| 346 | if (device->getChar(0) == false) {
| 0 | ||||||||||||||||||||||||
| 347 | emit readProgress(totalAdvancements - i, size()); | - | ||||||||||||||||||||||||
| 348 | return false; // ### FIXME handle eof never executed: return false; | 0 | ||||||||||||||||||||||||
| 349 | } | - | ||||||||||||||||||||||||
| 350 | i--; | - | ||||||||||||||||||||||||
| 351 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 352 | - | |||||||||||||||||||||||||
| 353 | currentReadBufferPosition = 0; | - | ||||||||||||||||||||||||
| 354 | currentReadBufferAmount = 0; | - | ||||||||||||||||||||||||
| 355 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 356 | - | |||||||||||||||||||||||||
| 357 | - | |||||||||||||||||||||||||
| 358 | return true; executed 2122 times by 2 tests: return true;Executed by:
| 2122 | ||||||||||||||||||||||||
| 359 | } | - | ||||||||||||||||||||||||
| 360 | - | |||||||||||||||||||||||||
| 361 | bool QNonContiguousByteDeviceIoDeviceImpl::atEnd() | - | ||||||||||||||||||||||||
| 362 | { | - | ||||||||||||||||||||||||
| 363 | return eof == true; executed 1580 times by 2 tests: return eof == true;Executed by:
| 1580 | ||||||||||||||||||||||||
| 364 | } | - | ||||||||||||||||||||||||
| 365 | - | |||||||||||||||||||||||||
| 366 | bool QNonContiguousByteDeviceIoDeviceImpl::reset() | - | ||||||||||||||||||||||||
| 367 | { | - | ||||||||||||||||||||||||
| 368 | bool reset = (initialPosition == 0) ? device->reset() : device->seek(initialPosition);
| 1-6 | ||||||||||||||||||||||||
| 369 | if (reset) {
| 1-6 | ||||||||||||||||||||||||
| 370 | eof = false; // assume eof is false, it will be true after a read has been attempted | - | ||||||||||||||||||||||||
| 371 | totalAdvancements = 0; //reset the progress counter | - | ||||||||||||||||||||||||
| 372 | if (currentReadBuffer) {
| 2-4 | ||||||||||||||||||||||||
| 373 | delete currentReadBuffer; | - | ||||||||||||||||||||||||
| 374 | currentReadBuffer = 0; | - | ||||||||||||||||||||||||
| 375 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 376 | currentReadBufferAmount = 0; | - | ||||||||||||||||||||||||
| 377 | currentReadBufferPosition = 0; | - | ||||||||||||||||||||||||
| 378 | return true; executed 6 times by 1 test: return true;Executed by:
| 6 | ||||||||||||||||||||||||
| 379 | } | - | ||||||||||||||||||||||||
| 380 | - | |||||||||||||||||||||||||
| 381 | return false; executed 1 time by 1 test: return false;Executed by:
| 1 | ||||||||||||||||||||||||
| 382 | } | - | ||||||||||||||||||||||||
| 383 | - | |||||||||||||||||||||||||
| 384 | qint64 QNonContiguousByteDeviceIoDeviceImpl::size() | - | ||||||||||||||||||||||||
| 385 | { | - | ||||||||||||||||||||||||
| 386 | // note that this is different from the size() implementation of QIODevice! | - | ||||||||||||||||||||||||
| 387 | - | |||||||||||||||||||||||||
| 388 | if (device->isSequential())
| 607-4707 | ||||||||||||||||||||||||
| 389 | return -1; executed 607 times by 1 test: return -1;Executed by:
| 607 | ||||||||||||||||||||||||
| 390 | - | |||||||||||||||||||||||||
| 391 | return device->size() - initialPosition; executed 4707 times by 2 tests: return device->size() - initialPosition;Executed by:
| 4707 | ||||||||||||||||||||||||
| 392 | } | - | ||||||||||||||||||||||||
| 393 | - | |||||||||||||||||||||||||
| 394 | qint64 QNonContiguousByteDeviceIoDeviceImpl::pos() | - | ||||||||||||||||||||||||
| 395 | { | - | ||||||||||||||||||||||||
| 396 | if (device->isSequential())
| 0 | ||||||||||||||||||||||||
| 397 | return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||
| 399 | return device->pos(); never executed: return device->pos(); | 0 | ||||||||||||||||||||||||
| 400 | } | - | ||||||||||||||||||||||||
| 401 | - | |||||||||||||||||||||||||
| 402 | QByteDeviceWrappingIoDevice::QByteDeviceWrappingIoDevice(QNonContiguousByteDevice *bd) : QIODevice((QObject*)0) | - | ||||||||||||||||||||||||
| 403 | { | - | ||||||||||||||||||||||||
| 404 | byteDevice = bd; | - | ||||||||||||||||||||||||
| 405 | connect(bd, SIGNAL(readyRead()), SIGNAL(readyRead())); | - | ||||||||||||||||||||||||
| 406 | - | |||||||||||||||||||||||||
| 407 | open(ReadOnly); | - | ||||||||||||||||||||||||
| 408 | } executed 13 times by 1 test: end of blockExecuted by:
| 13 | ||||||||||||||||||||||||
| 409 | - | |||||||||||||||||||||||||
| 410 | QByteDeviceWrappingIoDevice::~QByteDeviceWrappingIoDevice() | - | ||||||||||||||||||||||||
| 411 | { | - | ||||||||||||||||||||||||
| 412 | - | |||||||||||||||||||||||||
| 413 | } | - | ||||||||||||||||||||||||
| 414 | - | |||||||||||||||||||||||||
| 415 | bool QByteDeviceWrappingIoDevice::isSequential() const | - | ||||||||||||||||||||||||
| 416 | { | - | ||||||||||||||||||||||||
| 417 | return (byteDevice->size() == -1); executed 55 times by 1 test: return (byteDevice->size() == -1);Executed by:
| 55 | ||||||||||||||||||||||||
| 418 | } | - | ||||||||||||||||||||||||
| 419 | - | |||||||||||||||||||||||||
| 420 | bool QByteDeviceWrappingIoDevice::atEnd() const | - | ||||||||||||||||||||||||
| 421 | { | - | ||||||||||||||||||||||||
| 422 | return byteDevice->atEnd(); never executed: return byteDevice->atEnd(); | 0 | ||||||||||||||||||||||||
| 423 | } | - | ||||||||||||||||||||||||
| 424 | - | |||||||||||||||||||||||||
| 425 | bool QByteDeviceWrappingIoDevice::reset() | - | ||||||||||||||||||||||||
| 426 | { | - | ||||||||||||||||||||||||
| 427 | return byteDevice->reset(); never executed: return byteDevice->reset(); | 0 | ||||||||||||||||||||||||
| 428 | } | - | ||||||||||||||||||||||||
| 429 | - | |||||||||||||||||||||||||
| 430 | qint64 QByteDeviceWrappingIoDevice::size() const | - | ||||||||||||||||||||||||
| 431 | { | - | ||||||||||||||||||||||||
| 432 | if (isSequential())
| 0-22 | ||||||||||||||||||||||||
| 433 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 434 | - | |||||||||||||||||||||||||
| 435 | return byteDevice->size(); executed 22 times by 1 test: return byteDevice->size();Executed by:
| 22 | ||||||||||||||||||||||||
| 436 | } | - | ||||||||||||||||||||||||
| 437 | - | |||||||||||||||||||||||||
| 438 | - | |||||||||||||||||||||||||
| 439 | qint64 QByteDeviceWrappingIoDevice::readData( char * data, qint64 maxSize) | - | ||||||||||||||||||||||||
| 440 | { | - | ||||||||||||||||||||||||
| 441 | qint64 len; | - | ||||||||||||||||||||||||
| 442 | const char *readPointer = byteDevice->readPointer(maxSize, len); | - | ||||||||||||||||||||||||
| 443 | if (len == -1)
| 11-147 | ||||||||||||||||||||||||
| 444 | return -1; executed 11 times by 1 test: return -1;Executed by:
| 11 | ||||||||||||||||||||||||
| 445 | - | |||||||||||||||||||||||||
| 446 | memcpy(data, readPointer, len); | - | ||||||||||||||||||||||||
| 447 | byteDevice->advanceReadPointer(len); | - | ||||||||||||||||||||||||
| 448 | return len; executed 147 times by 1 test: return len;Executed by:
| 147 | ||||||||||||||||||||||||
| 449 | } | - | ||||||||||||||||||||||||
| 450 | - | |||||||||||||||||||||||||
| 451 | qint64 QByteDeviceWrappingIoDevice::writeData( const char* data, qint64 maxSize) | - | ||||||||||||||||||||||||
| 452 | { | - | ||||||||||||||||||||||||
| 453 | Q_UNUSED(data); | - | ||||||||||||||||||||||||
| 454 | Q_UNUSED(maxSize); | - | ||||||||||||||||||||||||
| 455 | return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
| 456 | } | - | ||||||||||||||||||||||||
| 457 | - | |||||||||||||||||||||||||
| 458 | /*! | - | ||||||||||||||||||||||||
| 459 | \class QNonContiguousByteDeviceFactory | - | ||||||||||||||||||||||||
| 460 | \inmodule QtCore | - | ||||||||||||||||||||||||
| 461 | \since 4.6 | - | ||||||||||||||||||||||||
| 462 | - | |||||||||||||||||||||||||
| 463 | Creates a QNonContiguousByteDevice out of a QIODevice, | - | ||||||||||||||||||||||||
| 464 | QByteArray etc. | - | ||||||||||||||||||||||||
| 465 | - | |||||||||||||||||||||||||
| 466 | \sa QNonContiguousByteDevice | - | ||||||||||||||||||||||||
| 467 | - | |||||||||||||||||||||||||
| 468 | \internal | - | ||||||||||||||||||||||||
| 469 | */ | - | ||||||||||||||||||||||||
| 470 | - | |||||||||||||||||||||||||
| 471 | /*! | - | ||||||||||||||||||||||||
| 472 | \fn static QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QIODevice *device) | - | ||||||||||||||||||||||||
| 473 | - | |||||||||||||||||||||||||
| 474 | Create a QNonContiguousByteDevice out of a QIODevice. | - | ||||||||||||||||||||||||
| 475 | For QFile, QBuffer and all other QIoDevice, sequential or not. | - | ||||||||||||||||||||||||
| 476 | - | |||||||||||||||||||||||||
| 477 | \internal | - | ||||||||||||||||||||||||
| 478 | */ | - | ||||||||||||||||||||||||
| 479 | QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QIODevice *device) | - | ||||||||||||||||||||||||
| 480 | { | - | ||||||||||||||||||||||||
| 481 | // shortcut if it is a QBuffer | - | ||||||||||||||||||||||||
| 482 | if (QBuffer* buffer = qobject_cast<QBuffer*>(device)) {
| 0 | ||||||||||||||||||||||||
| 483 | return new QNonContiguousByteDeviceBufferImpl(buffer); never executed: return new QNonContiguousByteDeviceBufferImpl(buffer); | 0 | ||||||||||||||||||||||||
| 484 | } | - | ||||||||||||||||||||||||
| 485 | - | |||||||||||||||||||||||||
| 486 | // ### FIXME special case if device is a QFile that supports map() | - | ||||||||||||||||||||||||
| 487 | // then we can actually deal with the file without using read/peek | - | ||||||||||||||||||||||||
| 488 | - | |||||||||||||||||||||||||
| 489 | // generic QIODevice | - | ||||||||||||||||||||||||
| 490 | return new QNonContiguousByteDeviceIoDeviceImpl(device); // FIXME never executed: return new QNonContiguousByteDeviceIoDeviceImpl(device); | 0 | ||||||||||||||||||||||||
| 491 | } | - | ||||||||||||||||||||||||
| 492 | - | |||||||||||||||||||||||||
| 493 | /*! | - | ||||||||||||||||||||||||
| 494 | Create a QNonContiguousByteDevice out of a QIODevice, return it in a QSharedPointer. | - | ||||||||||||||||||||||||
| 495 | For QFile, QBuffer and all other QIODevice, sequential or not. | - | ||||||||||||||||||||||||
| 496 | - | |||||||||||||||||||||||||
| 497 | \internal | - | ||||||||||||||||||||||||
| 498 | */ | - | ||||||||||||||||||||||||
| 499 | QSharedPointer<QNonContiguousByteDevice> QNonContiguousByteDeviceFactory::createShared(QIODevice *device) | - | ||||||||||||||||||||||||
| 500 | { | - | ||||||||||||||||||||||||
| 501 | // shortcut if it is a QBuffer | - | ||||||||||||||||||||||||
| 502 | if (QBuffer *buffer = qobject_cast<QBuffer*>(device))
| 77-79 | ||||||||||||||||||||||||
| 503 | return QSharedPointer<QNonContiguousByteDeviceBufferImpl>::create(buffer); executed 79 times by 3 tests: return QSharedPointer<QNonContiguousByteDeviceBufferImpl>::create(buffer);Executed by:
| 79 | ||||||||||||||||||||||||
| 504 | - | |||||||||||||||||||||||||
| 505 | // ### FIXME special case if device is a QFile that supports map() | - | ||||||||||||||||||||||||
| 506 | // then we can actually deal with the file without using read/peek | - | ||||||||||||||||||||||||
| 507 | - | |||||||||||||||||||||||||
| 508 | // generic QIODevice | - | ||||||||||||||||||||||||
| 509 | return QSharedPointer<QNonContiguousByteDeviceIoDeviceImpl>::create(device); // FIXME executed 77 times by 2 tests: return QSharedPointer<QNonContiguousByteDeviceIoDeviceImpl>::create(device);Executed by:
| 77 | ||||||||||||||||||||||||
| 510 | } | - | ||||||||||||||||||||||||
| 511 | - | |||||||||||||||||||||||||
| 512 | /*! | - | ||||||||||||||||||||||||
| 513 | \fn static QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QSharedPointer<QRingBuffer> ringBuffer) | - | ||||||||||||||||||||||||
| 514 | - | |||||||||||||||||||||||||
| 515 | Create a QNonContiguousByteDevice out of a QRingBuffer. | - | ||||||||||||||||||||||||
| 516 | - | |||||||||||||||||||||||||
| 517 | \internal | - | ||||||||||||||||||||||||
| 518 | */ | - | ||||||||||||||||||||||||
| 519 | QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QSharedPointer<QRingBuffer> ringBuffer) | - | ||||||||||||||||||||||||
| 520 | { | - | ||||||||||||||||||||||||
| 521 | return new QNonContiguousByteDeviceRingBufferImpl(ringBuffer); never executed: return new QNonContiguousByteDeviceRingBufferImpl(ringBuffer); | 0 | ||||||||||||||||||||||||
| 522 | } | - | ||||||||||||||||||||||||
| 523 | - | |||||||||||||||||||||||||
| 524 | /*! | - | ||||||||||||||||||||||||
| 525 | Create a QNonContiguousByteDevice out of a QRingBuffer, return it in a QSharedPointer. | - | ||||||||||||||||||||||||
| 526 | - | |||||||||||||||||||||||||
| 527 | \internal | - | ||||||||||||||||||||||||
| 528 | */ | - | ||||||||||||||||||||||||
| 529 | QSharedPointer<QNonContiguousByteDevice> QNonContiguousByteDeviceFactory::createShared(QSharedPointer<QRingBuffer> ringBuffer) | - | ||||||||||||||||||||||||
| 530 | { | - | ||||||||||||||||||||||||
| 531 | return QSharedPointer<QNonContiguousByteDeviceRingBufferImpl>::create(qMove(ringBuffer)); executed 99 times by 1 test: return QSharedPointer<QNonContiguousByteDeviceRingBufferImpl>::create(std::move(ringBuffer));Executed by:
| 99 | ||||||||||||||||||||||||
| 532 | } | - | ||||||||||||||||||||||||
| 533 | - | |||||||||||||||||||||||||
| 534 | /*! | - | ||||||||||||||||||||||||
| 535 | \fn static QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QByteArray *byteArray) | - | ||||||||||||||||||||||||
| 536 | - | |||||||||||||||||||||||||
| 537 | Create a QNonContiguousByteDevice out of a QByteArray. | - | ||||||||||||||||||||||||
| 538 | - | |||||||||||||||||||||||||
| 539 | \internal | - | ||||||||||||||||||||||||
| 540 | */ | - | ||||||||||||||||||||||||
| 541 | QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QByteArray *byteArray) | - | ||||||||||||||||||||||||
| 542 | { | - | ||||||||||||||||||||||||
| 543 | return new QNonContiguousByteDeviceByteArrayImpl(byteArray); executed 5 times by 1 test: return new QNonContiguousByteDeviceByteArrayImpl(byteArray);Executed by:
| 5 | ||||||||||||||||||||||||
| 544 | } | - | ||||||||||||||||||||||||
| 545 | - | |||||||||||||||||||||||||
| 546 | /*! | - | ||||||||||||||||||||||||
| 547 | Create a QNonContiguousByteDevice out of a QByteArray. | - | ||||||||||||||||||||||||
| 548 | - | |||||||||||||||||||||||||
| 549 | \internal | - | ||||||||||||||||||||||||
| 550 | */ | - | ||||||||||||||||||||||||
| 551 | QSharedPointer<QNonContiguousByteDevice> QNonContiguousByteDeviceFactory::createShared(QByteArray *byteArray) | - | ||||||||||||||||||||||||
| 552 | { | - | ||||||||||||||||||||||||
| 553 | return QSharedPointer<QNonContiguousByteDeviceByteArrayImpl>::create(byteArray); never executed: return QSharedPointer<QNonContiguousByteDeviceByteArrayImpl>::create(byteArray); | 0 | ||||||||||||||||||||||||
| 554 | } | - | ||||||||||||||||||||||||
| 555 | - | |||||||||||||||||||||||||
| 556 | /*! | - | ||||||||||||||||||||||||
| 557 | \fn static QIODevice* QNonContiguousByteDeviceFactory::wrap(QNonContiguousByteDevice* byteDevice) | - | ||||||||||||||||||||||||
| 558 | - | |||||||||||||||||||||||||
| 559 | Wrap the \a byteDevice (possibly again) into a QIODevice. | - | ||||||||||||||||||||||||
| 560 | - | |||||||||||||||||||||||||
| 561 | \internal | - | ||||||||||||||||||||||||
| 562 | */ | - | ||||||||||||||||||||||||
| 563 | QIODevice* QNonContiguousByteDeviceFactory::wrap(QNonContiguousByteDevice* byteDevice) | - | ||||||||||||||||||||||||
| 564 | { | - | ||||||||||||||||||||||||
| 565 | // ### FIXME if it already has been based on QIoDevice, we could that one out again | - | ||||||||||||||||||||||||
| 566 | // and save some calling | - | ||||||||||||||||||||||||
| 567 | - | |||||||||||||||||||||||||
| 568 | // needed for FTP backend | - | ||||||||||||||||||||||||
| 569 | - | |||||||||||||||||||||||||
| 570 | return new QByteDeviceWrappingIoDevice(byteDevice); executed 13 times by 1 test: return new QByteDeviceWrappingIoDevice(byteDevice);Executed by:
| 13 | ||||||||||||||||||||||||
| 571 | } | - | ||||||||||||||||||||||||
| 572 | - | |||||||||||||||||||||||||
| 573 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||
| 574 | - | |||||||||||||||||||||||||
| Source code | Switch to Preprocessed file |