Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
#include <qdecompresshelper_p.h>
Public Types | |
enum | ContentEncoding { None , Deflate , GZip , Brotli , Zstandard } |
Public Member Functions | |
QDecompressHelper ()=default | |
~QDecompressHelper () | |
bool | setEncoding (QByteArrayView contentEncoding) |
bool | isCountingBytes () const |
void | setCountingBytesEnabled (bool shouldCount) |
qint64 | uncompressedSize () const |
bool | hasData () const |
void | feed (const QByteArray &data) |
void | feed (QByteArray &&data) |
void | feed (const QByteDataBuffer &buffer) |
void | feed (QByteDataBuffer &&buffer) |
qsizetype | read (char *data, qsizetype maxSize) |
bool | isValid () const |
void | clear () |
void | setDecompressedSafetyCheckThreshold (qint64 threshold) |
QString | errorString () const |
Static Public Member Functions | |
static bool | isSupportedEncoding (QByteArrayView encoding) |
static QByteArrayList | acceptedEncoding () |
Definition at line 26 of file qdecompresshelper_p.h.
Enumerator | |
---|---|
None | |
Deflate | |
GZip | |
Brotli | |
Zstandard |
Definition at line 29 of file qdecompresshelper_p.h.
|
default |
QDecompressHelper::~QDecompressHelper | ( | ) |
Definition at line 85 of file qdecompresshelper.cpp.
References clear().
|
static |
Definition at line 75 of file qdecompresshelper.cpp.
References list, and QList< T >::reserve().
Referenced by QHttpNetworkConnectionPrivate::prepareRequest().
void QDecompressHelper::clear | ( | ) |
Definition at line 513 of file qdecompresshelper.cpp.
References Brotli, QByteDataBuffer::clear(), QString::clear(), Deflate, GZip, None, and Zstandard.
Referenced by ~QDecompressHelper(), feed(), feed(), feed(), QNetworkReplyHttpImplPrivate::followRedirect(), and QNetworkReplyHttpImplPrivate::replyDownloadData().
QString QDecompressHelper::errorString | ( | ) | const |
Returns a string describing the error that occurred or an empty string if no error occurred.
Definition at line 508 of file qdecompresshelper.cpp.
Referenced by QNetworkReplyHttpImplPrivate::replyDownloadData(), and QNetworkReplyHttpImplPrivate::replyDownloadMetaData().
void QDecompressHelper::feed | ( | const QByteArray & | data | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 218 of file qdecompresshelper.cpp.
References feed(), and QByteArray().
Referenced by feed(), and QNetworkReplyHttpImplPrivate::replyDownloadData().
void QDecompressHelper::feed | ( | const QByteDataBuffer & | buffer | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 245 of file qdecompresshelper.cpp.
References QByteDataBuffer::append(), clear(), None, and Q_ASSERT.
void QDecompressHelper::feed | ( | QByteArray && | data | ) |
Give data to the QDecompressHelper which will be stored until a read is attempted.
If isCountingBytes()
is true then it will decompress immediately before discarding the data, but will count the uncompressed byte size.
Definition at line 232 of file qdecompresshelper.cpp.
References QByteDataBuffer::append(), QByteDataBuffer::bufferCount(), clear(), None, and Q_ASSERT.
void QDecompressHelper::feed | ( | QByteDataBuffer && | buffer | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 258 of file qdecompresshelper.cpp.
References QByteDataBuffer::append(), clear(), copy(), None, and Q_ASSERT.
bool QDecompressHelper::hasData | ( | ) | const |
Returns true if there are encoded bytes left or there is some indication that the decoder still has data left internally.
Definition at line 470 of file qdecompresshelper.cpp.
References QByteDataBuffer::isEmpty().
Referenced by read(), and QNetworkReplyHttpImplPrivate::replyDownloadData().
bool QDecompressHelper::isCountingBytes | ( | ) | const |
Returns true if the QDecompressHelper is measuring the size of the decompressed data.
Definition at line 162 of file qdecompresshelper.cpp.
Referenced by QNetworkReplyHttpImplPrivate::replyDownloadData().
|
static |
Definition at line 70 of file qdecompresshelper.cpp.
References None.
Referenced by QHttpNetworkReplyPrivate::isCompressed().
bool QDecompressHelper::isValid | ( | ) | const |
Returns whether or not the object is valid. If it becomes invalid after an operation has been performed then an error has occurred.
Definition at line 497 of file qdecompresshelper.cpp.
References None.
Referenced by QNetworkReplyHttpImplPrivate::finished(), read(), QNetworkReplyHttpImplPrivate::replyDownloadData(), and QNetworkReplyHttpImplPrivate::replyDownloadMetaData().
Definition at line 343 of file qdecompresshelper.cpp.
References hasData(), QByteDataBuffer::isEmpty(), isValid(), and QByteDataBuffer::read().
Referenced by QNetworkReplyHttpImplPrivate::replyDownloadData().
void QDecompressHelper::setCountingBytesEnabled | ( | bool | shouldCount | ) |
Enable or disable counting the decompressed size of the data based on shouldCount. Enabling this means the data will be decompressed twice (once for counting and once when data is being read).
Definition at line 180 of file qdecompresshelper.cpp.
References QByteDataBuffer::byteAmount(), None, and Q_ASSERT.
Referenced by QNetworkReplyHttpImplPrivate::replyDownloadMetaData().
Set the threshold required before the archive bomb detection kicks in. By default this is 10MB. Setting it to -1 is treated as disabling the feature.
Definition at line 420 of file qdecompresshelper.cpp.
Referenced by QNetworkReplyHttpImplPrivate::replyDownloadMetaData().
bool QDecompressHelper::setEncoding | ( | QByteArrayView | contentEncoding | ) |
Definition at line 90 of file qdecompresshelper.cpp.
References None, Q_ASSERT, qWarning, setEncoding(), and QCoreApplication::translate().
Referenced by QNetworkReplyHttpImplPrivate::replyDownloadMetaData(), and setEncoding().
qint64 QDecompressHelper::uncompressedSize | ( | ) | const |
Returns the amount of uncompressed bytes left.
Definition at line 202 of file qdecompresshelper.cpp.
References Q_ASSERT.
Referenced by QNetworkReplyHttpImplPrivate::replyDownloadData().