LeechCraft
0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
|
A network reply with customizable content and reply headers. More...
#include "customnetworkreply.h"
Public Member Functions | |
CustomNetworkReply (const QUrl &url, QObject *parent=nullptr) | |
Creates the reply with the given url and parent. More... | |
void | SetContentType (const QByteArray &type) |
Sets the content type of this reply. More... | |
void | SetContent (const QString &string) |
Sets content of this reply to the given string. More... | |
void | SetContent (const QByteArray &data) |
Sets content of this reply to the given data. More... | |
void | abort () override |
Reimplemented from QNetworkReply::abort(). More... | |
qint64 | bytesAvailable () const override |
Reimplemented from QNetworkReply::bytesAvailable(). More... | |
bool | isSequential () const override |
Reimplemented from QNetworkReply::isSequential(). More... | |
Protected Member Functions | |
qint64 | readData (char *, qint64) override |
A network reply with customizable content and reply headers.
This class provides a custom network reply with settable content and headers. It can be used, for example, in a plugin that renders local filesystem to QNetworkAccessManager-enabled plugins, or that just needs to provide a network reply with a predefined or runtime-generated string.
Definition at line 32 of file customnetworkreply.h.
|
explicit |
Creates the reply with the given url and parent.
Sets the URL of this reply to be url. This URL will be returned by QNetworkReply::url()
[in] | url | The URL this custom reply corresponds to. |
[in] | parent | The parent object of this object. |
Definition at line 21 of file customnetworkreply.cpp.
|
override |
Reimplemented from QNetworkReply::abort().
This function does nothing.
Definition at line 54 of file customnetworkreply.cpp.
|
override |
Reimplemented from QNetworkReply::bytesAvailable().
This function returns the number of bytes left unread.
Definition at line 58 of file customnetworkreply.cpp.
Referenced by isSequential().
|
override |
Reimplemented from QNetworkReply::isSequential().
This function always returns true
.
Definition at line 63 of file customnetworkreply.cpp.
References bytesAvailable(), and LC::Util::oral::sph::min.
|
overrideprotected |
Definition at line 68 of file customnetworkreply.cpp.
void LC::Util::CustomNetworkReply::SetContent | ( | const QByteArray & | data | ) |
Sets content of this reply to the given data.
This function sets the content of this reply to the given data, updates the Content-Length header and schedules emission of the readyRead()
and finished()
signals next time control reaches the event loop.
[in] | data | The data this network reply should contain. |
Definition at line 37 of file customnetworkreply.cpp.
void LC::Util::CustomNetworkReply::SetContent | ( | const QString & | string | ) |
Sets content of this reply to the given string.
This convenience function is equivalent to
[in] | string | The string to set. |
Definition at line 32 of file customnetworkreply.cpp.
Referenced by SetContentType().
void LC::Util::CustomNetworkReply::SetContentType | ( | const QByteArray & | type | ) |
Sets the content type of this reply.
This function sets the Content-Type header to type.
It is equivalent to
Definition at line 27 of file customnetworkreply.cpp.
References SetContent().