Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QNetworkAccessCacheBackend Class Reference

#include <qnetworkaccesscachebackend_p.h>

+ Inheritance diagram for QNetworkAccessCacheBackend:
+ Collaboration diagram for QNetworkAccessCacheBackend:

Public Member Functions

 QNetworkAccessCacheBackend ()
 
 ~QNetworkAccessCacheBackend ()
 
void open () override
 You must implement this in your derived class.
 
void close () override
 You must implement this function in your derived class.
 
bool start () override
 Prepares the backend and calls open().
 
qint64 bytesAvailable () const override
 You must implement this function in your derived class.
 
qint64 read (char *data, qint64 maxlen) override
 Implement this function to support reading from the resource made available by your plugin.
 
- Public Member Functions inherited from QNetworkAccessBackend
 QNetworkAccessBackend (TargetTypes targetTypes, SecurityFeatures securityFeatures, IOFeatures ioFeatures)
 Constructs the QNetworkAccessBackend.
 
 QNetworkAccessBackend (TargetTypes targetTypes)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
 QNetworkAccessBackend (TargetTypes targetTypes, SecurityFeatures securityFeatures)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
 QNetworkAccessBackend (TargetTypes targetTypes, IOFeatures ioFeatures)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
virtual ~QNetworkAccessBackend ()
 Destructs the QNetworkAccessBackend base class.
 
SecurityFeatures securityFeatures () const noexcept
 Returns the security related features that the backend claims to support.
 
TargetTypes targetTypes () const noexcept
 Returns the TargetTypes that the backend claims to target.
 
IOFeatures ioFeatures () const noexcept
 Returns the I/O features that the backend claims to support.
 
bool needsResetableUploadData () const noexcept
 
virtual void ignoreSslErrors ()
 This function will be called when the user wants to ignore all TLS handshake errors.
 
virtual void ignoreSslErrors (const QList< QSslError > &errors)
 This function will be called when the user wants to ignore specific errors.
 
virtual QByteArrayView readPointer ()
 The data which the returned value views must stay valid until at least the next call to a non-const function.
 
virtual void advanceReadPointer (qint64 distance)
 This function is to notify your class that distance bytes have been read using readPointer and next time readPointer() is called those bytes should not be included.
 
virtual bool wantToRead ()
 This is called before we read if there are no bytes available and we are ready to read more.
 
QUrl url () const
 Returns the current URL of the reply.
 
void setUrl (const QUrl &url)
 Sets the URL of the reply.
 
QVariant header (QNetworkRequest::KnownHeaders header) const
 Returns the value of the header.
 
void setHeader (QNetworkRequest::KnownHeaders header, const QVariant &value)
 Sets the value of the header to value.
 
QByteArray rawHeader (const QByteArray &header) const
 Returns the value of the header.
 
void setRawHeader (const QByteArray &header, const QByteArray &value)
 Sets the value of the header to value.
 
QHttpHeaders headers () const
 
void setHeaders (const QHttpHeaders &newHeaders)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void setHeaders (QHttpHeaders &&newHeaders)
 
QNetworkAccessManager::Operation operation () const
 Returns the operation which was requested when calling QNetworkAccessManager.
 
bool isCachingEnabled () const
 Returns true if setCachingEnabled was previously called with true.
 
void setCachingEnabled (bool canCache)
 If canCache is true then this hints to us that we can cache the reply that is created.
 
void setAttribute (QNetworkRequest::Attribute attribute, const QVariant &value)
 Set attribute to value.
 
QIODevicecreateUploadByteDevice ()
 Creates a QIODevice for the data provided to upload, if any.
 
QIODeviceuploadByteDevice ()
 Returns the upload byte device associated with the current request.
 
QAbstractNetworkCachenetworkCache () const
 Returns the network cache object that was available when the request was started.
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 Constructs an object with parent object parent.
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects.
 
virtual bool event (QEvent *event)
 This virtual function receives events to an object and should return true if the event e was recognized and processed.
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 Filters events if this object has been installed as an event filter for the watched object.
 
QString objectName () const
 
Q_WEAK_OVERLOAD void setObjectName (const QString &name)
 Sets the object's name to name.
 
void setObjectName (QAnyStringView name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QBindable< QStringbindableObjectName ()
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false.
 
bool isWindowType () const
 Returns true if the object is a window; otherwise returns false.
 
bool isQuickItemType () const
 Returns true if the object is a QQuickItem; otherwise returns false.
 
bool signalsBlocked () const noexcept
 Returns true if signals are blocked; otherwise returns false.
 
bool blockSignals (bool b) noexcept
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it).
 
QThreadthread () const
 Returns the thread in which the object lives.
 
bool moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL)
 Changes the thread affinity for this object and its children and returns true on success.
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds.
 
int startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer)
 
void killTimer (int id)
 Kills the timer with timer identifier, id.
 
void killTimer (Qt::TimerId id)
 
template<typename T >
findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object.
 
template<typename T >
QList< T > findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects.
 
template<typename T >
findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T >
QList< T > findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
const QObjectListchildren () const
 Returns a list of child objects.
 
void setParent (QObject *parent)
 Makes the object a child of parent.
 
void installEventFilter (QObject *filterObj)
 Installs an event filter filterObj on this object.
 
void removeEventFilter (QObject *obj)
 Removes an event filter object obj from this object.
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
 
bool disconnect (const QObject *receiver, const char *member=nullptr) const
 
void dumpObjectTree () const
 Dumps a tree of children to the debug output.
 
void dumpObjectInfo () const
 Dumps information about signal connections, etc.
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value.
 
bool setProperty (const char *name, QVariant &&value)
 
QVariant property (const char *name) const
 Returns the value of the object's name property.
 
QList< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () const
 Returns a pointer to the parent object.
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false.
 

Additional Inherited Members

- Public Types inherited from QNetworkAccessBackend
enum class  TargetType { Networked = 0x1 , Local = 0x2 }
 Use the values in this enum to specify what type of target the plugin supports. More...
 
enum class  SecurityFeature { None = 0x0 , TLS = 0x1 }
 Use the values in this enum to specify what type of security features the plugin may utilize. More...
 
enum class  IOFeature { None = 0x0 , ZeroCopy = 0x1 , NeedResetableUpload = 0x2 , SupportsSynchronousMode = 0x4 }
 Use the values in this enum to specify what type of IO features the plugin may utilize. More...
 
- Public Slots inherited from QNetworkAccessBackend
void readyRead ()
 Call this slot when you have more data available to notify the backend that we can attempt to read again.
 
- Public Slots inherited from QObject
void deleteLater ()
 \threadsafe
 
- Signals inherited from QObject
void destroyed (QObject *=nullptr)
 This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked.
 
void objectNameChanged (const QString &objectName, QPrivateSignal)
 This signal is emitted after the object's name has been changed.
 
- Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 \threadsafe
 
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 \threadsafe
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static bool disconnect (const QMetaObject::Connection &)
 Disconnect a connection.
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
 
template<typename Func1 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
 
- Protected Slots inherited from QNetworkAccessBackend
void finished ()
 Call this slot when there will be no more data available, regardless of whether the transfer was successful or unsuccessful.
 
void error (QNetworkReply::NetworkError code, const QString &errorString)
 Call this slot if an error occurs.
 
void proxyAuthenticationRequired (const QNetworkProxy &proxy, QAuthenticator *auth)
 Call this slot if, when connecting through a proxy, it requests authentication.
 
void authenticationRequired (QAuthenticator *auth)
 Call this slot if the remote resource requests authentication.
 
void metaDataChanged ()
 Call this slot, if appropriate, after having processed and updated metadata (e.g.
 
void redirectionRequested (const QUrl &destination)
 Call this slot if, when connecting to the resource, a redirect to destination was requested.
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr.
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal.
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 This event handler can be reimplemented in a subclass to receive timer events for the object.
 
virtual void childEvent (QChildEvent *event)
 This event handler can be reimplemented in a subclass to receive child events.
 
virtual void customEvent (QEvent *event)
 This event handler can be reimplemented in a subclass to receive custom events.
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Properties inherited from QObject
QString objectName
 the name of this object
 

Detailed Description

Definition at line 25 of file qnetworkaccesscachebackend_p.h.

Constructor & Destructor Documentation

◆ QNetworkAccessCacheBackend()

QNetworkAccessCacheBackend::QNetworkAccessCacheBackend ( )

Definition at line 17 of file qnetworkaccesscachebackend.cpp.

◆ ~QNetworkAccessCacheBackend()

QNetworkAccessCacheBackend::~QNetworkAccessCacheBackend ( )

Definition at line 22 of file qnetworkaccesscachebackend.cpp.

Member Function Documentation

◆ bytesAvailable()

qint64 QNetworkAccessCacheBackend::bytesAvailable ( ) const
overridevirtual

You must implement this function in your derived class.

This function is called at various times. It may be called because the user called QNetworkReply::bytesAvailable(), and it may be called before an attempt to read is made.

While this function doesn't technically need to return an accurate number, it may result in reduced performance if it does not. This function must return zero if there are no bytes available.

Implements QNetworkAccessBackend.

Definition at line 98 of file qnetworkaccesscachebackend.cpp.

◆ close()

void QNetworkAccessCacheBackend::close ( )
overridevirtual

You must implement this function in your derived class.

This function gets called when the QNetworkReply is closed or aborted.

You should not emit an error or call finished() during this call since QtNetwork will set and emit the {QNetworkReply::OperationCanceledError} error by itself after control flow returns from this function.

Implements QNetworkAccessBackend.

Definition at line 96 of file qnetworkaccesscachebackend.cpp.

◆ open()

void QNetworkAccessCacheBackend::open ( )
overridevirtual

You must implement this in your derived class.

During this call you must open the connection and begin the request (see: request()).

As the connection progresses you must call the various public and protected slots on QNetworkAccessBackend. As an example, when you have received some data you must call readyRead(). And when all the data has been received you must call finished(). This could, for example, be done by binding signals inside your own implementation to the slots, or by calling them directly.

See also
close()

Implements QNetworkAccessBackend.

Definition at line 26 of file qnetworkaccesscachebackend.cpp.

◆ read()

qint64 QNetworkAccessCacheBackend::read ( char * data,
qint64 maxlen )
overridevirtual

Implement this function to support reading from the resource made available by your plugin.

Store data in data, up to a maximum of maxlen bytes. Then return the total amount of bytes that was copied.

See also
readPointer, wantToRead

Reimplemented from QNetworkAccessBackend.

Definition at line 103 of file qnetworkaccesscachebackend.cpp.

◆ start()

bool QNetworkAccessCacheBackend::start ( )
overridevirtual

Prepares the backend and calls open().

E.g. for TargetType::Networked it will prepare proxyList().

See also
TargetType, targetTypes

Reimplemented from QNetworkAccessBackend.

Definition at line 90 of file qnetworkaccesscachebackend.cpp.


The documentation for this class was generated from the following files: