LeechCraft 0.6.70-17609-g3dde4097dd
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
LC::Util::CustomNetworkReply Class Reference

A network reply with customizable content and reply headers. More...

#include "customnetworkreply.h"

Inheritance diagram for LC::Util::CustomNetworkReply:
Collaboration diagram for LC::Util::CustomNetworkReply:

Public Member Functions

 CustomNetworkReply (const QUrl &url, QObject *parent=nullptr)
 Creates the reply with the given url and parent.
void SetContentType (const QByteArray &type)
 Sets the content type of this reply.
void SetContent (const QString &string)
 Sets content of this reply to the given string.
void SetContent (const QByteArray &data)
 Sets content of this reply to the given data.
void abort () override
 Reimplemented from QNetworkReply::abort().
qint64 bytesAvailable () const override
 Reimplemented from QNetworkReply::bytesAvailable().
bool isSequential () const override
 Reimplemented from QNetworkReply::isSequential().

Protected Member Functions

qint64 readData (char *, qint64) override

Detailed Description

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 26 of file customnetworkreply.h.

Constructor & Destructor Documentation

◆ CustomNetworkReply()

LC::Util::CustomNetworkReply::CustomNetworkReply ( const QUrl & url,
QObject * parent = nullptr )
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()

Parameters
[in]urlThe URL this custom reply corresponds to.
[in]parentThe parent object of this object.

Definition at line 15 of file customnetworkreply.cpp.

Member Function Documentation

◆ abort()

void LC::Util::CustomNetworkReply::abort ( )
override

Reimplemented from QNetworkReply::abort().

This function does nothing.

Definition at line 48 of file customnetworkreply.cpp.

◆ bytesAvailable()

qint64 LC::Util::CustomNetworkReply::bytesAvailable ( ) const
override

Reimplemented from QNetworkReply::bytesAvailable().

This function returns the number of bytes left unread.

Definition at line 52 of file customnetworkreply.cpp.

Referenced by readData().

Here is the caller graph for this function:

◆ isSequential()

bool LC::Util::CustomNetworkReply::isSequential ( ) const
override

Reimplemented from QNetworkReply::isSequential().

This function always returns true.

Definition at line 57 of file customnetworkreply.cpp.

◆ readData()

qint64 LC::Util::CustomNetworkReply::readData ( char * data,
qint64 maxSize )
overrideprotected

Definition at line 62 of file customnetworkreply.cpp.

References bytesAvailable().

Here is the call graph for this function:

◆ SetContent() [1/2]

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.

Parameters
[in]dataThe data this network reply should contain.

Definition at line 31 of file customnetworkreply.cpp.

◆ SetContent() [2/2]

void LC::Util::CustomNetworkReply::SetContent ( const QString & string)

Sets content of this reply to the given string.

This convenience function is equivalent to

SetContent (string.toUtf8 ());
void SetContent(const QString &string)
Sets content of this reply to the given string.
Parameters
[in]stringThe string to set.

Definition at line 26 of file customnetworkreply.cpp.

References SetContent().

Referenced by SetContent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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

SetHeader (QNetworkRequest::ContentType, type);

Definition at line 21 of file customnetworkreply.cpp.


The documentation for this class was generated from the following files:
  • /home/abuild/rpmbuild/BUILD/leechcraft-doc-0.6.70+git.17609.g3dde4097dd-build/leechcraft-0.6.70-17609-g3dde4097dd/src/util/network/customnetworkreply.h
  • /home/abuild/rpmbuild/BUILD/leechcraft-doc-0.6.70+git.17609.g3dde4097dd-build/leechcraft-0.6.70-17609-g3dde4097dd/src/util/network/customnetworkreply.cpp